2 macros in 1 script with toggle Topic is solved

Ask gaming related questions (AHK v1.1 and older)
taim

2 macros in 1 script with toggle  Topic is solved

14 Sep 2017, 09:45

Hii. I dont know eng so much. I need to get 2 macros in 1 script with toggle key, its not working. Msgbox saying to me "Error at line 23. - Line text: SendTheKey - Error: Duplicate label. - Program will exit."

Code

LShift::
RepeatKey := !RepeatKey
If RepeatKey
SetTimer, SendTheKey, 20
Else
SetTimer, SendTheKey, Off
Return

SendTheKey:
SendInput 7
SendInput 7
SendInput 8
Return

RShift::
RepeatKey := !RepeatKey
If RepeatKey
SetTimer, SendTheKey, 100
Else
SetTimer, SendTheKey, Off
Return

SendTheKey: this line is 23
SendInput z
SendInput 3
SendInput z
SendInput 3
Return
User avatar
TheDewd
Posts: 1510
Joined: 19 Dec 2013, 11:16
Location: USA

Re: 2 macros in 1 script with toggle

18 Sep 2017, 12:08

Code: Select all

LShift::
RShift::
    RepeatKey := !RepeatKey
    SetTimer, % (A_ThisHotkey = "LShift" ? "Label1" : "Label2"), % (RepeatKey ? A_ThisHotkey = "LShift" ? 20 : 100 : "Off")
return

Label1:
    SendInput, 778
return

Label2:
    SendInput, z3z3
return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: mikeyww and 96 guests