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

AI Thread Summary
An acquaintance is looking to automate the playback of a dawn song for Purple Martins between 4 AM and 8 AM using a batch file. The discussion suggests using Windows Task Scheduler to start and stop VLC media player, which can play audio files in command line mode with a repeat option. A simple batch file could be created to loop the audio playback, and Task Scheduler can wake the computer to execute the task at the designated time. Alternatively, installing a scripting language like Groovy or Rexx could allow for a more customized solution that monitors time and controls playback, assuming the computer remains on. The conversation emphasizes the feasibility of these methods for non-programmers.
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 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 ConvenientParking
Thanks for the input, very helfpul. Off to the races. Happy New Year!
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top