- Take an AHKv1 library
- using ahkv2converter, pass a script to be converted to v2 during runtime
- Example use cases for me were MagicBox, SmartGui, etc. On "Save" passing a script to be converted.
it's just got three snippets:
1. function to add to an old code, supplying a path or out-code
2. a launch script that handles pointing to the ahk.exe file
3. store temporary scripts or logs for runtime use.
Let's say I want AutoGUI's save function to convert the output script to v2
(step 0, download ahkconverter https://github.com/mmikeww/AHK-v2-script-converter)
This code launches the v1 library/gui/app
Code: Select all
#Requires Autohotkey v2.0
exe := "`"" A_ScriptDIr "\AutoHotKey Exe\AutoHotkeyV1.exe`" "
autogui := "`"" A_ScriptDIr "\AutoGUI.ahk`""
com := exe autogui
Run(com)
After completion I pass the path to my listener script.
This code goes inside "autogui.ahk" in this example:
Code: Select all
run_listener(FilePathToBeConverted){
q := """"
exe := q . A_ScriptDIr . "\AutoHotKey Exe\AutoHotkeyV2.exe" . q . " "
script := q . A_ScriptDIr . "\listener.ahk" . q
com := exe . script
Log := A_ScriptDir "\log.ahk"
if FileExist(Log){
FileDelete %Log%
}
FileAppend %FilePathToBeConverted%, %Log%
exe := "`"" A_ScriptDIr "\AutoHotKey Exe\AutoHotkeyV2.exe`""
convertahk := " `"" A_ScriptDIr "\v2converter.ahk`" "
command := exe convertahk "`"" FilePathToBeConverted"`""
Run(command)
}
}