Splitz Posted January 23, 2012 Share Posted January 23, 2012 I'm trying to create a script that will do the following: If i press 1 it will play a 'beep' activation sound indicating that its on, ready, and waiting for the color 2E1700 to appear (Would prefer a custom sound though, How do you add .wav files?) When 2E1700 appears, or if 2E1700 is already active during the time i press 1 it will send the 1 key At anytime if i press the 1 key a second time before 2E1700 appears at all, a second beep will sound off (of a different frequency, or just an "off.wav", and the entire function will stop so that if 2E1700 appears, NOTHING will happen Here is what i have so far, i'm really nooby at coding these things but this is the best i can do so far.. it only makes the beep sound AFTER 2E1700 appears and i dont know how to make a function to turn it off. HotKeySet("1", "Test") While 1 Sleep(100) WEnd Func Test() Do Sleep(1) PixelSearch(689, 767, 699, 777, 2E1700, 5) Until Not @error ControlSend("Comodo", "", "", "1") Beep(5500, 500) EndFunc Link to comment Share on other sites More sharing options...
IanN1990 Posted January 23, 2012 Share Posted January 23, 2012 (edited) SoundPlay - HelpfilePlay a sound file.SoundPlay ( "filename" [, wait] )SoundPlay(@WindowsDir & "mediatada.wav",1)Also from my experience you shoud avoid using sleep(1) As a min go for Sleep(10) but normally u should use sleep(100) or (250). To keep CPU usage down but still keep it effect. Edited January 23, 2012 by IanN1990 Link to comment Share on other sites More sharing options...
Splitz Posted January 23, 2012 Author Share Posted January 23, 2012 Thanks lanN1990, i've got the sound part working so far now. Still confused for the other parts though Link to comment Share on other sites More sharing options...
IanN1990 Posted January 23, 2012 Share Posted January 23, 2012 Well if u update the Orginal Post with your new code, then others better suited will be able to help you with ur remaining problems Link to comment Share on other sites More sharing options...
Splitz Posted January 23, 2012 Author Share Posted January 23, 2012 I've only really replaced the 'beep' sound with the Playsound thing, i still have no idea how to turn it off or on, its basicly the same =3 Link to comment Share on other sites More sharing options...
Blinky Posted January 23, 2012 Share Posted January 23, 2012 (edited) here is a working script (a adaptation of the pause function found in the Scite HELP FILE) Global $On HotKeySet("{1}", "on_off") While 1 ToolTip("Not working") Sleep(10) WEnd Func on_off() if Not $on Then Beep(1000, 500) ; On Else Beep(5500, 500) ; Off EndIf $On = Not $On While $On ToolTip("Working") Sleep(50) PixelSearch(689, 767, 699, 777, 0x2E1700, 5) If Not @error Then ControlSend("Comodo", "", "", "1") Sleep(100) EndIf WEnd EndFunc Edited January 23, 2012 by Blinky Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now