Page 1 of 1

A better converter for migrating from V1 please

Posted: 19 Mar 2024, 04:13
by Textdoktorn
Hi,

I've had two frustrating working days of trying to make my fully functional (and not too complicated but large) V1 script work after using the built-in V1 to V2 conversion tool. There were a great many errors when compiling, and when I had finally managed to reload the converted script without error messages, the hotkeys didn't work and generated lots of new error messages, such as

Expected a String but got a Func
Duplicate key
Bad syntax
This line does not contain a recognized action
This variable has not been assigned a value
etc. etc. etc.

Especially the HotifWinactive command caused me a lot of problems, although my IfWinActive commands worked fine in V1.

I hope there will be a more useful converter in place before it's time to ditch V1.

Re: A better converter for migrating from V1 please

Posted: 19 Mar 2024, 04:30
by boiler
Textdoktorn wrote: …after using the built-in V1 to V2 conversion tool.
What built-in v1-to-v2 conversion tool?

Textdoktorn wrote: Especially the HotifWinactive command caused me a lot of problems, although my IfWinActive commands worked fine in V1.
HotIfWinactive (v2) affects hotkeys. IfWinActive (v1) has nothing to do with hotkeys. If you mean v1’s directive #IfWinActive, then in v2, you would use #HotIf with WinActive to do the same.

Re: A better converter for migrating from V1 please

Posted: 28 Mar 2024, 01:55
by MC256
I think Textdoktorn is referring to this fairly comprehensive and impressive effort: https://github.com/mmikeww/AHK-v2-script-converter
I'm sorry to say that this is probably the best you're going to get. We might be able to do something more structural with the LSPs that were developed for VSCode, but that's a big lift too.

FWIW, if you're subscribed to ChatGPT, I created a Custom GPT that has access to all of the AHK1 docs, AHK2 docs, the source code to AHK-v2-script-converter, and its unit tests. Plus I gave it some extra guidance on V1->V2. At this point the GPT is pretty smart about conversions. If it gets off track, just point it out and ask it to re-consult its knowledge files. It typically gets back on track after that. => https://chat.openai.com/g/g-3OSTIgi6X-autohotkey-expert

Re: A better converter for migrating from V1 please

Posted: 30 Mar 2024, 12:18
by Animan8000
There's no "built-in converter". Only finished scripts made by other people. These converters are okay for the most part, but limitations will apply. The v2 documentation is likely still the best reference, to figure the differences out.

Re: A better converter for migrating from V1 please

Posted: 17 Apr 2024, 09:24
by xMaxrayx
why just use the old scripts without converting? It's just better create from ground up rather than conversion because you don't need to deal with bugs.