Batch file that will open a media player at a specific time

Click For Summary

Discussion Overview

The discussion revolves around creating a batch file to automatically play audio for Purple Martins at a specific time, specifically between 4 AM and 8 AM local time. Participants explore various methods to achieve this, including the use of batch files and Task Scheduler, while considering the limitations of built-in Windows commands.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant suggests using a batch file to run a media player that plays audio on a loop, expressing uncertainty about programming and DOS commands.
  • Another participant proposes using Task Scheduler to start and stop VLC media player, noting that VLC can accept command line arguments to play a file with a repeat option.
  • A different participant mentions that there is no built-in script command in Windows for this task but provides a reference to an article on configuring scripts with Task Scheduler.
  • This participant also outlines a basic structure for a batch file that could loop a command to play an audio clip and suggests using a scripting language for more complex functionality.

Areas of Agreement / Disagreement

Participants generally agree on the use of Task Scheduler and VLC as potential solutions, but there is no consensus on the best method or the feasibility of using a batch file alone.

Contextual Notes

Limitations include the assumption that the computer must be on for the solutions to work, and the lack of built-in commands in Windows for this specific task may restrict options.

Who May Find This Useful

Individuals interested in automating audio playback, particularly for wildlife or environmental purposes, as well as those looking to learn about batch files and Task Scheduler in Windows.

ConvenientParking
Messages
3
Reaction score
3
I have an acquaintance who's building houses for Purple Martins. He has audio he wants to play between 4AM and 8 AM local time that's supposed to be a dawn song for the birds. He's seeking a way to automatically play this audio on loop. I'm sure there are a million easier ways to do this, but my first thought was a batch file. I'm not any kind of programmer and I'm not familiar with DOS commands. But there has to be an easy enough way to accomplish this with a batch file, no? Run the batch file the night before, command prompt waits until the time to launch a media player set to run one audio file on a loop for 4 hours, and after 4 hours command prompt will exit the media player.

Obviously Windows, and obviously two dummies thinking about this. Thanks in advance for any help.
 
Technology news on Phys.org
One way to do it ...

1. Use Task Scheduler to start and stop the VLC media player.
2. VLC in command line mode accepts a media file name, and has a -repeat switch that loops back to the beginning.
 
  • Like
Likes   Reactions: ConvenientParking and jedishrfu
There's no builtin script command to do this in Windows. However this article may help you configure a script to run a command at a certain time using the Task Scheduler of Windows:

https://www.groovypost.com/howto/schedule-wake-sleep-windows-automatically/

It looks like you could write a simple batch file:

Bash:
:playclip
command to play audio clip
goto playclip

and then schedule it for some time and then expire it after so many hours using the TaskScheduler. The TaskScheduler would wakeup the computer to run the task.

Playing audio clips:

https://www.computerhope.com/issues/ch001041.htm

Alternatively, you could install a scripting language like Groovy or Rexx or some other Windows scripting language and code a loop that would monitor the time and then play your clip and then stop it at sometime. This would presume the computer is always on.
 
  • Like
Likes   Reactions: ConvenientParking
Thanks for the input, very helfpul. Off to the races. Happy New Year!
 

Similar threads

Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
Replies
1
Views
4K
Replies
74
Views
8K
  • · Replies 5 ·
Replies
5
Views
4K
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K