badbob001 wrote: ↑31 Jan 2023, 09:39
boiler wrote: ↑31 Jan 2023, 09:13
Other than some specific keywords, it’s often not clear what individual lines of code belong to one version vs. the other. It would take some real inattention to what one is doing to end up with a mix of both versions in the same script file.
I think a lot of people just search and copy code samples written by others, so it seems very reasonable for a single collective hotkey file with many different functions to have code that span many years and AHK versions. It would be cool if this forum can detect code versioning in posts and add an obvious v1/v2 label around the code box.
Yeah, people could end up with mixed files if they grab stuff from both versions in their script, but (a) they shouldn't do that (but beginners certainly will), (b) they should test the hotkeys they add to their file (ditto re beginners) and this would probably alert them to errors... in fact, (c) if they just run the file in order to use the hotkeys, they're likely to get error messages, whichever interpreter the Launcher do-dad decides it is. I had a (d) but it's gone. So hopefully that won't be too much of a problem, and if they post it it won't be long before someone spots the problem. Maybe that was (d).
As boiler says, the forum software can't do that cool thing, and if it could it would just have to do something similar to the Launcher do-dad that makes a decision according to some algorithmic assessment of the code, so it will still have to make a v1/v2 binary choice, and the other bits of mixed code will have the wrong syntax highlighting anyway.
I haven't really gone through the documentation properly but I find the AHK syntax confusing. I think my existing experience with many other scripting/programming languages may actually be making it harder.
You and me both. If I was new to AHK, I'd try to do everything in v2. For one thing, v1 has two methods of coding stuff, which is confusing, and v2 dumps the legacy method (and extends and systematizes the "expression" syntax). Secondly, if one tries to accommodate v1 and v2 together, that's just adding another additional confusion - in fact, two, since it adds the v1 syntax confusion (and v2 isn't a simple copy of the expression syntax from v1).
Welcome and good luck!