Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

How can I play Windows sounds (OK, Asterisk, Question, etc)


  • Please log in to reply
10 replies to this topic

#1 Noob

Noob

    Adventurer

  • Active Members
  • PipPip
  • 103 posts

Posted 07 January 2007 - 09:23 PM

AutoIt sound functions can help when we need to play mp3 and wav files, but how can I go about playing Windows sounds like Question, Exclamation, OK, and Asterisk?







#2 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,758 posts

Posted 07 January 2007 - 09:35 PM

It's stored in registry:
$wav = RegRead("HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemStart\.Current","") ;~ $wav = C:\WINDOWS\media\notify.wav ;~ MsgBox(0,'',$wav) SoundPlay($wav,1)


SystemStart, SystemAsterisk, SystemExclamation, SystemQuestion, ...

#3 Noob

Noob

    Adventurer

  • Active Members
  • PipPip
  • 103 posts

Posted 07 January 2007 - 09:57 PM

Zedna, thanks much! I'm glad it is possible. But for some reason when I run the above script I hear no sound. But I do hear the sound when I just do the following:
SoundPlay("C:\WINDOWS\media\notify.wav",1)

Edited by Noob, 07 January 2007 - 09:58 PM.


#4 BALA

BALA

    I'm a pirate! :)

  • Active Members
  • PipPipPipPipPipPip
  • 504 posts

Posted 07 January 2007 - 10:01 PM

Your computer may have it's sound files in a different place.
BA-LAhttp://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

#5 Noob

Noob

    Adventurer

  • Active Members
  • PipPip
  • 103 posts

Posted 07 January 2007 - 10:08 PM

Your computer may have it's sound files in a different place.


Thanks, BALA. I'm looking for a solution that would work on any pc. The script by Zedna gave me hope it would be possible, but for some reason it's not working yet.

Edited by Noob, 07 January 2007 - 10:09 PM.


#6 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,758 posts

Posted 07 January 2007 - 10:10 PM

Zedna, thanks much! I'm glad it is possible. But for some reason when I run the above script I hear no sound. But I do hear the sound when I just do the following:

SoundPlay("C:\WINDOWS\media\notify.wav",1)

Just uncoment line with MsgBox() and check if that file exists.
Also run RegEdit and look at HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\

Note: I tested this on WIN98, so maybe on WINXP it may be somewhere else.

#7 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,758 posts

Posted 07 January 2007 - 10:12 PM

I found HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\ by searching in registry for "notify.wav".
So try the same.

Edited by Zedna, 07 January 2007 - 10:12 PM.


#8 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,758 posts

Posted 07 January 2007 - 10:14 PM

Thanks, BALA. I'm looking for a solution that would work on any pc. The script by Zedna gave me hope it would be possible, but for some reason it's not working yet.


My method will not work if user have non default Windows Scheme:
HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\

#9 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,758 posts

Posted 07 January 2007 - 10:31 PM

Finally I found true solution!
Use API MessageBeep() with DllCall() See here for details.

EDIT:
DllCall ("user32.dll", "int", "MessageBeep", "int", 0x00000040)

Edited by Zedna, 07 January 2007 - 10:36 PM.


#10 Noob

Noob

    Adventurer

  • Active Members
  • PipPip
  • 103 posts

Posted 07 January 2007 - 10:41 PM

Thanks. The location on my machine is the same:

HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\

(and this pc uses the default sound scheme).

I suspect a problem may be that the value for $wav your scrips it getting is %SystemRoot%\media\Windows XP Notify.wav and the following will not play:

SoundPlay("%SystemRoot%\media\Windows XP Notify.wav",1)ƒo݊÷ Ù»­¶¬v‡¬jëhŠ×6SoundPlay("C:\WINDOWS\media\Windows XP Notify.wav",1)


So my noob-type question is how I can modify your script to I guess substitute the %SystemRoot% part with @WindowsDir?


EDIT: I'm going to look at the other solution you just posted. Thanks!

Edited by Noob, 07 January 2007 - 10:43 PM.


#11 Noob

Noob

    Adventurer

  • Active Members
  • PipPip
  • 103 posts

Posted 07 January 2007 - 10:51 PM

Zedna, it works!!!

:) :P :) :D :D

Thank you very much!!!

Edited by Noob, 07 January 2007 - 10:52 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users