Goto command interfering with hotkey?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
VoidExplorer
Posts: 12
Joined: 11 Oct 2016, 12:18

Goto command interfering with hotkey?

19 Feb 2018, 09:35

Hey so I was wondering if the "goto" command could interfere with a hotkey for example:

Code: Select all

goto, 1
*some random code*
1:
d::
run, notepad.exe
In this example will then notepad run without waiting for the user to press d?
gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: Goto command interfering with hotkey?

19 Feb 2018, 10:03

Sure, haven't you tried it?
But that is not "interference", that is just code logic. You can stack multiple labels and hotkeys to use the same code. If you want to jump to a label with certain code and don't "run into" other code beneath the label, then use a return.

But better use gosub or functions for jumps. Goto often leads to uncomprehensible "spaghetti code" in larger scripts.

Code: Select all

gosub, 1
msgbox *some random code*
return

1:
msgbox I jumped here
return

d::
run, notepad.exe
return
Although numbers as labels seem to be ok, I would recommend "describing" labels instead, in order to prevent confusion with hotkeys.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Goto command interfering with hotkey?

19 Feb 2018, 10:11

gregster wrote:Sure, haven't you tried it?
Still not getting it why people wasting their own time with creating a request for something they are able to test/answer on their own in 3 seconds ... :wtf:
gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: Goto command interfering with hotkey?

19 Feb 2018, 10:13

BoBo wrote:
gregster wrote:Sure, haven't you tried it?
Still not getting it why people wasting their own time with creating a request for something they are able to test/answer on their own in 3 seconds ... :wtf:
Perhaps the OP actually meant to ask 'why'? But I don't know, either.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jameswrightesq, wpulford and 403 guests