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

Report problems with documented functionality
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

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

17 Aug 2017, 12:26

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.
Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

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

18 Aug 2017, 01:46

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.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

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

28 Dec 2017, 23:13

With the words of Helgef: Thank you very much for AutoHotkey Christmas Edition :xmas:

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 23 guests