11 ms·
Learn AutoHotKey by stealing my scripts
- denolfe 3y agoAutoHotkey is what made me fall love programming after disliking it after getting my degree. After switching to a macbook, AutoHotkey is probably what I miss most from being on Windows. It really has it all. My old suite had: - Universal VIM movement w/ CapsLock - App launch hotkeys - App-specific hotkeys - Easy text-expansion Hasn't been updated in years, but here is the repo for those interested: https://github.com/denolfe/autohotkey https://github.com/denolfe/autohotkey Or a nice boilerplate to start from: https://github.com/denolfe/AutoHotkeyBoilerplate https://github.com/denolfe/AutoHotkeyBoilerplate
- wellthisisgreat 3y agoAHK and powertoys are the two programs that make Windows tolerable. I haven’t yet played with AHK 2 and ChatGPT, but since she has a cutoff at 2021, she may not know be well versed in AHK 2.0
- bobsmooth 3y agoChatGPT is not. It'll say it knows AHK 2.0 but the code it generates is non-functional despite looking correct.
- devindotcom 3y agoWow, the one time in history I may be able to contribute something useful to a code-related discussion. I set up this script so I could quickly and easily open a blank plaintext notepad.exe instance at any time, which is super useful as a writer. When I hit tilde it opens, when I hit tilde again, it closes, with a save dialog if anything was written. It's the only thing my AHK does! `:: IfWinActive Untitled - Notepad WinClose else IfWinActive *Untitled - Notepad WinClose else IfWinExist Untitled - Notepad WinActivate else IfWinExist *Untitled - Notepad WinActivate else Run Notepad return
- LelouBil 3y agoWouldn't notepad++ be better because of the auto save ? I think auto saving of unsaved documents is one of it's best features
- TuringTest 3y agoNotepad++ may be extremely slow to open if you have a previous tab with a huge file, like a log or a xml data dump. That would defeat the point of having the notetaking window open instantly.
- mackrevinack 3y agothat's a good one fyi, if you use the WinActive() or WinExist() functions you can combine different titles If WinActive("Untitled - Notepad ahk_class Notepad") or WinActive("*Untitled - Notepad ahk_class Notepad") maybe you don't have to put in the "ahk_class Notepad" bit, its been a while since i used ahk!
- myfonj 3y agoI like the detail how the very same key (just mostly in combination with meta/windows key) is kinda idiomatic toggle for terminal, what most programmers "live in". I wonder if digital graphic artists happen to launch their scratchpads or paint programs in a similar manner. Btw, for use-cases when you need to keep the "toggled" window opened and do not want to close, minimize or hide it or something and just need the fastest flip to, flip back to previous window "toggle", super useful but (for me) long time forgotten native Windows hotkey is *`Alt + Escape`* - it simply switches to previous focused window without even showing window overview (like Alt+Tab). So AutoHotkey *v1* boilerplate for such switcher/launcher then could be something like: ; Toggle <...> window using Ctrl + Shift + Win + <key> ^+#<key>:: _bckTMM := A_TitleMatchMode _bckDHW := A_DetectHiddenWindows SetTitleMatchMode, 2 DetectHiddenWindows, On ifWinExist, <... window title fragment> { ifWinActive { send, !{escape} } else { WinActivate } } else { run, <... launcher> } DetectHiddenWindows, %_bckDHW% SetTitleMatchMode, %_bckTMM% return Or if you do not want that window to clobber the taskbar, you can use `WinHide` instead of that Alt+Win `send, !{escape}` and add WinShow to WinActivate, but it does not work well with some kinds of windows. Also for window detection it may sometimes be more suitable to use `ahk_exe` or `ahk_class`.
- pydave 3y agoAutohotkey is amazing, but I wish it used a saner language. I struggled to write a reliable golden ratio version of aero snap [1]. Dealing with different monitors, sizes, etc doesn't seem like it should be so hard, but I always get tripped up by the bizarre Loop syntax or silent failures from some simple mistake that suck the fun out and I give up. I found ahk python module [2] but combining it with the keyboard module doesn't work as well as autohotkey as a hotkey listener. [1]: https://github.com/idbrii/daveconfig/blob/main/win/autohotkey/AutoHotkey.ahk#L287 https://github.com/idbrii/daveconfig/blob/main/win/autohotke... [2]: https://pypi.org/project/ahk/ https://pypi.org/project/ahk/
- ramenbytes 3y agoYou know, that's part of what's been holding me back from using it for much besides remapping CapsLock to Control. Maybe it's time to sit down and write a Lisp DSL that compiles to it.
- pmontra 3y agoOr make it call a cloud service running a real program in a kubernetes cluster, which gets the hotkey and returns a script to interpret. If AutoHotKey does not have network and eval functions, they must be added ASAP :-)
- TOGoS 3y agoIt's always time to sit down and write a lisp DSL. That compiles itself to AutoHotKey scripts so you can compile while you key. (I am in the process of doing this inside OpenSCAD.)
- ad8e 3y agoRemapping Capslock to Control: Windows: https://github.com/randyrants/sharpkeys https://github.com/randyrants/sharpkeys Ubuntu Linux (don't know about other Linuxes): /usr/share/X11/xkb/symbols/pc key <CAPS> { [ Caps_Lock ] }; -> key <CAPS> { [ Control_L ] }; These solutions avoid needing to keep a keybinding application open. The Linux solution unfortunately resets after every version upgrade.
- 3y ago
- ra1n 3y agoI have swapped Caps Lock and Escape on my Linux personal laptop and I have grown used to it. So when I dual booted Windows on my machine, I used Powertoys[1] to achieve the same. At work, I have no option to install Powertoys or Uncap[2] for that matter. AutoHotKey is the only way, but I'm unable to get it to work. I used this StackOverflow[3] answer, but with this, both Caps Lock and Escape send both of the keys. So I'm stuck occasionally messing up my Teams messages :) [1]: https://github.com/microsoft/PowerToys https://github.com/microsoft/PowerToys [2]: https://github.com/susam/uncap https://github.com/susam/uncap [3]: https://stackoverflow.com/questions/38558376/how-to-map-caps-lock-to-esc-in-autohotkey https://stackoverflow.com/questions/38558376/how-to-map-caps...
- wellthisisgreat 3y agoCan’t give an AHK answer but what about Sharpkeys?
- sorz 3y agoDid you try scancode map registry[1]? I use it to swap Ctrl/CapsLock and it works well even with RDP softwares and run-as-admin apps which PowerToys couldn't handle. [1] https://superuser.com/questions/550679/where-can-i-find-windows-keyboard-scancode-registry-information https://superuser.com/questions/550679/where-can-i-find-wind...
- sbt567 3y agoKanata[0] is amazing. It support both Linux and Windows. But I'm yet to try it on windows because my majority work is on linux. [0] https://github.com/jtroo/kanata https://github.com/jtroo/kanata
- rgoulter 3y ago> I have swapped Caps Lock and Escape on my Linux personal laptop and I have grown used to it. I'd also suggest "home row modifier keys" (or "home row mods"). The idea is to have the key behave the same when tapped, but differently if held. (e.g. https://github.com/evilC/TapHoldManager https://github.com/evilC/TapHoldManager implements this for AHK) With home row modifiers, Shift/Ctrl/Win/Alt are put underneath fdsa (and jkl;). -- This reduces the need to use pinky fingers for these keys, & the fingers get to remain on home row more.
- PeterStuer 3y agoI read AutoHotKey is a real lifesaver ... in Path of Exile.
- jtriangle 3y agoAlso works great for automating userspace applications that you're forced to use.
- Scoundreller 3y agoI once used it on a citrix app. Can't use some of its functions that "find" controls on a form, so I set it to resize the window to a consistent size everytime and then execute its clicks at the right x,y coordinates. I learned that you could click buttons before they were even drawn on the screen.
- villgax 3y ago[flagged]
- hackernudes 3y agoHere is my collection of AutoHotKey v2 scripts: https://github.com/EBADBEEF/ahkv2-scripts https://github.com/EBADBEEF/ahkv2-scripts The AHK documentation is really good, and is a windows help file (chm). It is really fast, has a good enough indexed search, and example code is usually present.
- 2Gkashmiri 3y agoi learned my first "programming" by doing autohotkey. you write code line by line and the software expects to parse it one by one. imagine my surprise when trying python for the first time and indentation error. WTF does indentation has to do with code? i still cannot get over the fact that some interpreters and compilers and shit look at whitepace and go "this should be 4 space and not just 1 or 0. boo. wont run". i get it, there has to be some form of beatification and stuff but why the hell wont the program run without proper indentation? i have a problem at work, something tedious and my mind can think entire AHK programs. all i have to do is type them out and run.
- BanazirGalbasi 3y agoPython uses indentation for nested scope (I think that's the right term). While other languages might use curly braces or even keywords like do and end to enclose loops and functions, Python uses indentation. It ensures code is readable, but coding newbies have to learn about whitespace errors AND scoping together. It's one of the parts of the language I dislike the most.
- 2Gkashmiri 3y agoits like trying to learn to drive while the car is actively trying to not let you drive. you can do it but its not fun. i want to do a loop, i dont want to learn to be forced to understand indentation. that kills the enthusiasm imo.
- zo1 3y agoIt's like learning to drive the car whilst sticking to the rules of the road and staying under the speed limit. It's not supposed to be fun. Besides, I don't know what backwards IDE you used. I've been doing python for 15 years and have never had to manually indent squat, ever. It sounds more like you didn't actually try python but read about the whitespace indentation somewhere and decided to chime in. Either that or you tried it in notepad.
- 3y ago
- FrenchTouch42 3y agoComes in handy for opening Hearthstone packs so you don't need to continuously press space.
- LoveMortuus 3y agoFor such simple and repetitive tasks I would suggest giving TinyTasks a try (https://www.tinytask.net/ https://www.tinytask.net/). There's no coding, you just press record do what ever needs to be done, stop recording, select how many times to repeat and play!
- abwizz 3y agoiirc ahk has a recording mode too; it's the feature of modifying what was recorded to make more robust and useful
- ohlookcake 3y agoThis looks great. What's the closest/best Mac equivalent?
- panic 3y agoThere's nothing exactly like it, but I use Keyboard Maestro for macros and such.
- magarnicle 3y agoIs there anything AHK can do that Keyboard Maestro cannot?
- Loocid 3y agoBeing free is a big one.
- deleted 3y ago[deleted]
- eviks 3y agoYes, AHK is "lower level" regarding input tracking, so in KM left vs right modifiers aren't properly supported (though there are hackarounds that can make it work) Then the sripting language is easier for batch editing and various permutations with proper functions and variables (though again KM can be partially hacked around to make it easier)
- RajSinghLA 3y agoRaycast
- pahund 3y agoBetterTouchTool has a different approach, it's not a programming language per se, but lets you write JavaScript or AppleScript code to achieve anything you can do with AutoHotkey, and more. If BTT were available for Windows, I'd never touch AHK again.
- krackers 3y ago
- trojan13 3y agoI always preferred AutoIt to AutoHotKey, but AutoIt never got any updates and the community is slowly dying while AutoHotKey seems to be doing great.
- yomlica8 3y agoI remember comparing AutoIt and AutoHotKey to pick which one to learn. The community being really open and seemingly twice as large at the time was why I selected AHK. Shame about the language syntax though, I still fight with it. But it is very powerful.
- trojan13 3y agoThe syntax was one of the main reasons I chose AutoIt. For some reason I cannot stand the AHK syntax. For me personally it is hard to bring structure to an AHK code.
- Wolfenstein98k 3y agoEvery time I consider trying to take up coding, I remember that I have tried to write the most basic AHK scripts possible and cannot even get going with the tutorials. I find it completely impenetrable.
- emi2k01 3y agoI find it hard too and I've plenty of experience programming. The alien syntax, the incompatibilities between versions, the outdated information on the internet made it difficult to learn. I'd recommend to just use python with a library like pyautogui and similar.
- lazylion2 3y agoFor me AHK is harder than other programming languages I learned (python, JS...). Took me a while to figure out a decent environment for it: VScode with Autohotkey Plus Plus extension, which allows debugging. +chatGPT is super useful for it. so don't get discouraged. If you want to learn coding I'd recommend learning python on some online code editor which requires zero setup. lookup 'python online', there are many websites for it. also Google Colab is awesome
- mackrevinack 3y agoahk is fairly forgiving though compared to other languages. i found it harder to get into python even after years of getting proficient at ahk, and python is supposed to be one of the easier languages to learn. maybe you just need to search online more or refine you searches. when i was learning ahk first i would nearly end up searching nearly every little thing i needed to do, and there was always a forum post with the answer or part of the answer
- criddell 3y agoChatGPT is actually pretty good at writing AHK scripts except it always writes a mixture of v1 and v2 syntax. Even if the script it creates won’t run, there’s usually enough to get you 80% of the way there. The most useful thing I’ve made: Select text anywhere and press ctrl-shift-1. Select text somewhere else (even in another application) and press ctrl-shift-2. Press ctrl-shift-3 and my graphical diff tool opens to show me the differences.
- LoveMortuus 3y agoAutoHotKey is amazing! I've written more then 5000loc long program that plays an MMO for me! It can already do most of the content that's in the game, but there still a lot of improvement needed. But the development was so fun, every night I would start the script and then when I woke wake up, I would see where it broke and could then try to fix it and test it again the next night (because a lot of in-game content rests daily). When I started writing the program, I was looking around to see if there's a library for Rust that would give me the same or at least similar functionality, but sadly I didn't find anything. Don't get me wrong AHK is amazing, I just wanted to use the coding of this program as a way to better learn Rust! I even had the program write a CSV file so that I could track the effectiveness of farming. It really is incredible how powerful and easy to use AutoHotKey is!
- isaacfrond 3y agoAutoHotKey is amazing! for cheating! Right, noted.
- brokenmachine 3y agoOP is just playing a different game to the other players. If the game is boring enough that it can be played by an ahk script, then it probably isn't the most interesting game in the first place. The ahk game sounds like more fun to me.
- lfkdev 3y agoThat doesnt change the fact its simple cheating, getting an unfair advantage against other players. Beside this, botting is not what AHK is really good for
- computerfriend 3y agoOther players can write automation too.
- csydas 3y ago
- qwertox 3y agoAHK is one of the apps which locks me into using Windows. I use it to add characters like äöüß and áóúñ to my keyboard, to control the light level in the room and apartment, add timestamps like `08:39 –`, `2023-08-22 08:39:46` or 2023-08-22 — Tuesday` with the press of one/two buttons, shut down/turn on the power to my monitors with a Tasmota enabled power outlet when toggling the pause key and some other stuff. I only wish it had the capability to use a second keyboard as a button surface to trigger stuff while eating up those key presses, so I'm resorting to a small bluetooth keyboard connected to a raspberry pi zero in order to get more buttons.
- Essenceblue 3y agoWith AutoHotInterception AHK can differ between different keyboards/mice based on their hardware-id. You can have a separate keyboard with it's own layout, macros, etc.
- dttyde 3y agoI've had some good experiences with using Luamacros to intercept a second keyboard and forward the keypresses to autohotkey like this: https://miquelvir.medium.com/secondkeyboard-1c39e52e023b https://miquelvir.medium.com/secondkeyboard-1c39e52e023b Apparently there is also this: https://github.com/evilC/AutoHotInterception https://github.com/evilC/AutoHotInterception
- jabroni_salad 3y agoI wanted to comment this (Tom Scott used it to map buttons across 15 keyboards to unique emojis on a single computer) but it looks like as of March 2023, Luamacros has been abandoned :( > Let's officially state what has been a reality for the last several years. I don't use Hidmacros/Luamacros any more and have no interest in improving it or even fixing existing bugs. I invest my personal time in other things which are more interesting for me now. So please don't expect any support from my side. I'm also removing all donation buttons.
- otoburb 3y ago>>AHK is one of the apps which locks me into using Windows. Hammerspoon[1] seems to be the best option for macOS. [1] https://www.hammerspoon.org/ https://www.hammerspoon.org/
- larschdk 3y agoGreat stuff. I use AutoHotKey all the time too: - Insert date/timestamps shortcut (6 different formats, including ISO, and filename-friendly) - PuTTY/SSH launcher shortcuts for often used hosts and serial ports - Stateful DWIM Application Launcher for 10+ applications, e.g. Outlook (Win+O), Windows Terminal (Win+Space), Total Commander (Win+T), etc. (Either launches, activates, or minimizes depending on current state) - Paste clipboard in plaintext (no format) in any aplication (Win+V) - Paste clipboard removing newlines in any application (Win+Alt+V) - AltGr input layer for special characters (æøåµΩ° and some emojis) - Media & Volume shortcuts (start/stop/next, volume up, volume down)
- aemoron 3y agoMind sharing these? My current job includes a lot of manual copying, at least until I can automate it. Especially the plaintext/no newlines paste sounds very useful!
- larschdk 3y agohttps://github.com/larsch/AutoHotkeyScripts https://github.com/larsch/AutoHotkeyScripts
- aemoron 3y agoAppreciate it!
- jaclaz 3y agoCannot say if useful, but if you need to insert/copy paste text (and modifiers) there is a tool written in AHK that is very handy: https://lintalist.github.io/ https://lintalist.github.io/
- raveren 3y agosince we're sharing, here's mine, I've been actively using/improving it since 2012 https://gist.github.com/raveren/bac5196d2063665d2154 https://gist.github.com/raveren/bac5196d2063665d2154
- scottfr 3y agoWe built Text Blaze [0] a Chrome Extension [1] that supports a lot of similar capabilities. It lets you do text expansions on any website using hotkeys, include dynamic values like the date a week from today in your snippets, build form UI's [2], and include dynamic logic using formulas and if-statements [3] (it uses a dynamic reactivity model for formula's similar to spreadsheets). One thing we are really excited about currently is using Text Blaze snippets to connect any website to an Airtable/Monday.com like spreadsheet using a lightweight SQL variant we created [3]. Combined with forms and formulas, this allows you to build mini-apps you can use on any site with a hotkey. [0] https://blaze.today https://blaze.today [1] We're currently beta testing Mac and Windows desktop versions. [2] https://blaze.today/guides/forms/ https://blaze.today/guides/forms/ [3] https://blaze.today/formulas/reference/ https://blaze.today/formulas/reference/ [4] https://blaze.today/datablaze/docs/bsql/ https://blaze.today/datablaze/docs/bsql/
- sireat 3y agoAs others have rightly noted AHK is amazing for what it lets you do on Windows. I've easily saved/earned over 100k USD from AHK. However, the AHK language is not the most pleasant to use. That leads to question why isn't there something as powerful available in Python or say Lua. Yes there is https://github.com/pywinauto/pywinauto https://github.com/pywinauto/pywinauto but in practice it did not work as well as AHK. It is just WinAPI underneath so C# would be another choice if there was a nice wrapper library. I guess the answer on why AHK is so popular is that it is ugly but it works.
- simula67 3y agoPyAutoGui is very good. I have been using it for a long time and rewrote some simple ahk automations with it recently. It's strictly not a one-to-one replacement (so I still use autohotkey) but the UI automation features are well-done.
- eviks 3y agothere is an effort to rewrite AHK in C# and support other OS https://www.autohotkey.com/boards/viewtopic.php?f=80&t=77248 https://www.autohotkey.com/boards/viewtopic.php?f=80&t=77248
- vxNsr 3y agoThe reason AHK is so popular is because the ugliness that most “real” programming languages won’t tolerate is what makes it so approachable in the beginning.
- hwayne 3y agoUpgrade to v2 if you haven't yet! It was just released earlier this year and makes the language a lot less ugly. No more command/function divisions, everything's just a function!
- edmundsauto 3y agoCan you elaborate on how you saved/earned money from it?
- ajonit 3y agoAutoHotKey is great. Few years back, I made a video and published a free downloadable AHK template. https://www.learnqtp.com/get-productive-with-automation-autohotkey/ https://www.learnqtp.com/get-productive-with-automation-auto...
- jerrygoyal 3y agohere's my list of top AHK scripts: https://gourav.io/blog/autohotkey-scripts-windows https://gourav.io/blog/autohotkey-scripts-windows
- nullandvoid 3y agoOne of my fondest AHK memories was back when I created a bot for a runescape private server when I was younger. It clicked on pixels of a certain character in game to thieve an NPC, and could detect full inventory, bank and go again.
- omnibrain 3y agoFor my wedding I set up a "photobox" with AutoHotKey. I took a simple software to control my fiancees Nikon via USB and IrfanView on my Laptop. I configured Irfanview to monitor a folder and always show the newest picture. Wit AutoHotKey I made a simple GUI with 3 Buttons. Preview, Autofocus and "SNAP". Preview brought up the camera software in liveview mode. Autofocus triggered the Autofocus. "SNAP" brought up a large countdown, at 0 it triggered a photo. The it minimized the camera software and brought up IrfanView. After a few seconds it "reset" itself, so IrfanView got minimized and my button GUI got brought up again. My guests loved it and I saved hundreds of Euros for renting a photo box and I got great images out of it.
- basiskarten 3y agoSounds like a really cool project. Did you take any pictures of the box? Also congrats on getting married!
- omnibrain 3y agoI didn‘t build a box itself. It was just the Nikon on a stand with a flash directed to the ceiling for better lighting. My laptop on a small table infront of it to control it and work as a display.
- gnopgnip 3y agoI use ahk to send the clipboard as typed letters when dealing with certain vms or remote access or weird webpages and normal paste doesn't work. The shortcut is ctrl+b ^+b::SendRaw %clipboard%
- deostroll 3y agoNot sure if AutoHotKey is the tool for this, but, I am looking for a functionality such that, when I get a ping from MS Teams (say), I want some other system in my home network to notify me of it - perhaps a notification in my android phone? Anyway we can achieve this?
- RobertSponge 3y agoDoesn’t ms teams have API? I have elgato stream deck and it talks to the local client via official client API.
- deleted 3y ago[deleted]
- _cenw 3y agoIt does, but it is extremely limited. The StreamDeck plugin covers essentially the entire (local) API surface. From what I glanced, it might even have been created for the Stream Deck plugin. https://support.microsoft.com/en-us/office/connect-to-third-party-devices-in-microsoft-teams-aabca9f2-47bb-407f-9f9b-81a104a883d6?storagetype=live https://support.microsoft.com/en-us/office/connect-to-third-... For everything else, you can either parse a log (have fun!) or ask your AD admin to create credentials so you can use graph API after an OIDC handshake (also have fun!)
- mackrevinack 3y agosounds like something that would be better suited to ifttt or zapier
- ChoGGi 3y agoI believe you can use ahk to monitor colour changes?
- ThrowawayTestr 3y agoCheck out if this then that (iftt)
- 3164 3y ago[dead]
- FranklinMaillot 3y agoI used to use an Ann Pro 2 keyboard. By default, h, j, k, l could be used as arrow keys when fn was held down. The fn keys also remapped '[]' to 'home' and 'end', ";'" to pgup, pgdown, and '/' to delete. It also had this feature where the caps lock key acted as a fn key when held down. I very quickly got used to holding the caps lock key with my left pinky to access all the keys I needed with my right hand. I became much more productive on this little 60% keyboard than on any full-sized one as I never had to move my fingers from the home row. I've now switched to a qmk compatible Keychron V2 (65%) keyboard and remapped the keys exactly the same way. I'm very tempted to go back to a more compact 60% since I literally never use the arrow keys. When I use my laptop on the go, AHK to the rescue. I found a script[0] that does almost the same thing, unfortunately, it fails when I use more than one modifier with the arrow keys. For example: shift + ctrl + left arrow to select one word to the left, which is shift + ctrl + caps lock + h in my case, doesn't work. [0] https://github.com/AlexP11223/hjkl-keybindings/blob/master/windows/autohotkey/hjkl.ahk https://github.com/AlexP11223/hjkl-keybindings/blob/master/w...
- animal531 3y agoThe most impressive script I found and modified at some point long ago was while playing Diablo 3. I had been getting a bit of an RSI issue because I was pushing my mouse hand too hard into the mouse pad, so I looked around for some means to play it with a controller. The script would bind your analog move to a little circle around the player, allowing you to smoothly run in any direction. You could then press a button to alter the range to distant for casting abilities further away. With just a bit of customization per class it worked amazingly well.
- dave7 3y agoI love AutoHotkey, it basically gave me my start in this career and still makes me occasional commissions to this day. My current "Dave's Utilities" AHK is rather lean compared to times gone by, but I have these "essential" functions always a keypress away on my Win11 installation: - ctrl+alt c / n / s for calc / notepad / snipping tool - toggle "always on top" - send to "other" monitor (I have a 2 monitor side-by-side setup) - turn a Youtube "shorts" url in to it's regular Youtube page "watch" version via URL manipulation - remap ctrl+shift+c to do nothing, instead of very slowly opening Chrome dev tools when I miss ctrl+shift+v "paste as values" in my huge Google spreadsheet
- myfonj 3y agoThere is a native Windows shortcut for Send window to next/previous monitor: Win + Shift + Right/Left arrows. (Windows recently got bunch of keyboard shortcuts, some overridable, some not. Sometimes you can discover them only with your AHK disabled, since you might have overriden them in the past...)
- criddell 3y agoAHK is tricky enough, but I have a hard time finding available key sequences. For example, is there some way to search your system to see if anything is hooking ctrl-7? Alternatively, do you have a favorite key sequence pattern that usually works? The linked scripts seem to use stuff like “;.” which is pretty clever. Semicolon isn’t usually followed by anything except space.
- onionisafruit 3y agoI haven’t used AHK in years since moving to Mac, but I used to have that same issue. I may have spent more time finding just the right key chord than I did actually using AHK. It’s hard to find something ergonomic and easy to remember that isn’t already used by any of my regular programs. It would be nice if keyboards had an equivalent of 127.0.0.0/8 where you know nobody else is listening for a key combination in that range.
- slig 3y agoI'd like to ask the AHK programmers here if anyone can figure out how to do the macOS's CMD+` and CMD+SHIFT+` to alternate between windows of the same App in Windows while ignoring any minimized window. I managed to coerce chat GPT to do a working version for the `Last Window`, but it simply cannot do a working forward version. ``` !+`:: ; Last window WinGet, ActiveProcessName, ProcessName, A WinGet, windows, List, ahk_exe %ActiveProcessName% Loop, % windows { thisID := windows%A_Index% WinGet, thisWindowState, MinMax, ahk_id %thisID% if (thisWindowState = -1) continue ; Skip if window is minimized lastWindow := thisID } if (lastWindow) { WinActivate, ahk_id %lastWindow% } return ```
- dattiimo 3y agoI've used GroupAdd[1] and GroupActivate to alternate between windows of the same app but it doesn't ignore minimised windows. Maybe you can ignore minimised when adding to the GroupAdd list some how. [1] https://www.autohotkey.com/docs/v1/lib/GroupAdd.htm https://www.autohotkey.com/docs/v1/lib/GroupAdd.htm
- slig 3y agoThanks! I was going to ask you on your comment, thanks!
- leejoramo 3y agoIf you like macOS keyboard shortcuts, I recommend you checkout Kinto go Windows and Linux. On Windows, Kinto used AHK https://kinto.sh https://kinto.sh However, at least when I set it up Kinto did not provide switching windows in this fashion. Here is the script I use. This includes some related functionality to make the handling of windows more Mac-like ``` ; BRING FORWARD ALL WINDOWS OF THE CURRENT APPLICATION ; This is a generalized version of ; https://superuser.com/questions/113162/bring-to-front-all-windows-for-a-certain-application-in-windows-7#125985 https://superuser.com/questions/113162/bring-to-front-all-wi... ^!`:: WinGetClass, class, A WinGet, id, list, ahk_class %class% Loop, %id% { this_id := id%A_Index% WinActivate, ahk_id %this_id% ; MsgBox, The active window's this_id is "%this_id%". } return ; MINIMIZE ALL WINDOWS OF THE CURRENT APPLICATION ^!m:: WinGetClass, class, A WinGet, id, list, ahk_class %class% Loop, %id% { this_id := id%A_Index% WinMinimize, ahk_id %this_id% } return ; CYCLE ALL WINDOWS OF CURRENT APPLICATION ; Pull bottom window to the top, and force it to display ^`:: ; need Process and Class to restrict to current application ; most apps have unquie window classes, but Chromium based apps ; share their primary window class. Thus Google Chrome, VS Code and ; Electron based apps all looked the same using only `class` WinGet, Active_ID, ID, A WinGet, Active_Process, ProcessName, ahk_id %Active_ID% WinGetClass, class, A WinGet, id, list, ahk_class %class% ahk_exe %Active_Process% lastItem := id%id0% lastItemId := id%lastItem% WinActivate, ahk_id %lastItemId% WinSet, Top,, ahk_id %lastItemId% Winset, AlwaysOnTop, On Winset, AlwaysOnTop, Off return ; CLOSE CURRENT WINDOW AND ACTIVATE NEXT WINDOW OF CURRENT APP ; similar to the CYLCE ALL WINDOWS OF CURRENT APP, but closes the ; current window. ; ; Because some Apps have Tabs that are closed via the same `^w` shortcut, ; we only switch to the next active window if the current window no longer ; exists after sending `^w` ; ; RATIONAL: This makes the Application Context a little more like macOS ; where closing windows leaves you in the current application, and not ; a random window that is the next in the stack. $^w:: ; need Process and Class to restrict to current application ; most apps have unquie window classes, but Chromium based apps ; share their primary window class. Thus Google Chrome, VS Code and ; Electron based apps all looked the same using only `class` WinGet, Active_ID, ID, A WinGet, Active_Process, ProcessName, ahk_id %Active_ID% WinGetClass, class, A WinGet, id, list, ahk_class %class% ahk_exe %Active_Process% lastItem := id%id0% lastItemId := id%lastItem% Send ^w Sleep 50 WinGet, Current_ID, ID, A If (Current_ID != Active_ID) { WinActivate, ahk_id %lastItemId% WinSet, Top,, ahk_id %lastItemId% Winset, AlwaysOnTop, On Winset, AlwaysOnTop, Off } return ```
- dattiimo 3y agoAutoHotKey is awesome! I use it for better/faster app switching. I have a "shortcut" enabler key, in my case Right Alt, that controls it all. When held down with any letter, it switches through the instances of that app. For example, Alt + C switches to VS Code window. Alt + F keys opens new instances of an app such as a new Chrome window in a specific profile. Alt + number are configurable and can be set for the current window in focus. By tapping Alt, the "edit" mode is enabled, allowing me to set the current window as any of the number keys. When in "edit" mode, the H,J,K,L keys also switch to navigation, becoming up, down left, right etc. It makes switching between apps so much faster.
- anjanb 3y agocan you share your script please ?
- dattiimo 3y agoI don't have anything shared online but I can look at publishing it if there's interest. It's one big script so I'll have to clean it up and remove any sensitive data from it first.
- hwayne 3y agoThat's one of the things I have in the project! At least the window switching. Not the dynamic window selection and "edit mode" though. https://github.com/hwayne/autohotkey-scripts/blob/main/Lib/WindowSwitching.ahk
- deleted 3y ago[deleted]
- pie_flavor 3y agoI love AHK. I have Ctrl-` pop up Windows Terminal, but only from programs that don't already have an integrated terminal; I have Ctrl-Alt-Space for a window to stay always-on-top; and I have an auto-clicker that's integrated with MouseKeys to use its enabled state and right-click-vs-left-click state and which cancels itself if the mouse is moved at all.
- 0-_-0 3y agoCheck out 'quake mode' of Windows Terminal
- dattiimo 3y agoThis AutoHotKey script was a game changer for me. It maps Ctrl + Shift + V to paste without formatting. ;; Text–only paste from ClipBoard ;; (https://autohotkey.com/board/topic/10412-paste-plain-text-and-copycut/) ;; ctrl + shit + v ^+v:: Clip0 = %ClipBoardAll% ClipBoard = %ClipBoard% ; Convert to text Send ^v ; For best compatibility: SendPlay Sleep 150 ; Don't change clipboard while it is pasted! (Sleep > 0) ClipBoard = %Clip0% ; Restore original ClipBoard VarSetCapacity(Clip0, 0) ; Free memory Return [Edit: tried to fix formatting]
- inanutshellus 3y agoctrl-shift-v is so nice. it should be an OS-standard keyboard shortcut for clipboards. would also love to get a mult-value clipboard (e.g. my last 5 clips) but... that's asking a lot i guess. ;-)
- inafewwords 3y agoI use it in Mac as part of my job duties. So far it mostly works in the place I need it most which is web forms on chrome. Some applications I wish it worked on do not recognize it such as notes app. I'll have to figure it out on Mac since ahk was my go to when I had pc
- function_seven 3y agoUse WIN+V instead of CTRL+V to get a clipboard history pop-up in Windows 10. https://support.microsoft.com/en-us/windows/clipboard-in-windows-c436501e-985d-1c8d-97ea-fe46ddf338c6#WindowsVersion=Windows_10 https://support.microsoft.com/en-us/windows/clipboard-in-win...
- gwill 3y agoI love AutoHotkey, but it doesn't pass security scans at my place of work. is there an alternative for running macro scripts?
- a2tech 3y agoEven if you compile the script to a binary? I've used them at some pretty security minded places and never got nailed for it
- vijucat 3y agoAn absolute must-have for me is an AHK script I use to clear the clipboard 15 seconds after something is copied to it. I developed it after a colleague pasted in chat, "Let's call it $xxxK and call it a fair deal" (with actual numbers) :| Should be mandatory at law firms, for example.
- iamjason89 3y agoBack when Lenovo ran their outlet for refurbished laptops on very database heavy oracle backend (2011?), our little computer shop would buy stuff from them. If you added an item to your cart, it would hold it for 10 min and prevent others from purchasing. I used AHK to script a process that would automatically add laptops to our cart based on certain search criteria. Then we could sift through their inventory and release what we didn't want. It was running great until one day it went rouge (okay, was prob human error) and it added EVERY item to our cart and crashed their website. Database error came up, I called them and told them what I did and they were happy to know why it went down.
- inafewwords 3y agoEvery AHK I've made has gone rogue because I want it to do things and it does it well but without guard rails i overwhelm my target every time. Thankfully the target is usually my local and I just mostly reboot You'd think I'd learn but my scripts usually start small for with one specific use and i enlarge it Unsafely once I think of another use for it Loops are my danger zone. After a few crashes the first guardrail I end up adding to a script is a stop key combo interrupt. Then figure out what bounds to put only after every mistake. I don't have the foresight to prevent "rogue" behavior
- PennRobotics 3y agofrom the V1 docs, To avoid [infinite loops] add the $ prefix to the hotkey definition (e.g. $^c::) so that the hotkey cannot be triggered by the Send command. or a very restrictive #MaxHotkeysPerInterval
- millzlane 3y agoOne of the best ones I used was one that would switch the audio output source between my headset and speakers using a hot key.
- fuzztester 3y ago> - turn a Youtube "shorts" url in to it's regular Youtube page "watch" version via URL manipulation Interesting. What is the reason for doing that?
- PennRobotics 3y agoAHK is great for setting up a quicker compose key and keeping a frictionless wheel mouse like the MX Master from zooming when you press <Ctrl>. ^WheelDown:: { return } ^WheelUp:: { return } (this possibly needs A_MaxHotkeysPerInterval := 2000 ) ----- <Caps> + a = ä. <Caps> + <Shift> + a = Ä. ... and so on with all the German letters and currency symbol. As a bonus, <Caps> on its own is mapped to "find" (Ctrl + F) and <Caps> + f runs Send "{Space}datemodified:this year -kind:=folder", for when you have a lot of historical documents and want to get quickly on with the most recent using Microsoft's bafflingly stupid search operators. (Caveat, you have to switch to "last year" in January.)
- dansalvato 3y agoBack when I worked at an IT company, I created a very simple AHK script where pressing Ctrl + Alt + V would type in the contents of the clipboard, rather than paste it. We were constantly remoting into servers that required tediously typing strong passwords at the Windows login prompt, and this workaround allowed us to "paste" them directly into the password field. Nowadays I'm on macOS and I use BetterTouchTool and karabiner-elements to handle all kinds of miniature efficiency patches, and they make a huge difference for me. BTT in particular allows for a limitless amount of system control, such as triggering context menu actions, running AppleScript, or even showing/hiding a floating WebView of your own HTML document. I've barely scratched the surface.
- yogurthewise 3y agoAHK has been a life saver for me when it comes to alpha/beta games that haven't yet implemented a key binding system!
- hateful 3y agoMy most used one is to map Right Ctrl+V to paste by actually typing what's on the clipboard instead of pasting allowing pasting in places where you may not have it - e.g. login boxes on certain KVM controllers. >^v:: SetKeyDelay, 10, 10 SendRaw %clipboard% Return ; this version types it with a larger delay to account for latency >^+v:: SetKeyDelay 500, 10 SendRaw %clipboard% Return
- account-5 3y agoMy favourite AHK story ever: https://old.reddit.com/r/antiwork/comments/qstsdp/my_5year_getting_paid_for_doing_nothing_is_over/ https://old.reddit.com/r/antiwork/comments/qstsdp/my_5year_g...
- bjt12345 3y ago[flagged]
- MatejKafka 3y agoI'm using AutoHotkey as my own custom IME, allowing me to type special characters, navigate in text and switch between applications without leaving the middle 3 rows of the keyboard: https://github.com/MatejKafka/KeyboardRemap/ https://github.com/MatejKafka/KeyboardRemap/ The README contains layout diagrams if anyone's interested.
- beaker52 3y agoI’ve consistently found AHK to be so full-of-potential yet difficult-to-extract-value-from. I’ve never managed to get anything useful out of it.
- myfonj 3y agoThat's strange. From my point of view it you get lots of value in the beginning but there is some kind of cap beyond, that it is hard to get over. I think AHK has really easy onboarding, meaning you can get tremendous low-hanging benefits out of it minute after installation -- you open the help, do your first `::btw::by the way` hostring, map reloading the script to `^+!r::reload` and from this point on you iterate quite rapidly, progressively fixing your easily fixable pains -- but sooner or later, after reaching some level of complexity, things begin to get hairy, not worth the effort or even impossible. But as as say, there is vast amount of simple shenanigans you can make with basic AKH functionality, most of them you can even make on your own just with the help file.