While running a script, how do I activate a hotkey which is defined in the same file in another location? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
t4akawolf
Posts: 12
Joined: 30 Jul 2016, 03:30

While running a script, how do I activate a hotkey which is defined in the same file in another location?

13 Jun 2019, 08:50

Is this possible?

The following is my rough intention:

Code: Select all

hotkey1:: (action)

hotkey2:: (action)

hotkey3:: (action)

hotkey4:: (action) and also if conditionA, call hotkey1, else if conditionB, call hotkey2, else call hotkey3
I don't want to be inefficient and redefine the first three actions within hotkey4 again. I'm sure there's a right way to achieve this; could anyone please tell me?
Rohwedder
Posts: 2290
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: While running a script, how do I activate a hotkey which is defined in the same file in another location?

13 Jun 2019, 09:09

Hallo,
try:

Code: Select all

1::MsgBox, 1
2::MsgBox, 2
3::MsgBox, 3
4::
IF A_PriorHotkey between 1 and 3
	Goto,% A_PriorHotkey
Return
t4akawolf
Posts: 12
Joined: 30 Jul 2016, 03:30

Re: While running a script, how do I activate a hotkey which is defined in the same file in another location?  Topic is solved

13 Jun 2019, 09:37

Oh, I didn't see your response. I was researching in the meanwhile and I came back to report that I worked it out by using Labels and goto. As follows:

Code: Select all

Label1:
hotkey1:: (action)

Label2:
hotkey2:: (action)

Label3:
hotkey3:: (action)

Label4:
hotkey4:: (action) and also if conditionA, goto Label1, else if conditionB, goto Label2, else goto Label3
I really appreciate your response, though :)

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Bpd, Google [Bot], ShadowMaster85, Xtra and 71 guests