AHK v1 v2 ? Which one for a beginner ?

Discuss the future of the AutoHotkey language
newbie007
Posts: 20
Joined: 21 Jan 2022, 06:34

AHK v1 v2 ? Which one for a beginner ?

21 Jan 2022, 06:52

Hello,

I registered today and I want to learn some AHK for future projects but now I saw that a new version is being developed (?)

Which one should I learn as a beginner?

Which is beginner friendly ?

Is v2 out yet or still in development?

If still in development, when will it be released?

What are the major differences?

Will it be like C and C++ ? (Stupid question I know)

Cheers,
some dumb newbie from the moon
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: AHK v1 v2 ? Which one for a beginner ?

21 Jan 2022, 08:00

See a recent discussion on this here.

It’s not really known when v2 will go from beta to official release.

It’s not like C and C++.
newbie007
Posts: 20
Joined: 21 Jan 2022, 06:34

Re: AHK v1 v2 ? Which one for a beginner ?

21 Jan 2022, 08:09

boiler wrote:
21 Jan 2022, 08:00
See a recent discussion on this here.

It’s not really known when v2 will go from beta to official release.

It’s not like C and C++.
Alright, I read the thread.

But the question is now, how different will v1 and v2 be?

So you're saying that beginners should wait for v2 ?
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: AHK v1 v2 ? Which one for a beginner ?

21 Jan 2022, 08:55

It’s largely the same as v1 as far as someone new to AHK is concerned. As I described, it uses only expression syntax, which is the biggest difference. I don’t think other differences wouldn’t be that important to someone new to the either version because they don’t have the history of doing it one way versus the other yet, such as how GUIs are created. You would just be learning one way instead of the other.

I didn’t say beginners should wait for v2. It’s in beta release now, which is stable. Re-read what I said in the other thread.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: AHK v1 v2 ? Which one for a beginner ?

21 Jan 2022, 12:03

v2 is certainly easier for beginners. its got better error reporting(tells u what u did wrong), better tooling(tells u what ure about to do wrong) and more closely resembles modern programming languages(gain transferable skills)
https://marketplace.visualstudio.com/items?itemName=thqby.vscode-autohotkey2-lsp
william_ahk
Posts: 639
Joined: 03 Dec 2018, 20:02

Re: AHK v1 v2 ? Which one for a beginner ?

10 Feb 2022, 00:39

In my opinion v1 is easier and the syntax is simpler, but there exists many pitfalls because of all the historical relics left over the many years. Traditional and modern syntax mixed into a strange concoction that could get you at times. If you just want to jump right into AHK, and you don't know other programming languages, I would suggest you to learn v1 because the learning curve is quite low at the start, then you can transition to v2. If you want to start fresh and avoid all the archaic stuff I would definitely recommend v2.
iseahound
Posts: 1582
Joined: 13 Aug 2016, 21:04
Contact:

Re: AHK v1 v2 ? Which one for a beginner ?

10 Feb 2022, 20:15

I actually discovered that the =% operator is completely identical to := except when the left-hand side contains square brackets or uses dot-notation.

Code: Select all

array =% []
array =% ["a", "b", "c"]
MsgBox % array[1] ", " array[2] ", " array[3]
:dance:
neogna2
Posts: 617
Joined: 15 Sep 2016, 15:44

Re: AHK v1 v2 ? Which one for a beginner ?

11 Feb 2022, 08:17

swagfag wrote:
21 Jan 2022, 12:03
v2 is certainly easier for beginners. its got better error reporting(tells u what u did wrong), better tooling(tells u what ure about to do wrong) and more closely resembles modern programming languages(gain transferable skills)
I'm still converting my old v1 scripts to v2 and I all in all prefer v2. But that's because I already had v1 experience to build on. If someone is completely new (and no experience from other programming languages) I'm not so sure.
- V1 is where most of the existing forum help threads and example code is. It is much harder to get starting without that. Most of the topics in v2 help are either on v1 to v2 issues or more complex stuff that a new user is unlikely to start out with.
- The v2 error reporting is a double edged sword because v2 also throws a lot more errors and forces the user to be more precise in certain use cases. For example v2 WinGetTitle throws if the window is not found. This means the new user needs to use Try, IsSet(), Has() and so on more often whereas they in v1 often can simply check if a value is blank or not. While the v2 features are better in the long run I think each such complication can be a hindrance in the beginning.
- As for tooling setting it up and learning the basics of VS Code is in itself a hurdle. Good in the long run, but if someone is completely new they might want to make a small script with Notepad as a first step.
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: AHK v1 v2 ? Which one for a beginner ?

12 Feb 2022, 16:12

@newbie007

My opinion (which is somewhat similar to william_ahk) is it would be better to use AHK v1, because of so much example code and help. Particularly those that are new to programming or are just casual users, versus those that may already be advanced programmers in other languages.

A lot of trouble for newbies and casuals is often finding simple examples of how to do something needed, and not feeling or made to feel "dumb" about it. A lot of times advanced programmers are just in an entirely different mindset and focus, in terms of what they are doing, versus people that haven't committed or are not so involved in programming yet. I find that a lot of the usage of AHK v2 is much more focused on the interests and needs of advanced programmers. At the point that a person becomes intermediate to advanced in AHK v1, switching over to AHK v2 will be a relatively small jump and minor.

I don't see any need to push or rush over to AHK v2, because AHK v1 works quite well (thanks to the developers). Usually newbies and casuals are not doing anything so advanced that they are immediately pushing the limits of the language. And if that were truly the case, that creates another argument as to why not get tangled up with C++ or other languages. Often the case is people use AHK to make things easier, simpler, or faster (to create something) for themselves. I wouldn't yet recommend to start with AHK v2, until it becomes official and the amount of help, examples, ebooks, videos, and libraries have switched over enough. By the way, shout out to AHK teachers and promoters like Jack Dunning (www.computoredge.com) and Joe Glines (www.the-automator.com). AHK v2 is the inevitable future, but AHK v1 is still the strong champ and doing well in the present.
Franktic
Posts: 14
Joined: 08 Oct 2018, 22:35

Re: AHK v1 v2 ? Which one for a beginner ?

16 Feb 2022, 18:34

My two cents worth: I have used v1 over several years for my personal projects and automating several work tasks. I don't find the syntax easy to follow. It feels like the language has grown over time, changing syntax ideas along the way, while trying to keep backward compatibility. I love the language for its power and ability to achieve so much in the windows space. But the v1 syntax frustrates me. I have started using the AHKEZ plugin and found it to make using v1 much easier. I am comfortable with this path because I know all the v1 examples and tools will continue to work. I am afraid that moving to v2 will cut me off from some of these resources.
Would I suggest using v1 and AHKEZ to a beginner? I'm not sure. Without good document I hesitate. If you already use v1 and would like better syntax I recommend trying AHKEZ (https://github.com/jasc2v8/AHKEZ and viewtopic.php?t=87709). Obviously this is only an opinion and not a direct answer to v1 versus v2 for beginners.
newbie007
Posts: 20
Joined: 21 Jan 2022, 06:34

Re: AHK v1 v2 ? Which one for a beginner ?

17 Feb 2022, 09:00

I will go with v1 first, because I think also like you guys that v1 scripts and helps are much more right now.
But there are small things that get me annoyed like normal variables. I mean why ":=" and not just "=" like all other languages?
I know thats a small thing but still annoying.
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: AHK v1 v2 ? Which one for a beginner ?

17 Feb 2022, 11:55

newbie007 wrote:
17 Feb 2022, 09:00
I mean why ":=" and not just "=" like all other languages?
There are a couple of other languages which use the walrus operator := as an assignment operator (at least under certain conditions), one of them is Python 3.8+ afaik. Not to forget its use in mathematics. In AHK v1, you could still use AHK's "legacy" assigment operator = (but it's not recommended; and it uses a different syntax on its right side), instead of :=. This won't be possible anymore in v2. I think this language clean-up is a good thing.
I like the walrus :ugeek:
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: AHK v1 v2 ? Which one for a beginner ?

17 Feb 2022, 14:29

newbie007 wrote:
17 Feb 2022, 09:00
I mean why ":=" and not just "=" like all other languages?
There are several languages (old and new) that use ":=", besides AutoHotkey. Go, Python, Pascal/Delphi, Ada, ST (PLC programming), PL/SQL, Smalltalk, V, Eiffel, Jai, etc...

It should not be assumed that all languages will have the same syntax, heritage, design, purpose, or culture surrounding them. Particularly, that they will always be near clones of or so similar to C. It's arguably better to be flexible about this. If anything, it's a good thing that you see the "walrus" in AutoHotkey, so that you will be more open-minded about differences in other languages.
newbie007
Posts: 20
Joined: 21 Jan 2022, 06:34

Re: AHK v1 v2 ? Which one for a beginner ?

18 Feb 2022, 01:19

SOTE wrote:
17 Feb 2022, 14:29
newbie007 wrote:
17 Feb 2022, 09:00
I mean why ":=" and not just "=" like all other languages?
It should not be assumed that all languages will have the same syntax, heritage, design, purpose, or culture surrounding them. Particularly, that they will always be near clones of or so similar to C. It's arguably better to be flexible about this. If anything, it's a good thing that you see the "walrus" in AutoHotkey, so that you will be more open-minded about differences in other languages.
True, but C didn't invented the equals sign. It is a mathematical symbol, which is used to indicate equality in some well-defined sense.

For me there is a simple reason, ":=" takes more time than writing "=" :D
But I'm open-minded to different languages and I will learn AHK anyway !!
william_ahk
Posts: 639
Joined: 03 Dec 2018, 20:02

Re: AHK v1 v2 ? Which one for a beginner ?

28 Feb 2022, 23:25

I have to criticize AHK for choosing the ":=" syntax, because now it's so weird for me to not press Shift+; when writing variable assignments in other "=" languages. :lol:

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 16 guests