AHK-v2-script-converter icon indicating copy to clipboard operation
AHK-v2-script-converter copied to clipboard

Hotstring, hard to tell if it is label, function or hotstring

Open dmtr99 opened this issue 3 years ago • 5 comments

A possible problem when converting the Hotkey command, it does not understands that the second command is pointing to a Key. WheelUp should need to become quoted "WheelUp". I could check if the second parameter is a valid hotkey, but the string DoubleUp is also a valid hotstring...

I am tending to accept this error for now, the rest seems to be working ok. This will notice the user with an error.

input:

NumpadAdd::
Hotkey, If, MouseIsOver("ahk_class Shell_TrayWnd")
if (doubleup := !doubleup)
    Hotkey, WheelUp, DoubleUp
else
    Hotkey, WheelUp, WheelUp
return

DoubleUp:
Send {Volume_Up 2}
return

Result:

NumpadAdd::
{ ; V1toV2: Added bracket
Hotkey("If", MouseIsOver("ahk_class Shell_TrayWnd"))
if (doubleup := !doubleup)
    Hotkey("WheelUp", DoubleUp)
else
    Hotkey("WheelUp", WheelUp)
return
} ; Added bracket before function

DoubleUp(ThisHotkey)
{ ; V1toV2: Added bracket
Send("{Volume_Up 2}")
return
} ; V1toV2: Added bracket in the end

dmtr99 avatar Sep 12 '21 18:09 dmtr99

i dont believe this line Hotkey, WheelUp, WheelUp is valid v1 code anyway. there is no WheelUp label

mmikeww avatar Sep 13 '21 00:09 mmikeww

in the documentation it is converted as Hotkey("WheelUp", "WheelUp"), so probably interpreted as a sendInput... I think I will add a folder of examples that currently are not correct translated, but skipped at the moment

dmtr99 avatar Sep 13 '21 16:09 dmtr99

Where in the docs? I'm not seeing it on the Hotkey command page

mmikeww avatar Sep 13 '21 16:09 mmikeww

lets see: https://www.autohotkey.com/boards/viewtopic.php?f=86&t=94678

mmikeww avatar Sep 13 '21 17:09 mmikeww