Jump to content
Sign in to follow this  
Swift

why doesnt this work?

Recommended Posts

Swift

#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
Jos

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.


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Swift

haha...i could just add While 1 Wend....lol...but thanks forgot that part :D

Share this post


Link to post
Share on other sites
PsaltyDS

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
Swift

sweeeett!! just what i was looking for...lol...thanks :D

Share this post


Link to post
Share on other sites
Swift

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
Jos

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×