AHK-v2-script-converter
AHK-v2-script-converter copied to clipboard
InputBox code not converted
Input:
InputBox, Hotstring, New Hotstring, Provide the corrected word on the right side. You can also edit the left side if you wish.`n`nExample entry:`n::teh::the,,,,,,,, ::%Hotstring%::%Hotstring%
The converter didn't convert this code.
Manually converted code:
Hotstring := InputBox("Provide the corrected word on the right side. You can also edit the left side if you wish.`n`nExample entry:`n::teh::the", "New Hotstring", "", "::%Hotstring%::%Hotstring%")
InputBox() returns an obj so your conversion is wrong
if/when we add conversion support, we should probably do it like this:
v1
InputBox, OutputVar , Title, Prompt
v2
OutputVar := InputBox(Prompt, Title).VALUE
but there is also the hassle of converting all the options
From V1 docs:
ErrorLevel is set to 1 if the user presses the CANCEL button, 0 if the user presses OK, or 2 if the dialog times out.
From v2 docs:
This function returns an object with the following properties:
- Value (String): The text entered by the user.
- Result (String): One of the following words indicating how the input box was closed: OK, Cancel, or Timeout.
So, if Errorlevel is present after the InputBox as in https://github.com/mmikeww/AHK-v2-script-converter/issues/134#issuecomment-1908633632, it needs to converted as well.
yep thats annoying
maybe a multi line conversion, something like this
v1
InputBox, OutputVar, Title, Prompt
v2
InputBoxObj := InputBox(Prompt, Title)
OutputVar := InputBoxObj.Value
ErrorLevel := (InputBOxObj.Result = "OK") ? 0 : (InputBoxObj.Result = "Cancel") ? 1 : 2
something like that.. would need testing
Minimal example InputBox, Test, ::Test::Test
I think the hotkey regexs are firing even when it shouldn't
This RegEx probably could be used, needs more testing
From: ^\s*(.*[^\s]::).*$
To:___ ^\s*([^,\s]*|[$~!^#+]*,)::.*$