Run Wave files from a macro

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Run Wave files from a macro

Postby charliem » Fri Mar 05, 2021 10:46 am

Hi,
Is there any way to execute a wav file from a macro? So for example I have a wave file that says Tool Zero complete. I want it to run after I set Z zero.

Any ideas?

Regards
Charlie
Regards
Charlie M
charliem
 
Posts: 104
Joined: Sun Jan 01, 2017 5:37 pm

Re: Run Wave files from a macro

Postby dezsoe » Fri Mar 05, 2021 11:15 am

Hi Charlie,

Try this:

Code: Select all
System.Media.SoundPlayer snd = new System.Media.SoundPlayer(@"yoursoundfile.wav");
snd.Play();
dezsoe
 
Posts: 2055
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Run Wave files from a macro

Postby charliem » Fri Mar 05, 2021 8:33 pm

Thanks dezsoe. I'll give it a shot and see what happens.
Regards
Charlie M
charliem
 
Posts: 104
Joined: Sun Jan 01, 2017 5:37 pm

Re: Run Wave files from a macro

Postby charliem » Fri Mar 05, 2021 9:20 pm

OK so I get a error about not finding the wave file. is there a specific place it needs to be?
Regards
Charlie M
charliem
 
Posts: 104
Joined: Sun Jan 01, 2017 5:37 pm

Re: Run Wave files from a macro

Postby dezsoe » Sat Mar 06, 2021 12:55 am

You have to write the whole path or you can use e.g. (Application.StartupPath + @"\Flashscreen\SOUND\reset.wav").
dezsoe
 
Posts: 2055
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Run Wave files from a macro

Postby charliem » Sat Mar 06, 2021 12:12 pm

Hey dezsoe I got it working.
Thanks for the help. ;)
Regards
Charlie M
charliem
 
Posts: 104
Joined: Sun Jan 01, 2017 5:37 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 6 guests