return

Get help with using AutoHotkey and its commands and hotkeys
awcrt9316
Posts: 61
Joined: 03 Mar 2020, 20:06

return

29 Apr 2020, 11:48

is it possible to return to the beginning of your script inside of a subroutine? I have about 30 autohotkeys and each of them will have something like below

Code: Select all

+a::
if(true)
   return
+w::
if(true)
   return
User avatar
JoeWinograd
Posts: 1630
Joined: 10 Feb 2014, 20:00

Re: return

29 Apr 2020, 12:59

Let's start by getting some terminology straight. A script is a single AutoHotkey file, e.g., MyHotkeysHotstrings.ahk. It may contain any number of hotkeys and/or hotstrings — or it may contain none. A subroutine is a set of AHK statements (identified by a label) that get called/executed via the Gosub command. When the subroutine is done, it goes back to the caller via the Return command, with the line after the Gosub command being the next one executed.

When you run a script that has hotkeys and/or hotstrings in it, it stays running, known as Persistent. So, "return to the beginning of your script" is not an issue, i.e., your script will stay running with all 30 hotkeys that you've defined remaining in effect, waiting to be fired when you hit the keyboard with them. The only way they'll stop running is via the Exit context menu pick or executing the ExitApp command in the script.

There are no subroutines in the code you posted. I don't know what you mean with the "inside of a subroutine" comment, unless you are confusing "hotkey" and "subroutine". Regards, Joe

Return to “Ask For Help”

Who is online

Users browsing this forum: Haan, Recrix, takenbythedesert and 46 guests