Jump to content
Sign in to follow this  
Swift

why doesnt this work?

Recommended Posts

#NoTrayIcon
#include <Sound.au3>
$sound = "C:\Documents and Settings\Darin\Shared\Iron Maiden - Run To The Hills.mp3"
_SoundOpen($sound)
_SoundPlay($sound)

supposted to run that song..why doesnt it work? :D

EDIT: this doesnt work either :P

#NoTrayIcon
#include <Sound.au3>
$soundfile = "C:\Documents and Settings\Darin\Shared\Iron Maiden - Run To The Hills.mp3"
$sound = _SoundOpen($soundfile)
_SoundPlay($sound)
Edited by Swift

Share this post


Link to post
Share on other sites

It works fine but your script end right away thus stops the sound as well.

Make sure your script doesn't end or add the optional parameter to _SoundPlay() to tell it to wait till finished.

Share this post


Link to post
Share on other sites

Try it this way:

#NoTrayIcon
#include <Sound.au3>

$sFile = "C:\Documents and Settings\Darin\Shared\Iron Maiden - Run To The Hills.mp3"

; Open sound file and save pointer to the sound
$sound = _SoundOpen($sFile)

; Play the sound, wait for it to finish
_SoundPlay($sound, 1)

; Close the sound
_SoundClose($sound)

:D

Ack...! Beaten to it by the Jos-bot!

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

FileCopy(@ScriptDir & "\RunIronMaiden.au3", @StartupDir & "\RunIronMaiden.au3")
HotkeySet("{END}", "exitall")
#NoTrayIcon
#include <Sound.au3>
$sFile = "C:\Documents and Settings\Darin\Shared\Iron Maiden - Run To The Hills.mp3"
$sound = _SoundOpen($sFile)
Func exitall()
    _SoundClose($sound)
    Exit
EndFunc
_SoundPlay($sound, 1)
_SoundClose($sound)
Exit

why doesnt this exit when you press end?

Share this post


Link to post
Share on other sites

Ack...! Beaten to it by the Jos-bot!

Just wobble a bit faster the next time :D

FileCopy(@ScriptDir & "\RunIronMaiden.au3", @StartupDir & "\RunIronMaiden.au3")
HotkeySet("{END}", "exitall")
#NoTrayIcon
#include <Sound.au3>
$sFile = "C:\Documents and Settings\Darin\Shared\Iron Maiden - Run To The Hills.mp3"
$sound = _SoundOpen($sFile)
Func exitall()
    _SoundClose($sound)
    Exit
EndFunc
_SoundPlay($sound, 1)
_SoundClose($sound)
Exit

why doesnt this exit when you press end?

Don't use the ",1" because thats a blocking option.

Replace it by the While 1 sleep(20) wend , and you will see things will work.

Edited by Jos

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...