- I converted all of my main scripts, which run together as one script, around 53000 lines, and got it to run in AHK v2. I haven't moved over yet, because I still need to convert the function libraries. I saved them for later, so I could test my finalised converter script on them.
- I have some interesting things to report back with, but essentially, all the main issues have already been discussed here. There's a modest amount of material to cover, but it'll take me a while to iron it out.
Two main issues I can see with conversion:
- Identifying lines that contain "", that need to be converted to `" or Chr(34) or vDQ. This would require some advanced parsing. Although, """ and """", these can be checked for quite easily.
- A way to list every error in a script, and not one at a time via a MsgBox. Having a list of errors would be a workaround to the point above about double quotes. Perhaps there is already a way to do this, I'll check. Cheers.
- [EDIT:] Re. listing errors, /ErrorStdOut and /iLib are the key.
AutoHotkey Scripts and Macros
https://lexikos.github.io/v2/docs/comma ... StdOut.htm
- [EDIT:] Re. two-way compatibility, the only obstacle has been Loop lines. I don't know if, say, a directive for AHK v1 would be possible, that would make Loop lines act like in AHK v2.
- The other issue is using Chr(34) for double quotes (or \x22 in RegEx), which, though it works to give two-way compatibility, is not ideal.
- Just to be clear, by two-way compatibility, I mean scripts/function libraries that work on both AHK v1.1* and AHK v2 (*AHK v1.1 with the 'AHK v2 functions for AHK v1' library).
- [EDIT:] A general AHK issue has been Deref, there was a Deref function in AHK v2, which is currently not available in AHK v2, that I had hoped would be backported to AHK v1. In AHK v1 the equivalent is Transform's Deref subcommand. I have a subroutine which reads paths from an ini file, and a subroutine which launches paths in the selected text. The subroutines dereference a vast number of known variables defined in the script.
- This is/was useful for debugging because I could select a path containing a variable, and then the script would apply Deref and the folder would open. Deref is awkward because of local/global variable, scope issues, you can't simply create a custom function that replicates it. (I've been able to backport virtually everything else myself using custom functions.)