Jump to content

Need help with a script


Splitz
 Share

Recommended Posts

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

SoundPlay - Helpfile

Play 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 by IanN1990
Link to comment
Share on other sites

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 by Blinky
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...