What has happened to AutoHotkey?!

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
skrommel
Posts: 17
Joined: 15 Sep 2014, 06:15

What has happened to AutoHotkey?!

Post by skrommel » 28 Jan 2023, 20:26

What has happened to AutoHotkey?! :wtf: V2 is a solution looking for a non existing problem.

AutoHotkey, the simple, forgiving, easy to read, easy to code, well documented, powerful, starter language, has morphed into something I would hesitate to introduce to my children. Have the interpreters and compilers gotten dumber over the years, requiring a host of new operators, paranthesis and dot notations? What's next? Format casting and case sensitivity?

I accidentally opened the help file for V2, and I can't begin to guess what the a**h*le emoticon followed by what resembles a nightmarish c pointer arrow is used for.

Code: Select all

main := Gui('+Resize')
main.OnEvent('Close', (*) => (wvc := wv := 0))
main.Show(Format('w{} h{}', A_ScreenWidth * 0.6, A_ScreenHeight * 0.6))
V1 was ripe for a cleanup, but I can't see what V2 will improve for the target audience - the casual user. I fear for the future, and losing the language I've used every day for decades.

Skrommel
Last edited by gregster on 28 Jan 2023, 20:29, edited 1 time in total.
Reason: Topic moved to 'General Discussion'.

gregster
Posts: 8886
Joined: 30 Sep 2013, 06:48

Re: What has happened to AutoHotkey?!

Post by gregster » 28 Jan 2023, 20:45

Tbh, I find your statement exaggerated and misleading.
Anyway, nobody forces you to switch to v2; you can even use both versions side-by-side. After all, v1 is open source, and we will still give support for it.
Have a look at the announcement of v2 as the main release for more details: viewtopic.php?f=24&t=112989

Also, Alpha versions of v2 have been around since at least 9 years on this forum incarnation. Of course, there have been a lot of changes since then in v2, but that period would have left you plenty of time to get involved - at least in the discussions about the new direction. Especially, if you have such strong opinions about language design.

Edited

skrommel
Posts: 17
Joined: 15 Sep 2014, 06:15

Re: What has happened to AutoHotkey?!

Post by skrommel » 29 Jan 2023, 09:15

Take my ramblings as the lazy apprehension of an old man set in his ways, but I think there is something to be said for simplicity.

What set AutoHotkey apart from all other languages I've tried over the years, is simplicity combined with power. No libraries, no definitions, just code and go. Write a line, test it, add another, rinse and repeat. Originally there were few paranthesis, no line ends, no conversion between data types, no case sensitivity, all the things that bug novice users in other languages. And still AutoHotkey has been able to do anything I've thrown at it, with the assistance of the wonderful contributors in the community.

I was surprised to see V2 officially released, it's been years, and I've ignored the reality of it ever happening. I gave up on AutoIt years ago due to the same changes. But now it's here, and progress usually means V1 is left in the dust. Sadly simplicity, readability and new user inclusion is hampered in the process.

A smart interpreter could reduce the need for the V2 language changes. What I want is more of the powerful functions from the forums to be included in the base installation. A smart compiler could include only the needed functions to keep size down.

AutoHotkey is a wonderful project, and with a few changes it has the potential to replace every tool on the pc and web. Include a database, include web browser integration, include a network stack, include a gui builder, include com, accessability, graphics, ocr, speech, and the sky is the limit.

I thank all the contributors, you have eased my work life and continue to enhanced my computer usage every day. I look forward to what is coming.

Skrommel

neogna2
Posts: 586
Joined: 15 Sep 2016, 15:44

Re: What has happened to AutoHotkey?!

Post by neogna2 » 29 Jan 2023, 16:08

@skrommel
I think v2 is all in all much better than v1. Easier in some ways, more difficult in other ways. But still an easy to code, well documented, powerful starter language! I guess you picked a code snippet just as illustration for a more general complaint. But since it is hard to know what other things you dislike I'll comment on that specific snippet.

=> fat-arrow functions are optional, you can do everything with regular functions instead. Kind of like how ternary is optional in v1 and v2 and just shorthand for what can be done with if-else lines.

(*) are parameters for the fat-arrow function and * is a way to discard the parameters, used here because the Close event automatically passes a parameter (cf. v1 gui events automatically sets A_Gui and A_GuiControl) that the snippet creator had no use for, I suppose, so they did (*) => instead of a redundant parameter name (GuiObj) =>
In other words the * here is like params* in a v1 variadic function but instead of putting the inputs into array params you just discard them. See variadic function third paragraph. To stay with your emoticon association think of it as giving all incoming parameters a one way ticket to where the sun doesn't shine ;)

Format() already exists in v1 and is optional in both v1 and v2. The more traditional AHK way of concatenating strings and variables works in both v1 and v2 (see below).

v2 supports using single quotes instead of doublequotes.

If you want to keep things as v1 similar as possible you can go from

Code: Select all

Gui, +Resize
Gui, Show, % "w" A_ScreenWidth * 0.6 " h" A_ScreenHeight * 0.6
return
GuiClose:
wvc := wv := 0
return
to

Code: Select all

G := Gui("+Resize")
G.OnEvent("Close", GuiClose)
G.Show("w" A_ScreenWidth * 0.6 " h" A_ScreenHeight * 0.6)
GuiClose(*) {
global 
wvc := wv := 0
}
Use regular functions (not fat-arrows) and make them global if you want code similar to v1 with labels.

Assigning the Gui object to G is new. But in v1 as soon as a script has two or more Guis you'd already do e.g. Gui, G: and Gui, GuiTwo:

ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: What has happened to AutoHotkey?!

Post by ahketype » 29 Jan 2023, 19:48

I found this thread when I began looking for somewhere to chat about my struggles with the language. I'd normally ask yet another question in the help section, but this feeling I have now is more general. I just began with v2. I am only just trying to work through my first conversion of a script and reading the help files, following the error messages and trying to figure out what's going on.

I was immediately pleased to see the simplified syntax in regards to getting rid of the legacy mode, and I was lucky in having already scripted mostly in expression mode. But I have always struggled with OOP, and tried to avoid as much of that complexity as possible. Functions come less naturally to me than subroutines, and I've always preferred variables to be global by default. So I'm finding things to dislike, too, in the version change.

While I accept the response from @gregster that you can still use v1, it does now feel like that's a dead end at least in future, so I had hoped to switch rather than be forced to later.

I feel the urge to start another search for new languages. I was reminded by @skrommel's post of Gui4Cli, which worked up to Windows XP and I've mourned its loss ever since. It was just the simplest language, yet fairly powerful in creating working UI-based programs. Consider the code examples here: http://gui4cli.com/html/manual/ProgramStructure.htm for instance. No curly braces, hardly a parenthesis or comma, sections delimited by blank lines, and property statements following an object's definition (mostly visible controls).

And Gosubs. You know, I was converting my menu statements, which used to include the label of a subroutine to call when that item is selected, and suddenly, instead of a label, I'm lost in all the technicalities of function objects, what they need to return and how many parameters they should have sent! No doubt there's a way to dump them if they're not needed (they're not required to return anything, but apparently I can't have it return 0 or null), but this is the problem, having to find out the workaround to reduce a complex-and-powerful command back to a simpler version. Why can't the interpreter assume a simple command but check for additional complexity in case it's there?

My search may be fruitless - they usually are. Maybe I'll just give up coding altogether. Or maybe I'll get through this latest setback. I'm into a fairly major project, and it's hard to imagine porting it to something else now. It does feel like a really difficult language to learn, though, and the comprehensive, excellently crafted help files require fairly in-depth knowledge of programming jargon already. On the other hand, there's no denying the help on hand here, or the hard work of the developers.

skrommel
Posts: 17
Joined: 15 Sep 2014, 06:15

Re: What has happened to AutoHotkey?!

Post by skrommel » 30 Jan 2023, 17:22

I'm not giving up on AutoHotkey yet, I've not found anything even resembling a replacement over the years. AutoHotkey's simplicity combined with power is unmatched.

My criticism goes to the general direction the language is taking. Unnecessarily, I might add, and @ahketype echoes this. I posted my first warning decades ago, when a new function, I forget which one, was unnecessarily complicated. I feared for the future, and rightfully so, it seems.

There are easier languages, and more powerful ones, but AutoHotkey strikes just the right balance. Having started with Basic on a ZX Spectrum 40 years ago, and learning dozens of languages over the years, peaking with Visual C++, nothing comes close. I recently learnt Lua and HammerSpoon to cope with a Mac, which has many of the same possibilities as AutoHotkey, but it turned into a dead end. It has too technical a manual, too small a community, bugs, and too few system functions.

Without the community providing and updating functions over the years, AutoHotkey would be useless. A new version could leave many functions deprecated, alienate existing users and confuse newcomers. I hope none of this happens, but the focus should be on simplicity and including more functions in the base installation. I'm capable of learning the new syntax, @neogna2, but I'm afraid I won't be able to convert all the functions I need.

Adoption is key, simplicity is king, and power is a must.

Skrommel

ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: What has happened to AutoHotkey?!

Post by ahketype » 30 Jan 2023, 20:26

I would emphasize my personal preferences, rather than what sounds rather an objective judgement about AHK, skrommel (maybe you didn't mean it that way). I actually have a real bug about curly braces, for example, used in so many languages to the detriment of readability (they take up so many lines, for one thing). I wonder how much my preferences were formed by my early experience of BBC BASIC, which I wrote so much it was like English to me in the end, and I didn't move on to other languages for too long.

I'd also say that a perfect balance between simplicity and power is a bit simplistic, and the value of a language depends on the kind of programming we use it for. I'll use AHK for anything automating my Windows machines, but not try to write a graphics-heavy game with it. Since installing v2, I'm reassessing what's the best language to use for the project I've been working on for two years (off and on) and want to complete. AHK makes a lot of sense for it, but I've never liked the syntax, and put up with it for the other payoffs.

User avatar
Relayer
Posts: 160
Joined: 30 Sep 2013, 13:09
Location: Delaware, USA

Re: What has happened to AutoHotkey?!

Post by Relayer » 02 Feb 2023, 10:58

Hi,

For what it's worth I remember how I felt when I was using AutoHotkey v1.00 (before AutoHotkey_L) and knew I should broaden my horizons and move to _L. Lots of anxiety! Looking back, the improvements in _L are PHENOMENAL and have enabled me to learn and do so much more. I am now feeling the same anxiety about V2 but keep reminding myself of the benefits afforded by making the switch to _L.

Having said that, the difference regarding my previous switch is that it did not include the need to rewrite 10 years+ of personal libraries that I rely on every day. Even moving a simple script over to V2 soon opens a can-O-worms as each library file is encountered... often to multiple levels. In retrospect I have created a super hierarchical library approach that makes new scripts a breeze to create. My plan is to stick with _L when I need something quick but move to V2 when I have time to "rebuild" my personal library to be V2 compatible. If nothing else, the reward will be eliminating a lot of dead library files that are no longer needed/useful.

I have nothing but respect for Lexikos and the labor he has sunk into _L and V2. I owe it to him to at least paddle in the direction he points.

Relayer

guest3456
Posts: 3453
Joined: 09 Oct 2013, 10:31

Re: What has happened to AutoHotkey?!

Post by guest3456 » 03 Feb 2023, 15:14

i agree that fat arrows anon funcs should be removed from any examples in the documentation


malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: What has happened to AutoHotkey?!

Post by malcev » 04 Feb 2023, 02:45

Why? It does not change anything.
I think autohotkey with version 2 becomes more difficult than v1 for novice that does not know programming at all.
From my own experience:
For example, I want to create window with button in it.
In ahk v1 I read simple text commands in manual that do what I want +- all clear.
In ahk v2 I see:
Gui Object
class Gui extends Object
But I dont know what is it object and class, I even dont understand what is it function and dont want to know it.
I just want to create window with button.

william_ahk
Posts: 470
Joined: 03 Dec 2018, 20:02

Re: What has happened to AutoHotkey?!

Post by william_ahk » 04 Feb 2023, 04:20

Well said. As a young person I share your sentiments as well. I love v2 for writing software but not for writing hotkeys. Tbh, using it for hotkeys now is a bit tedious. It's becoming Javascript with verbose syntax and unreadable error exceptions, which is completely unnecessary when you just want to automate things for yourself that are enough to just run on your own machine.
Also for the future prospects of programming, natural language is becoming the mainstream with things like GPT. Simpler syntax is definitely the way to go. I also think that the syntax need not to be standardized, having irregularities from place to place is perfectly fine. It should focus on being a hotkey automation tool, not yet another c-like programming language.

User avatar
Chunjee
Posts: 1397
Joined: 18 Apr 2014, 19:05
Contact:

Re: What has happened to AutoHotkey?!

Post by Chunjee » 04 Feb 2023, 15:45

skrommel wrote:
28 Jan 2023, 20:26
I fear for the future, and losing the language I've used every day for decades.
Don't be scared. v1 won't be deleted.

If there is some distant future where it doesn't work on Windows 14+
I have no doubt the available source code could be updated.

Skrommel

ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: What has happened to AutoHotkey?!

Post by ahketype » 04 Feb 2023, 17:53

@Chunjee , I was just thinking the same myself! The announcement did seem to suggest v1 was on borrowed time, but it isn't (it's open source, after all!). I'm glad, because my research into other languages has been depressing, and I haven't got the mental bandwidth to deal with the transition to v2.

What's depressing about my search is that so many languages have gone down the rabbit hole of safer syntax over ease of scripting, which has its benefits, but nudges things increasingly towards the professional programmer, or the very dedicated amateur. I also think it's unhelpful, putting the responsibility more and more on the interpreter or compiler to spot mistakes for us.

I do think a lot has been improved in AHK v2, apparently without getting too hierarchical. The old Command, OutputVar, InputVar... at random points among the functions was confusing, as were the two modes of assignment and referencing (although if you just stick to the sensible one, expressions, it works fine). Changes like that have also made things simpler, like If-statement conditions not needing parentheses. But some things are more complicated, like a menu item's event descriptor no longer being able to point to a label, but a function (or is it a function object? - I have no idea what the difference is!).

When I think of one of my biggest bug-bears about the increasing reliance on functions, it's not because they've been turned into functions, it's because of something much more fundamental about the language - the blocks - which functions require and subs didn't, they had a specific end: return. I much prefer languages to end blocks specifically (if - else - endif ; for - next) because it makes the nesting much clearer than a set of closed braces with no direct indication of their meaning. If we try to avoid those long diagonal sets at the end of nested blocks, we just end up sending flow control to functions within the code instead, which can be even more confusing to follow.

Imagine how awful Windows 14 will be. :lol:

User avatar
boiler
Posts: 16705
Joined: 21 Dec 2014, 02:44

Re: What has happened to AutoHotkey?!

Post by boiler » 04 Feb 2023, 23:29

ahketype wrote: The announcement did seem to suggest v1 was on borrowed time, but it isn't (it's open source, after all!).
:?: :?: :?:
AutoHotkey v2 Official Release Announcement wrote:Status and future of v1
  • The official release of v2 does not mean that v1 is being removed from the site. As always, the past versions are available to be downloaded and designated v1 forum areas will be available, includng "Ask for Help" and "Scripts and Functions."
  • Your current v1 scripts will continue to work even with v2 installed, as described above regarding the Launcher app.
  • No new features will be implemented in v1, although those contributing code changes via "pull requests" may be evaluated and implemented, but on a lower priority.
  • Anyone wishing to fork a version of v1 to continue its development is welcome to do so, as all versions of AHK continue to be open source.

ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: What has happened to AutoHotkey?!

Post by ahketype » 05 Feb 2023, 07:02

boiler wrote:
04 Feb 2023, 23:29
ahketype wrote: The announcement did seem to suggest v1 was on borrowed time, but it isn't (it's open source, after all!).
:?: :?: :?:
AutoHotkey v2 Official Release Announcement wrote:Status and future of v1
  • The official release of v2 does not mean that v1 is being removed from the site. As always, the past versions are available to be downloaded and designated v1 forum areas will be available, includng "Ask for Help" and "Scripts and Functions."
  • Your current v1 scripts will continue to work even with v2 installed, as described above regarding the Launcher app.
  • No new features will be implemented in v1, although those contributing code changes via "pull requests" may be evaluated and implemented, but on a lower priority.
  • Anyone wishing to fork a version of v1 to continue its development is welcome to do so, as all versions of AHK continue to be open source.
Yes, that looks better than I remember on first reading. But the bit about no new features I also thought of as not responding to any future changes in dependencies, Windows updates, etc. And I am looking toward the relatively distant future with my software, so at first it seemed like it would be stupid not to switch and have to deal with a mass of code that had to be converted later.

User avatar
lmstearn
Posts: 681
Joined: 11 Aug 2016, 02:32
Contact:

Re: What has happened to AutoHotkey?!

Post by lmstearn » 05 Feb 2023, 08:38

Looking at the changes, v2 looks to be the better model, and looking forward to trying out the new functions.
I personally lamented the passing of the old SetFormat, it was arguably easier to use and read compared to the new.
To a lesser extent, labels, and g-labels, which seemed to help a little in script organisation and readability.
Moving on, even if a complete v1-v2 conversion utility is not possible, efforts to-date will make the job a lot easier. :)
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH

ahkrpa
Posts: 17
Joined: 16 Apr 2019, 17:34

Re: What has happened to AutoHotkey?!

Post by ahkrpa » 15 Feb 2023, 11:34

IMHO it was a mistake to throw the procedural gosub baby out with the object oriented bathwater. I expect that over time folks will ask that this reliable and straightforward method be "returned" in V2. Amen to the other refinements.
Last edited by ahkrpa on 21 Mar 2023, 10:51, edited 1 time in total.

StefOnSteroids
Posts: 77
Joined: 08 Aug 2015, 10:22

Re: What has happened to AutoHotkey?!

Post by StefOnSteroids » 09 Mar 2023, 02:52

I fully agree with everything Skrommel said.
It's daunting to even look at the new code.

At first, I thought I might get used to it. Reading the help file was the first downer. Way over my head, too many concepts I found arcane and requiring in-depth programming knowledge. Many examples sent me clicking all over the place, trying to grasp the workings of fat arrows and dot-separated methods and asterisks and &Variables.

Then I began converting some of my scripts with the script converter — which did not work at all. The forum was very helpful and it did get me started indeed. But when trying to make modifications to the code I had been spoon-fed, I threw my hands up in despair. Utterly frustrating.

To correctly match all pairs of nested braces and parentheses and the mix of single and double quotes AND to always put the right amount of empty spaces at the right place ... — I guess it requires a dedicated code editor to keep track of all that. With v1, I could tweak my code on the fly, on any machine, not even a mono-spaced font was necessary. A missing space here or there did not matter.

Labels and Return and GoTo maybe frowned upon by serious programmers. They work nicely for me. I find my way around with them. A no-brainer, no grammar to study.

With v1, I was able to "type" a popup menu into existence, like an ordinary sentence, a comma-separated list. Now my fingers must leave the home row to reach for curly braces, which are outrageously hard to get on non-English keyboards (AltGr key). Sure, easy enough to remap them. And to remember the remapping (that I don't need anywhere else). But why? Why all this extra work, the code editors and complicated syntax?

As much as I appreciate the work of all who contributed to this giant effort, I think it widens the gap. Between those, who aspire to become real programmers of yet another "real" programming language, and casual users like me, who feel left out by this development.

User avatar
cyruz
Posts: 345
Joined: 30 Sep 2013, 13:31

Re: What has happened to AutoHotkey?!

Post by cyruz » 17 Mar 2023, 11:45

I kind of agree. I’m all for it to be honest, because I have a Computer Science background, but it is evident that the code being created and shared in the past years is more complex.

This is what reconciled me with my programming passion, but I can understand that for the casual programmer, understanding the code produced by the most advanced users is a challenge. The problem is that with the current implementation and syntax the possibilities are endless and all of us seem to be quite fond of overcomplicating our code.

I think this process has been slow, probably we didn’t realize it, although i’m not sure if this was in lexikos plans or not, but we are now at a point where AHK is no more as easy to approach like before.
ABCza on the old forum.
My GitHub.

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: What has happened to AutoHotkey?!

Post by mikeyww » 19 Mar 2023, 09:19

I will add my two cents.

I identify with malcev's comments: just want something fast and simple, maybe don't want to have to learn what a class really is. My first glance at the v2 changelog overwhelmed me, and I thought I could never learn v2. I was also stunned at the elimination of my trusty staple, Gosub. I thought that v2 might be over my head.

I then started doing some coding in v2. It was slow and painful for a little while. The more I did, however, the faster it went, and the easier it was. Writing code became faster in v2 as compared to v1, and so did reading v2 scripts. Not having to deal with forced expressions constantly was a big bonus. Eliminating the notion of the output variable as a command parameter made the coding simpler and more intuitive. Eliminating my trusty Gosub just meant that I had to use a function and pay attention the scope; it was easy, considering how AHK handles scope of variables. For many uses of AHK v2, using it does require knowing how functions work, and understanding the basics of objects, so there is some learning there for the novice programmer. As lexikos asserted that the Gosub was redundant with functions, I found that I had no argument to that.

The AHK documentation is terrific. It also has some big shortcomings and needs improvements, clarifications, and far more examples. Some of the method and property descriptions lack examples or lack examples of common usage, and this should be rectified. Malcev's main point could be addressed through a few key improvements to the documentation about objects and GUIs, and probably a better introduction to objects and how they work. It is perhaps generic, but a short primer would go a long way.

I look at v2 as a product of v1's success. The community showed that v1 probably ended up doing a lot more than anyone expected at the dawn of AHK. V1 outgrew its own capacity to handle what became more common but also more "advanced" functionality. The things that many wanted to do in v1 became cumbersome, time-consuming, confusing, and prone to coding errors. I view v2 as resetting the balance between the simple and the complex, providing a more viable pathway for these to coexist.

In response to requests to include more functions into AHK, lexikos has posted some discussion about why this has not been done. I think the gist of it was that AHK would have the approach of providing all of the basic building blocks, while users could then assemble the blocks to achieve the functionality that they wanted. I guess that's just a judgment call about what is fundamental vs. what is built from fundamentals. I do find that certain added functionality in AHK would be very handy! What about changing the screen brightness, getting an image size, setting the mouse speed, sending e-mail, closing another script, managing my printer or speakers, getting an IP address, and checking the CPU load or the battery? I guess the point is that there is no end to these things. Perhaps another point is that if the operating system changes substantially, having all of those things could also quickly break AHK or require it to change, to an extent that may be too great, too difficult, or too frequent.

As for braces alone as a thing, I like the brace for its simplicity and consistency with other syntax. It's true that distinguishing an EndIf from an EndLoop may require a bit more energy. On the other hand, neither a brace nor an EndIf ensures clarity in coding, so that goal is always present for the coder to achieve, through indentation, blocks, comments, other approaches to layout & flow, etc.

The practical reality is that AHK is not only used by volunteers, but mostly provided (developed) by volunteers, too. Thus, it has to meet not only the requirements of the users, but the limitations of the developers-- limitations of their time and efforts. The work required for maintaining the code has to be realistic. Although I am not a developer, I appreciate the challenges and am satisfied with the results!

Post Reply

Return to “General Discussion”