Sign in to follow this  
Followers 0
Swift

why doesnt this work?

7 posts in this topic

#1 ·  Posted (edited)

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                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

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

#4 ·  Posted (edited)

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

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

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

#7 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                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  
Followers 0