Jump to content

Recommended Posts

Posted

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
Posted

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

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
  • Recently Browsing   0 members

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