Page 1 of 1

unexpected behaviour of a function call in a one-line hotkey

Posted: 17 Aug 2017, 12:26
by wolf_II
The following single-line script unexpectedly runs:

Code: Select all

F12::scaHELLOWORLD() ; no function defined with this name
Also, if I were to define a function with the name, the function would not get called. Please see https://autohotkey.com/boards/viewtopic ... 03#p165103.
In the thread forum user Helgef identified the problem as the line being interpreted as a remapping F12::sca. sca is the 9-key in the top row of the keyboard.

This is in contradiction to the documentation: https://autohotkey.com/docs/Hotkeys.htm#Intro
Hotkeys wrote:However, if a hotkey needs to execute only a single line, that line can be listed to the right of the double-colon.
After about two days no more responses were posted in the thread, so I think this might be an unknown bug.
I tested on Win10 64-bit with AHK v1.1.26.01 64-bit.

Re: unexpected behaviour of a function call in a one-line hotkey

Posted: 18 Aug 2017, 01:46
by Noesis
Interesting. At first I thought a space between the label & function might make a difference but, nope.
All I can do is offer another workaround that doesn't appear in the linked thread and that is to enclose the function in brackets

Code: Select all

F12::(scaHELLOWORLD()) ; works
It must be something to do with the way sc and vk keys are handled. Any function beginning with scX or vkX where X can be a valid hex number will do the same thing.

Re: unexpected behaviour of a function call in a one-line hotkey  Topic is solved

Posted: 27 Dec 2017, 19:40
by lexikos
Fixed in v1.1.27.00.

Re: unexpected behaviour of a function call in a one-line hotkey

Posted: 28 Dec 2017, 23:13
by wolf_II
With the words of Helgef: Thank you very much for AutoHotkey Christmas Edition :xmas: