22 ms·
AutoHotkey v2 Official Release Announcement
- deafpolygon 4y agoWhat changes and benefits, besides removing the dual syntax, does V2 bring? It's not clear by the announcement post.
- majkinetor 4y agoAutohotkey is awesome and special, and everybody on Windows should learn it. There is no such thing on any other OS. v2 syntax and features are so much better. It was basically in development for a decade and AHK itself more then 20 years.
- NaOH 4y ago> There is no such thing on any other OS. I thought the Mac comparable was Keyboard Maestro. Are the two that different (asks someone who hasn't used Windows since the '90s)? https://www.keyboardmaestro.com https://www.keyboardmaestro.com
- hu3 4y agoMaestro is more like a Macro Recorder while AutoHotkey is a programming language for automation. Also AHK community is huge.
- doogerdog 4y agoKeyboard Maestro is not just a Macro Recorder. It can control most of the Mac interface and most applications. You can start using it as a recorder but when you learn to to incorporate applescripts and other tricks, it can manipulate the entire Mac experience. I would be lost without it.
- trippsydrippsy 4y ago[dead]
- saghm 4y ago> AutoHotkey is a programming language for automation That's sort of what AppleScript is supposed to be on MacOS I thought? I'm not familiar enough with either AutoHotKey or AppleScript to be able to compare them though
- duskwuff 4y agoAnother utility along those lines for macOS is Hammerspoon: https://www.hammerspoon.org/ https://www.hammerspoon.org/
- Fnoord 4y agoI use Karabiner Elements and Hammerspoon. Hammerspoon scripts are written in LUA, Karabiner Elements has a large repository of useful scripts. On Linux I use Wayland but there are several ways to tackle that, involving /dev/uinput. For example there's Python bindings for that and several Rust apps to achieve it. In the end I use ydotool and kbct. On Android I use MacroDroid. You can also do some neat stuff with Selenium.
- reegnz 4y agoOn mac I use goku[1] to define custom key bindings for karabiner elements. The ux feels much better than autohotkey, and I wish I had something similar on linux or windows. [1]https://github.com/yqrashawn/GokuRakuJoudo https://github.com/yqrashawn/GokuRakuJoudo
- olig15 4y agomacOS has AppleScript that does the same thing, and it’s built into the OS. https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html https://developer.apple.com/library/archive/documentation/Ap...
- xnyan 4y agoApppleScript was an amazing foundational part of what made the Mac so great, but unfortunately Sal Soghoian was pushed out of Apple, the Mac automation team ended, and the new future of Mac automation is an iOS application. It’s by no means dead, but it’s absolutely a zombie at this point, shuffling along until Apple inevitably depreciates it out of it’s usefulness. I actually think AHK has the better model here. It takes low level windows functions and presents them in a fairly simple and low friction way. MS could never end AHK without also breaking an unfathomable number of other applications.
- MikusR 4y agoAnd Windows had https://en.wikipedia.org/wiki/Windows_Script_Host https://en.wikipedia.org/wiki/Windows_Script_Host
- lenkite 4y agoLooks like a feature that is obsolete and in the process of being phased out, considering that documentation for it has been archived.
- eviks 4y ago> does the same thing So how to you create custom keyboard shortcuts with it?
- davidandgoliath 4y agoAutokey on Linux?
- majkinetor 4y agoThere is no such thing, at least in the mainstream. There are surogates, more or less capable, however nothing close to AHK 1. xdotool 2. sikuli 3. AHK_X11
- TheSpiceIsLife 4y agoYou that read wrong https://github.com/autokey/autokey https://github.com/autokey/autokey
- majkinetor 4y agoAHK is way more mature then autokey has huge community and big amount of ready to use scripts and autoamtion libraries.
- viggity 4y agoAHK allows me to program my own eclectic mashup of emacs and vim and put it in every single app on my windows machine including VS, VS Code, Chrome, Word, outlook, everything! My brain is broken without it, it is a godsend. For the curious, like emacs, my "command mode" is whether or not I'm holding the alt key. Like vim, my command mode navigation is based on the relative positions of different keys. I know that vim uses jkl; for the arrows. I think it is easier to use "ijkl" in much the same way you would use "wasd". But based on position, home, end, page up, page down are included as well as delete. My hands never leave the home row. Technically "alt+j" will map to "ctrl+left" so that it moves my cursor an entire word and not a single character. quick and dirty annotated map. https://drive.google.com/file/d/1VWXMoh2pN7WrwC5Y2p0BNoYGOztYJ6kY/view?usp=sharing https://drive.google.com/file/d/1VWXMoh2pN7WrwC5Y2p0BNoYGOzt...
- bradrn 4y ago> I know that vim uses jkl; for the arrows. No, it uses hjkl. But of course the spirit of Vim and Emacs is that you can customise these things. Incidentally, I have quite a similar ‘Vim everywhere’ map, though I use CapsLock rather than Alt to change modes.
- dharmaturtle 4y agoHah, are you me? > Alt/Capslock + IJKL is a universal way to get arrowkeys https://news.ycombinator.com/item?id=29162132 https://news.ycombinator.com/item?id=29162132 I have similar keys to yours, but U and O are left/right four times, and 8 and , are up/down four times. Could make it more, I just know that 3 is to small. I also use ahk as my window manager, which is essential for working on a 4k 100% scale screen: https://www.autohotkey.com/board/topic/79338-simple-window-positionsize-manager-similar-to-win-7-snap/ https://www.autohotkey.com/board/topic/79338-simple-window-p... I also also have a hotkey for nearly every program I use on a daily basis. Win 0-9 are used of course, but Caps+F1-F12 are also used, and I've recently added Insert+letter keys to my collection thanks to my new fancy QMK keyboard. My goal is to never alt tab again :) I also also also have an emacs/whichkey kinda thing, which does exactly what you think: CapsLock & E::WhichKeyMenu() WhichKeyMenu() { CoordMode, Menu, Screen Menu, WhichKeyMenu, Add, &C Code, Code Menu, WhichKeyMenu, Add, &D Desktop, Desktop Menu, WhichKeyMenu, Show, % A_ScreenWidth/2, % A_ScreenHeight/2 return Code: run, explorer.exe C:\code return Desktop: run, explorer.exe C:\Users\dharm\Desktop return } This is, of course, extensible to any AHK command, not just running explorer. Also means I don't have to memorize every goddamn shortcut. Only weird thing is that I have to exit out of it with Alt. Escape doesn't work and I dunno why.
- procarch2019 4y agoIt is great. I honestly used to use it to automate pieces of work in a software that had terrible bulk tools, but now that I’m more on the management side I heavily use it to substitute words/acronyms. I have it expand all my acronyms for docs. If I put metrics on it I’m assuming it’s most heavy lift for me is fixing MS autocorrect for VLAN and IT. Unfortunately (or fortunately) I ended up getting into other scripting tools/languages to figure out how to work around certain programming environments.
- albert_e 4y agoIf anyone has combined the power of AHK with a physical device like a StreamDeck it would be great to see examples. In general too is there a gallery of great AHK use cases that we can emulate or get inspiration from?
- nirav72 4y agoI recently got a streamdeck and followed this thread to get some AHK scripts mapped to SD buttons. https://www.autohotkey.com/boards/viewtopic.php?t=53318 https://www.autohotkey.com/boards/viewtopic.php?t=53318 Also found several resources on github. Will dig up the links when I get a chance.
- ddtaylor 4y agoThe scripting language for version 1 was pretty terrible but having messed with version 2 for a while now I'd say it's pretty decent.
- RheingoldRiver 4y agoI have a not-too-long list of keybinds that's currently on v1. Would you mind taking a look and letting me know if anything's not v2 compatible? [0] I don't think anything is that complicated, there's a loop or two although tbh those were more one-time-use things I haven't bothered to get rid of, in part so I have the syntax there as a reference in case I need it again. I do remember reading something about SetTitleMatchMode being deprecated though, but I'm not sure if that includes RegEx. [0] https://github.com/RheingoldRiver/misc_settings/blob/master/keybinds.ahk https://github.com/RheingoldRiver/misc_settings/blob/master/...
- ddtaylor 4y agoI'm not an expert, but these are basically the changes I would see that need to happen: All of the places where you use commands no longer need a preceding comma: Run, Calc.exe This is now just: Run "Calc.exe" Similarly, all areas where you use strings now need to be quoted: Send, https://discord.gg/6SNQ4c6 Will now have to be: Send "https://discord.gg/6SNQ4c6" AFAIK the area where you use "blocks" of code like this: ^!+x:: ... stuff ... Will now have to be enclosed in curly braces: ^!+x:: { ... stuff ... } Where you use special constant/strings for the "Send" command now needs to use regular strings: Send "+{Tab}+{Tab} {Space} {Esc}" Where you do an "if" condition like this: IfWinNotExist ahk_class MozillaWindowClass return Will have to turn into something like: if (not WinExist("ahk_class MozillaWindowClass")) { return } A full list of the differences is available at https://www.autohotkey.com/docs/v2/v2-changes.htm https://www.autohotkey.com/docs/v2/v2-changes.htm
- RheingoldRiver 4y agooh wow, that's a pretty comprehensive set of changes, thanks for the reply! I'll procrastinate on this a bit then, it looks like it'll be closer to an hour than five minutes, although not too bad simply because it's not that big a file.
- PurpleRamen 4y agoFunny, just yesterday I was working on automating my linux-desktop, and for specific capabilities, I only found solutions for AHK on Windows, not the normal tooling on Linux. And it seems the limitation of capabilities are for security reasons, like for example, the inability to send Keyboard-inputs to an unfocused window. How is this with Windows and AHK? Has Microsoft also shutting down abilities and crippling AHK in the last years? Or how is something like AHK still working find and powerful after such a long time?
- bsnnkv 4y agoI ended up using AHK for komorebi[1] because I was still new to Windows when I started writing it and I didn't wanna have to write a tiling window manager AND a hotkey daemon. I even ended up generating a nice little AHK library to wrap around CLI commands that sent socket messages to the window manager to make it easier to write a configuration. Ultimately the syntax changes make it impossible to fully reproduce the same library for AHKv2, which is being installed by default on all mainstream package managers now. I ended up biting the bullet and making my own hotkey daemon[2] for use with komorebi based on skhd[3] and I haven't looked back since. This will be the "blessed" hotkey daemon recommended for use in the next release of komorebi. I'm still using AHK (v1) for the stuff that it's good at (and there is a lot of stuff that it's good at!), but ultimately I've found that it's not the right tool as a hotkey daemon for a socket-based tiling window manager (or just generally, for triggering CLI commands). [1]: https://github.com/LGUG2Z/komorebi https://github.com/LGUG2Z/komorebi [2]: https://github.com/LGUG2Z/whkd https://github.com/LGUG2Z/whkd [3]: https://github.com/koekeishiya/skhd https://github.com/koekeishiya/skhd
- maximus-decimus 4y agoCan't you just right click on you script and pick "compile" or something similar to pack the v1 interpreter with your code? I remember a functionality like that existing.
- bsnnkv 4y agoI don't think it's quite that simple with this use case[1][2], but I'm happy to be proven wrong! [1]: https://github.com/LGUG2Z/komorebi/blob/master/derive-ahk/src/lib.rs https://github.com/LGUG2Z/komorebi/blob/master/derive-ahk/sr... [2]: https://github.com/LGUG2Z/komorebi/blob/master/komorebic.lib.ahk https://github.com/LGUG2Z/komorebi/blob/master/komorebic.lib...
- pletnes 4y agoI just downloaded v2, purely by incident (haven’t used AHK for some time) but there is now official support for compile-to-exe. No idea how good it is, I’ve only used AHK for one-offs, short term projects, etc.
- hackernudes 4y agoI recently updated my scripts to work with ahkv2. https://github.com/EBADBEEF/ahkv2-scripts https://github.com/EBADBEEF/ahkv2-scripts Some things I'm proud of here: - easy debug console (https://github.com/EBADBEEF/ahkv2-scripts/blob/main/Autostart.ahk#L4) - compose keys (to type keys like "¿ é ü" easily). Includes libX11 key database parser - window move and resize with mouse I love AutoHotkey's documentation. It is an old school windows help file (chm) and it works really well. All my scripts run in an AutoHotKey process that takes less than 2MB of ram and provide great value to me.
- mastazi 4y agoI love Autohotkey because, in addition to its productivity benefits, it's a defensive tool against dark patterns imposed by user-hostile companies. For example, I've been using it for years to enter my Runescape password [1] due to Jagex being clueless about security [2] [1] https://reddit.com/r/runescape/comments/gxapao/how_to_paste_to_the_password_box/ https://reddit.com/r/runescape/comments/gxapao/how_to_paste_... [2] https://www.troyhunt.com/the-cobra-effect-that-is-disabling/ https://www.troyhunt.com/the-cobra-effect-that-is-disabling/
- thegeekpirate 4y agoRunelite (https://runelite.net https://runelite.net) enables you to do so, fwiw.
- mastazi 4y agoIs this a recent improvement? I'm pretty sure I had Runelite back when I came up with the AHK script, two or three years ago. Or maybe the issue came up while I was playing RS3? It's been a while so I don't remember the details!
- thegeekpirate 4y agoNope, but you do have to enable it in the settings last I checked. Not certain about RS3.
- mastazi 4y agoAh I see, good to know! Thank you for that. I searched the web and apparently it's part of the "Login Screen" plugin https://runelite.net/blog/show/2018-11-22-1.5.1-Release/ https://runelite.net/blog/show/2018-11-22-1.5.1-Release/
- cheeze 4y agoMy favorite use case for it is a hotkey to autofill my username and password for Zwift. Zwift is a cycling app that I'm only interacting with while I'm sitting on my bicycle (on a trainer indoor) I have 0 patience for entering a password... I'm sitting there in spandex with a fan blowing in my face and I'm holding a wireless keyboard. Anything more than Ctrl+Alt+1 is too mcuh work
- mmmpetrichor 4y agoI saw there's a python library that just lets you write autohotkey scripts in actual python code. I'd rather try that if I was going to rewrite my v1 scripts. AHK is awesome but the scripting language was never good. The new one looks like it has some better syntax, but native python support would be a much better solution for a lot of people.
- seligman99 4y agoI wrote MicroKeys[1] out of a similar frustration. Granted, I never got past the POC stage, so it's not as feature rich as AHK, but it solved a very specific itch I had. I debate if I should flesh it out further, or try using AHK again. [1] https://github.com/seligman/microkeys https://github.com/seligman/microkeys
- fragmede 4y agoWhy? The AHK python library isn't going to be so cleanly abstracted so that a different automation engine (eg hammerspoon w/ lua on macOS) can be plugged in, so the code is always going up be tightly coupled to AHK, and Python support is likely to be second-class to support for its own language. So other than some obsessive need to standardize on a single language which will never be won, what does Python buy?
- aabhay 4y agoSyntax
- spookie 4y agoI really don't see how AHK's script language is somehow not intuitive or simple enough. The syntax is pretty easy to grasp. You have all the tools "natively" to even pick positions on windows, its pretty extensive too.
- mmmpetrichor 4y agoI write AHK scripts like once or twice and then forget about it. I can't remember the sytax so I'm constantly googling. I'd rather have it in a language I already know well. Also as a long time programmer who knows a lot of languages, the AHK syntax (at least in V1) was anything but intuitive. It had very weird conventions.
- pupppet 4y agoWhen I switched to a Mac, AutoHotkey is what I missed the most. My muscle memory still wants me to middle-click in a Finder window.
- kstrauser 4y agoKeyboard Maestro is your friend here.
- denolfe 4y agoAutoHotkey was a lifesaver for me when I used to work on Windows. Universal CapsLock VIM movement keys, app-specific shortcuts, clipboard manipulation, text expansion, autocorrect. It really is an amazing tool. For mac, I've been able to cobble together a mix of karabiner, phoenix, and espanso to do all of what just AutoHotkey could do. Coincidentally, my AHK config was my first open source repo on GitHub. I'm glad to see it moving forward.
- nylonstrung 4y agoAs someone who has always been 'AHK-curious' but never got around to using it, ChatGPT has been an amazing at helping me write scripts and custom hotkeys The productivity gains are very real
- fancymcpoopoo 4y ago[flagged]
- rrrrrrrrrrrryan 4y agoThanks for this idea. My main frustration with auto hotkey has always been that I only need to use it once in a long while - just infrequently enough that I forget what I've learned and eternally suck at it.
- wizerno 4y agoWhat are some use cases where having AHK scripts would help? On the same note, can anyone share some existing list of scripts and their functions which helped make their lives easier?
- bobsmooth 4y agoI had to type an incrementing number over an over. I wrote a scrip so that one key would type a variable and then increment it and another key to decrement if I messed up. Saved me a lot of time.
- fancymcpoopoo 4y agoI like to prefix files with a YYMMDD date, so I made a script to do that when I press a hot key, and also send a text to my wife to bring me a cup of coffee.
- hibbelig 4y agoSo on days with more files you drink more coffee? For me personally the files pretty fast would be the limit, else I get really jittery…
- bucks14 4y agoDo you mind sharing that?
- jweather 4y agoBind Windows-B to type the date in the form 2023-01-30: #B:: Send %A_YYYY%-%A_MM%-%A_DD% return
- sjrd 4y agoI have a laptop whose keyboard is physically a QWERTY, but I configured to use (the Belgian variant of) AZERTY. There is one physical key missing on QWERTY compared to AZERTY, so there are 3 characters I cannot type normally, and not rare ones: < > \ I created an AHK script that binds other, convenient key combinations to those characters. Now I can type them.
- Lapsa 4y agolong time ago I used this thing to build a bot in whatnot mmorpg. may not have been pretty code but the important thing is - it was functional.
- kbrosnan 4y agoAHK brings back memories. The campus I was working at had the dorm network saturated by Sasser and variants. Networking turned off the dorm network. I used AHK to automate Windows patch installers, installing Norton Corporate AV and grabbing the MAC address to disinfect Sasser from dorm computers. Over the course of a weekend or two everyone in the dorm had to have the hotfix & AV installed or show us their MacOS or Linux box and provide the MAC address to get back on the network.
- notpushkin 4y ago[2013]
- mkl 4y agoNo, the author is "joedf Posts: 8656 Joined: 29 Sep 2013", this post is "22 Jan 2023, 11:52".
- notpushkin 4y agoOh! I'm starting to forget these old forum designs I guess.
- BrandoElFollito 4y agoOne great use of AHK for me was the remapping of the keypad when it is not in number mode. I have all my important shortcuts there: Bitwarden password fill-in, starting Logseq for notes, a launcher for programs, ... It is really a time saver.
- boredhedgehog 4y agoAh yes, the world absolutely needed another experiment whether idealized syntactic purity is more important than a 20+ years library of working code.
- trojan13 4y agoI always preferred AutoIt over AutoHotkey. There is something with syntax of AutoHotkey I can stand.
- majkinetor 4y agoAutoiIt community is hostile. It is also way slower, larger, hungrier. Now it has worst syntax too.
- TravHatesMe 4y agoHostile, really? I was around the forums a decade ago and it was a wonderful place.
- majkinetor 4y agoYeah, its not hard to find that info all around. Maybe you were lucky. More importantly its considerably larger and slower.
- TigerTeamX 4y agoI have many fond memories of making bots for games. Like fishing in World of Warcraft. I haven't used it for like 5 years, but I should check it out again - maybe not for games this time but maybe for auto-posting on Social Media for my company
- criddell 4y agoI use AutoHotkey every day but find it’s not very reliable. I have one script that checks if the current window is File Explorer and if it is, gets the currently selected file or directory and does something with that. If I have more than one tab open, it will usually (but not always) give me the selected item from a different tab. Reloading the script fixes the issue sometimes.
- staindk 4y agoIt looks like Explorer tabs are a very recent addition to W11, so perhaps it isn't fully supported by AH1? Unless by 'tabs' you mean 'instances' or 'windows'?
- criddell 4y agoIt works sometimes and when it doesn’t, reloading the script will sometimes fix the problem. I just asked ChatGPT how to get the currently selected file in the current tab of File Explorer in AutoHotkey and it spit out code that works quite a bit differently than mine. Later today I’m going to figure out what it’s suggesting and see if a different approach is needed. ——- The ChatGPT code is nonsense that looks like AutoHotkey code.
- staindk 4y agoAhaha oh dear, well at least you tried.
- criddell 4y agoI ended up uninstalling the older version of AHK that I had installed and updated to v2 and rewrote the script using a slightly different (and simpler) method of getting the currently selected item in the window. So far today it’s working…
- slig 4y agoTabs are new in the Windows Explorer, right? Did you update your script to reflect that?
- SeriousM 4y agoI see here are the masters of ahk! Is there a smart way to mark/record from a specific moment till "done" and just reply it 1/n times? I tried many macro tools but none of them was "just easy" to use.
- LecroJS 4y agoCan you expand on “from a specific moment till done” and possibly provide an example? What’s the exit condition? Time? A ui change? Seems like you could write a do_macro function and bind a key to loop it till “done” but I may be misunderstanding
- SeriousM 4y agoOh yes of course, thanks for the follow up! I work in many different applications therefore I can't create fixed automations for the major part, but many times I come across tasks I need to do N times with ui elements always on the same spot. Think of it like the very same website but in a different context (build, commit, server, ...). I want to start a macro recording, do my stuff and stop the recording, then start the playback N times like shift-F11-13 where 13 is the number of loops. All that should be ui hidden and always be on the watch for my keystrokes to start recording/playback.
- LecroJS 4y agoThanks for the extra details, I think I understand what you’re looking for. Have you looked into something like this[1] for generating the macro as an ahk file? Full disclosure: I have not used it, but it seems like what you’re looking for. If you find that it suits your needs, I’d use that to record the macro and then wrap it in a loop from 1..N where N is based on the Fn key you press. That should do the trick unless I’m misunderstanding. I wish I could be of more help, but this repo seems like a decent starting point for your use case. Apologies if the formatting is poor as I am on mobile. [1] https://github.com/adegard/AHK_SCRIPTS https://github.com/adegard/AHK_SCRIPTS
- irthomasthomas 4y agoAutohotkey is the only windows thing I miss on Linux. And it seems impossible to even discuss desktop automation with contemporary Linux DE people, they just glaze over. "Like, why would you want apps to be able to control other apps, that sounds dangerous! We definitely want to protect you from that in Wayland.... Oh, what's that? You are a large consultancy that uses time tracking apps to help with billable hours? I guess you have to change your business model"
- TechSquidTV 4y agoPeople are sleeping on Windows Power Automate too
- diffeomorphism 4y agoYou are a large consultancy but too broke to pay anyone to write software? Yeah, then changing your business model is probably long overdue.
- phil294 4y agoCheck out https://bitbucket.org/mfeemster/keysharp/ https://bitbucket.org/mfeemster/keysharp/ and https://github.com/phil294/AHK_X11 https://github.com/phil294/AHK_X11, two attempts at reimplementing AHK on Linux. The former is v2 but not usable yet, the latter is by me, v1 "classic" and somewhat incomplete.
- irthomasthomas 4y agoMany thanks. How do they compare with autokey? I haven't tried it properly, but it gets mentioned a lot. https://github.com/autokey/autokey https://github.com/autokey/autokey
- phil294 4y agoI haven't used AutoKey personally, but it's quite capable and generally "just" a Python library that also happens to ship with its own optional editor (https://autokey.github.io/autokey/_images/AutoKey_Scripting.png https://autokey.github.io/autokey/_images/AutoKey_Scripting....). Keysharp / AHK_X11 on the other hand ship their own runtimes that will be / are compatible with the actual programming language AutoHotkey v2 / v1 and thus cannot be used in conjunction with other languages, apart from shell invocation. For a detailed feature comparison with AutoKey you will have to research this yourself, but there's at least one feature which is exclusive to AHK_X11 right now, and that is accessibility-related commands such as ControlClick or WinGetText.