playwav> in background of script?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
JeffDaruecan
Newbie
Posts: 18
Joined: Thu Mar 25, 2010 11:00 am
Location: Vancouver

playwav> in background of script?

Post by JeffDaruecan » Sun Mar 28, 2010 11:33 am

I'm wondering how if possible the playwav> command can run in the background while the script does its normal thing.

I was checking out the splash screen script by Rain
http://www.mjtnet.com/forum/viewtopic.php?t=4738

And thought it would make a nice addition to one of my scripts if I had a little splash screen with a small tune play during the fade in.

right now no matter what I seem to try, it always waits for the wav to finish playing then carries on with the script.

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Mar 29, 2010 5:01 am

Write the playwav line to a second script, then excute the script.

Add something like this in your script where your splash dialog starts.

Code: Select all

WriteLn>%temp_dir%playitwith.scp,wres,Playwav>C:\WINDOWS\Media\Windows XP Startup.wav
WriteLn>%temp_dir%playitwith.scp,wres,DeleteFile>%temp_dir%playitwith.scp
ExecuteFile>%temp_dir%playitwith.scp

JeffDaruecan
Newbie
Posts: 18
Joined: Thu Mar 25, 2010 11:00 am
Location: Vancouver

Post by JeffDaruecan » Mon Mar 29, 2010 8:39 am

oh wow, I didn't realize writeLn could create scripts like that and so easily.

Thank you.

Nothing like having a short clip of the terminator theme during a fade in splash screen haha

Niroj@Work
Pro Scripter
Posts: 63
Joined: Thu Dec 10, 2009 8:13 am

Post by Niroj@Work » Thu Apr 01, 2010 6:02 am

Can we do the same after creating Exe?

JeffDaruecan
Newbie
Posts: 18
Joined: Thu Mar 25, 2010 11:00 am
Location: Vancouver

Post by JeffDaruecan » Thu Apr 01, 2010 11:14 am

Yep you sure can :) with some slight differences but keeping the same basic idea JRL said.

Just make a brand new script call it whatever you like and have it play a wav file then compile that single play script into its own .exe
Now all you have to do is use the import binary file, and import the newly created playwav.exe. Just remember to use the export data function at the start of the script.

Once you have the playwav.exe imported into into your main script with exportation at the beginning remove the WriteLn info and place ExecuteFile>%Temp_Dir%\playwav.exe

It does however play it out of sync by a little bit but its usually pretty good and I'm not sure if there is anyway to set it up and have it always in sync

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts