Goto/Gosub send first hotkey of label

Report problems with documented functionality
Malek_Necibi
Posts: 1
Joined: 24 Oct 2017, 20:47

Goto/Gosub send first hotkey of label

24 Oct 2017, 21:12

If the first line of a label is a remapping of a key, whenever a goto jumps to that label, the re-mapped key gets sent, even if the key isn't pushed.
In this case, the message box "2" should be sent regardless, but the Exit closes the script before the msgbox can be shown.
Sorry if this isn't a good description, this is my first time ever using the forum. :)
lexikos
Posts: 5453
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Goto/Gosub send first hotkey of label

24 Nov 2017, 01:32

This is by design.

Within a larger script, both labels ("Two" and "*a") would point at the next available line of executable code: Exit.

A subroutine ends only at a command flow statement, such as Return or Exit, not at a label. The only exception is the script's first hotkey, which is documented as ending the auto-execute section. (This is why the example you posted cannot be used to replicate the problem you described.)

To avoid confusion, note that a::Exit is a one-line hotkey, not a "remapping". "a::" is a label, similar to "one:", and stacks the same way. You cannot put one subroutine inside another (unless you skip over it with Goto), and that includes hotkey subroutines.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 3 guests