Same hotkey twice not working

Get help with using AutoHotkey and its commands and hotkeys
MonuKashyap
Posts: 74
Joined: 06 Jun 2016, 21:32

Same hotkey twice not working

07 Nov 2020, 21:56

Suppose this example

Code: Select all

;;----start----------

q::
break=1
sleep 200
break=

Loop
{
tooltip % a_index
if break
break
}

Return

;;----end---------
[Mod edit: [code][/code] tags added.]

in the above example, i want to work the button q always when it pressed :dance: , but it works for the first time only :?
anyone can help me please...
User avatar
mikeyww
Posts: 5300
Joined: 09 Sep 2014, 18:38

Re: Same hotkey twice not working

07 Nov 2020, 22:02

Are you looking for a toggle? Perhaps something like this.

Code: Select all

#MaxThreadsPerHotkey 2

q::
go := !go
While go
 ToolTip, %A_Index%
ToolTip
Return
Your current code does not make sense because-- if you follow it line by line-- break is set and then immediately reset, so when it gets to the loop, the condition is never met.
Rohwedder
Posts: 3968
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Same hotkey twice not working

08 Nov 2020, 01:38

Hallo,
or:

Code: Select all

;;----start----------
a = 0
q::
break=1
sleep 200
break=
SetTimer, Loop, 10
Loop:
if !break
	tooltip % a++
Return
;;----end---------

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], bonswouar, hasantr, jrachr, MrCheeseman, RayB, TAC109, theon, vmech, XMCQCX and 38 guests