2 Macros in 1 Script With Toggle Topic is solved

Ask gaming related questions (AHK v1.1 and older)
dangerel
Posts: 6
Joined: 14 Sep 2017, 09:33

2 Macros in 1 Script With Toggle

14 Sep 2017, 10:45

Hallo. I dont know Eng so much. I need to run 2 macros in 1 script with toggle key, i have a script but its not working. Msgbox saying to me "Line 23 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: line 23 is here
SendInput z
SendInput 3
SendInput z
SendInput 3
Return
yessorryno
Posts: 22
Joined: 12 Sep 2017, 03:13

Re: 2 Macros in 1 Script With Toggle  Topic is solved

14 Sep 2017, 21:55

Hi

The problem is duplicate label.

There can not be two identical to the address(SendTheKey:,SendTheKey1:)

Change the code to the following, you can successfully execute

Code: Select all

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, SendTheKey1, 100
Else
SetTimer, SendTheKey1, Off
Return

SendTheKey1: 
SendInput z
SendInput 3
SendInput z
SendInput 3
Return
dangerel
Posts: 6
Joined: 14 Sep 2017, 09:33

Re: 2 Macros in 1 Script With Toggle

16 Sep 2017, 02:08

yessorryno wrote:Hi

The problem is duplicate label.

There can not be two identical to the address(SendTheKey:,SendTheKey1:)

Change the code to the following, you can successfully execute

Code: Select all

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, SendTheKey1, 100
Else
SetTimer, SendTheKey1, Off
Return

SendTheKey1: 
SendInput z
SendInput 3
SendInput z
SendInput 3
Return
thx its working ^-^

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Google [Bot], phalanxdarken and 113 guests