Jump to content
Sign in to follow this  
PharonWolf

Easy Script

Recommended Posts

PharonWolf

Have a very simple script but I feel like I'm approaching this the wrong way, if someone could show me how to do this it would be appreciated.

All I'm trying to do is make a script that when I press Z will press TAB and ENTER forever, and when I press C will exit.

Global $a
$a = 1
HotKeySet("z", "RunProgram")
HotKeySet("c", "ExitProgram")

If $a = 1 Then
    Sleep(100)
EndIf

if $a = 2 Then
    Sleep(1000)
    Send("{TAB}")
    Send("{ENTER}")
EndIf

if $a = 3 Then
    Exit
EndIf

Func RunProgram ()
    $a = 2
EndFunc

Func ExitProgram ()
    $a = 3
EndFunc

Share this post


Link to post
Share on other sites
Zulqarnain

Have a very simple script but I feel like I'm approaching this the wrong way, if someone could show me how to do this it would be appreciated.

All I'm trying to do is make a script that when I press Z will press TAB and ENTER forever, and when I press C will exit.

Global $a
$a = 1
HotKeySet("z", "RunProgram")
HotKeySet("c", "ExitProgram")

If $a = 1 Then
    Sleep(100)
EndIf

if $a = 2 Then
    Sleep(1000)
    Send("{TAB}")
    Send("{ENTER}")
EndIf

if $a = 3 Then
    Exit
EndIf

Func RunProgram ()
    $a = 2
EndFunc

Func ExitProgram ()
    $a = 3
EndFunc

Here you go:

HotKeySet("z", "RunProgram")
HotKeySet("c", "ExitProgram")

While 1
    Sleep(200)
WEnd

Func RunProgram()
    While 1
        Send("{TAB}")
        Send("{ENTER}")
    WEnd
EndFunc   ;==>RunProgram

Func ExitProgram()
    Exit 0
EndFunc   ;==>ExitProgram

Share this post


Link to post
Share on other sites
PharonWolf

Ah, it worked perfectly thank you.

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  

×