Trouble with a funtion when named "Scale" or "vk1234" Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Posts: 2123
Joined: 08 Feb 2015, 20:55

Trouble with a funtion when named "Scale" or "vk1234"

15 Aug 2017, 13:48

Hi all,

I have trouble when I want to name a function "Scale".
Here is an example with a function named "xScale" and it works as intended.
When I rename the function to "Scale" as I desire (yes, I renamed all 3 occurrences of its name), the function does not work any more.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Can anybody confirm, please? Better yet, can anybody explain please why this is?

I also have trouble with "vk1234" as a function name, which lets me think there might be some interference with scan code and/or virtual key code.
To clarify: I have no desire to name a function "vk1234", but I did test my "scan code" theory. explains about variable names.
I can't find a help topic about function names. I have assumed up til now that both are treated as "idioms" (if that is the correct term?), whose rules are explained in the docs.
I am obviously wrong about that too. :(

Thanks for reading! :)

Edit: I will likely change the function name to "Zoom()", but I still want to learn about this problem.
Posts: 3163
Joined: 17 Jul 2016, 01:02

Re: Trouble with a funtion when named "Scale" or "vk1234"  Topic is solved

15 Aug 2017, 16:38

This works fine,

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus


your problem is that the one line hotkey is being interpreted as a remapping hotkey, ^WheelUp::sca, that is, ^WheelUp remapped to 9.
Try this in notepad, you see

Code: [Select all] [Download] GeSHi © Codebox Plus



Code: [Select all] [Expand] [Download] (Untitled.txt)GeSHi © Codebox Plus

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. In other words, the return is implicit:

So it is a bug.


Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus




Edit: Tested on AHK and latest (I think) v2
Posts: 2123
Joined: 08 Feb 2015, 20:55

Re: Trouble with a funtion when named "Scale" or "vk1234"

15 Aug 2017, 17:28

Thanks Helgef. :thumbup:

I did notice before in the key history the 9 and did not understand where it came from.
So, Scale() is interpreted as only sca, where a is a hexadecimal 10, and apparently scan code 10 is the 9-key in the top row of the keyboard. The remaining le() is disregarded. Somewhat unintuitive.

I noticed in your example for me to test in Notepad that the script executes without even a function scaHELLOWORLD() being defined in the script. Excellent example!!
Thank you for taking the time and looking into this.

I probably should have mentioned that I tested on Win10 64-bit. The most recent update came a couple of days ago, it is called "Creators Update" I think, but that is irrelevant to the problem.
What is relevant: I tested with AHK v1.1.26.01 64-bit.

I will wait about two days from now to see if there will be more responses, then I will mark your post as "accepted answer" and post in the subforum "Bug Reports".
Unless you want to post a bug report yourself, which is OK by me. After all, you have done all the work.

I highly appreciate your input. :D
Posts: 3163
Joined: 17 Jul 2016, 01:02

Re: Trouble with a funtion when named "Scale" or "vk1234"

15 Aug 2017, 17:50

So Scale() [...]

Indeed, that is how it seems.
Waiting is good, maybe someone knows where it is documented or if it has already been reported. You can post.

Return to “Ask For Help”

Who is online

Users browsing this forum: Flory and 69 guests