Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Task Scheduler to play an audio file

Status
Not open for further replies.

Shimmy613

Programmer
Feb 14, 2011
39
0
0
US
I'd like to schedule a task to play an audio file. From the command line, this works successfully to play the file:

Code:
"%ProgramFiles(x86)%\Windows Media Player\wmplayer.exe" /play /close "C:\ALL DATA\Shimmy\Shimmy's Documents\Morning audio reminders for kids\8-00 AM reminder.WMA"

(Although it doesn't close WMP like it seems like it should.)

When I schedule a task like that, though, nothing happens when it runs - and Task Scheduler claims it ran successfully.

As shown in this screenshot, there are 3 fields to fill in. What do you recommend I put in those? I've tried all different combinations but can't seem to get it to work...

Thanks!
Shimmy
 
Are you using "Create a Basic Task" as your template? See if you skip that and use the option below that called "Create Task", there are more options in that template such as running with higher privileges and options about who is logged on etc.
 
I used the "advanced" way of creating and did choose running with with highest privileges and regardless of who's logged-in...

When I run the task manually from Task Scheduler, it doesn't work, either...
 
Cheating way around it? Create a batch which is called by Scheduler??

"Silence is golden, duct tape is silver...
 
Do I just dump this:
Code:
"%ProgramFiles(x86)%\Windows Media Player\wmplayer.exe" /play /close "C:\ALL DATA\Shimmy\Shimmy's Documents\Morning audio reminders for kids\8-00 AM reminder.WMA"
into a text file and save it with a BAT extension, then have Task Scheduler run that file?
 
Basically all I did for a cut and dry quick one, was omit the beginning and just have the batch file call the audio file. Do that and see if it can be called by the Scheduler.

One of the great Batch guys here will be able to help you tweak it as im a bit of a batch noob.

"Silence is golden, duct tape is silver...
 
for one, the "/Play" and "/Close" switches ONLY work for WMediaPlayer 6.4 (so ancient information) and are thus OBSOLETE...

the "/play" switch is just dropped:

e.g. "%ProgramFiles(x86)%\Windows Media Player\wmplayer.exe" /play "D:\mymusic\mysong.wma"

would just become

"%ProgramFiles(x86)%\Windows Media Player\wmplayer.exe" "D:\mymusic\mysong.wma"

the "/close" switch was dropped completely, with no replacement...

and there seems to be a bit of a bug in the Win7 Task Scheduler, that prevents some tasks to run correctly:
Task Scheduler work-around for Win7
I have the same trouble with Win7 Task Scheduler - Creating a simple task to launch a script/program does not work.

I exported my non-working task as well as a working MS task and compared them. I changed the following parameter in my exported task and re-imported it and now it works:
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>

This work-around is getting me by for now.

Other thoughts:
There does not appear to be a Task Scheduler GUI setting to affect this parameter?
The API description implied a setting of false should work, but for some reason it doesn't?
It's hard to believe such a fundemental overshight exists; could it be something else with my Win7 setup that requires the true setting?
I seem to recall the same problem with a fresh Vista install in the past that was mysteriously resolved before I investigated a work-around. Hmmm...
I think I read also that the new scheduling engine associated with the true setting curiously does not support things like monthly scheduling....?
source: MSDN Task Scheduler

I have no way of testing at present, no Windows 7 OS around...


Ben
"If it works don't fix it! If it doesn't use a sledgehammer..."
How to ask a question, when posting them to a professional forum.
Only ask questions with yes/no answers if you want "yes" or "no"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top