Jump to content

Please Help - Looping Problem


Recommended Posts

Hello, I'm trying to make a program play music each time my screenscreen saver pops up, and stop that music unpon the screensaver closing. My problem is very simple:

#include <Sound.au3>

; Define the more important variables.
$SSProcess = "Helios.scr" ; Process name of the screensaver.

; Run the program.
#include <Sound.au3>

; Define the more important variables.
$SSProcess = "Helios.scr" ; Process name of the screensaver.

; Run the program.
While 1
    If (ProcessExists($SSProcess)) Then
        $MusicFile = _SoundOpen("D:\Desktop\My Stuff\Media\Music\Toolbox\Ænima\15 Third Eye .mp3") ; Path to the music file.
        _SoundPlay($MusicFile, 1)
        ExitLoop
    Else
        _SoundStop(1)
        ContinueLoop
    EndIF
WEnd

How do I make the loop actually work. I have not tried a Do...Until yet, but I don't know if that would work.

Thanks for the help, Erbit.

Link to comment
Share on other sites

Try this...

#include <Sound.au3>

HotKeySet('{ESC}', 'quit')

$sound = @WindowsDir & '\media\Windows XP Startup.wav'
$screensaver = '3dwindowsxp.scr'

_SoundOpen($sound, 'mysound')

Sleep(3000)
ShellExecute(@SystemDir & '\' & $screensaver)

While 1
    Sleep(100)
    If ProcessExists($screensaver) Then _SoundPlay('mysound')
WEnd

Func quit()
    _SoundClose('mysound')
    Exit
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...