Using default system sounds, instead of specified .wav files

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
mmorrison
Newbie
Posts: 13
Joined: Thu Apr 14, 2005 7:15 pm
Location: Arkansas

Using default system sounds, instead of specified .wav files

Post by mmorrison » Fri Aug 05, 2005 2:28 am

I want to send a compiled macro that gives audio feedback depending on success or failure, when run. However, I want to avoid the need to send specific .wav files & specify locations, etc. I also don't feel I can depend on any specific .wav file to be found in the windows folder - for that matter, I can't be sure the windows folder is named 'Windows'.

Under Windows control panel, sounds & audio devices, are default sound configurations for windows. I'm thinking I should be able to acquire the current paths to the 'Default Beep' and 'Exclamation' sounds in Windows, to always ensure I have valid sound files, without concern with locating them.

Is this the best plan, and if so, what's an easy way to do this?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Aug 09, 2005 9:09 am

Use the Windows API PlaySound function. Like this:

LibFunc>winmm.dll,PlaySoundA,ps,SYSTEMSTART,0,0
LibFunc>winmm.dll,PlaySoundA,ps,SYSTEMEXIT,0,0
LibFunc>winmm.dll,PlaySoundA,ps,SYSTEMHAND,0,0
LibFunc>winmm.dll,PlaySoundA,ps,SYSTEMASTERISK,0,0
LibFunc>winmm.dll,PlaySoundA,ps,SYSTEMQUESTION,0,0
LibFunc>winmm.dll,PlaySoundA,ps,SYSTEMEXCLAMATION,0,0
LibFunc>winmm.dll,PlaySoundA,ps,SYSTEMWELCOME,0,0
LibFunc>winmm.dll,PlaySoundA,ps,SYSTEMDEFAULT,0,0
LibFunc>winmm.dll,PlaySoundA,ps,Mailbeep,0,0
LibFunc>winmm.dll,PlaySoundA,ps,WindowsLogon,0,0

Just provide the sound alias name. Earlier versions of windows listed these in win.ini. In XP you'll find them in the registry under:

HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\
MJT Net Support
[email protected]

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