Sign in to follow this  
Followers 0
Splitz

Need help with a script

6 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Thanks lanN1990, i've got the sound part working so far now.

Still confused for the other parts though :)

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by Blinky

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