r/AutoHotkey • u/roasticlex • 5h ago
v2 Tool / Script Share Spotify Liker
This script will let you use a global shortcut (Ctrl+Shift+L) to like and (Ctrl+Shift+U) unlike Spotify songs globally (you could be inside a fullscreen game)
r/AutoHotkey • u/roasticlex • 5h ago
This script will let you use a global shortcut (Ctrl+Shift+L) to like and (Ctrl+Shift+U) unlike Spotify songs globally (you could be inside a fullscreen game)
r/AutoHotkey • u/Placide_Lahico • 1d ago
Win+V is fine, but I wanted something faster: no popup, no extra shortcut.
- Copy things as usual. The script remembers your last 7 text copies (no duplicates).
- Ctrl+V pastes normally.
- Press Ctrl+V again within 1.2 s and the pasted text is replaced by the previous copy.
Keep pressing to go further back; it loops around after the last one.
- Wait more than 1.2 s and Ctrl+V goes back to being a normal paste of your latest copy.
Under the hood it's just Ctrl+Z (undo the last paste) + swap the clipboard + Ctrl+V again.
Limitations
- Text only (images/files are ignored).
- Relies on Ctrl+Z, so it misbehaves in apps where undo doesn't cleanly remove a paste (some terminals, games, certain web fields).
Github : https://github.com/Placidelinkpehoun/CallbackCrtlV
Feedback welcome
r/AutoHotkey • u/Blantium11 • 14h ago
Hi all, we just launched Doable Macros in the Microsoft Store.
We wanted something like Keyboard Maestro on the Mac: you pick a trigger, stack up some steps, done. AutoHotkey can do anything but you have to write code, and Power Automate Desktop felt too heavy for "press a key, do these five things". So we built this.
A macro is "when this happens, do these steps".
What can start a macro:
;sig or ;addr. The abbreviation is deleted and the macro runs.What a macro can do:
{date}, {time}, {date:yyyy-MM-dd} and {clipboard}. Paste puts your old clipboard back afterwards.Macros live in groups, and a group can be limited to certain apps, so your Excel shortcuts stay in Excel.
Safety, because a macro typing into the wrong window is the worst:
Privacy: no account, no ads, no tracking, and the app never connects to the internet. To spot your abbreviations it keeps only the last few characters you typed, in memory, and never saves or sends them. Macros are plain files in your app data folder.
Price: free for up to 10 macros, with every feature. A one-time Pro upgrade to remove the limit is coming soon.
Honest limits:
Store link: https://apps.microsoft.com/detail/9P8D52RDQRT6 Website: https://doablemacros.tryappzlr.com
We'd love feedback. What's the first thing you'd automate, and which trigger or step is missing for you?
r/AutoHotkey • u/Longjumping-Ship-583 • 1d ago
I put it (the install setup) in virustotal and it was saying that 3/71 vendors flagged the file as malicious. Browser warned me it was not a common file and that it could be harmful and then when I disregarded that the operating system is warning me about the harm it could be doing. I was thinking virustotal might just have false positives but when the browser and the OS also warns me about it, I'm uneasy about continuing futher with the installment of autohotkey version 2.0
r/AutoHotkey • u/lindsay_wilson_88 • 1d ago
Someone please tell me I'm not imagining things. I recently wanted a script to enable entry of box-drawing characters using the numpad keys. There are "light", "heavy" and "double" characters available, so I wanted to use various modifiers to choose them.
I initially tried using left Win - in other words, this:
<#Numpad7:: Send "┏"(In case that character doesn't come out, it's U+250F "Heavy down and right", i.e. a top-left corner).
However, this had peculiar behaviour. It would only send the character when the numpad key was released, and it would not repeat a character. Press and hold the numpad key down, nothing happened until the key was released, and then it only produced one character.
Other modifiers like ctrl, shift, alt worked fine, so I switched to using them instead. That unfortunately led me down the horrible rabbit hole of getting shift to work reliably with the numpad keys. Eventually got something working, but it ain't pretty.
I happened to revisit using left Win again and this time the damn thing works no problem, just like any other modifier! Sends on key down, repeats when held down, no problem. So I rewrote my script to use Win (and ctrl, and alt) instead, it's now much simpler, and also happens to work reliably over a remote desktop connection whcih the previous script refused to.
To my knowledge, I haven't changed anything. I even tried the script on a computer that I'd never had AHK on and it worked as it should. I've tried it with keyboard hooks, without keyboard hooks etc. to try and replicate the old behaviour and just can't.
While I'm happy it works, it's annoying not to know what I was doing wrong before! Any ideas?
r/AutoHotkey • u/redspykar • 1d ago
I take a lot of screenshots using ShareX at work with my favorite shortcuts, during meetings and in general. Whether its something shared on the screen, a slide, an error, or something on teams chat . Afterwards I always had to dig them out of the ShareX sceenshots folder and paste them into a PowerPoint or a word document one by one to share with the team members. I thought of automating this task by leveraging AutoHotkey script.
How it works:
Some smaller things:
Full disclosure: I didn’t write most of the code. Claude did. I described what I wanted, tested it in real meetings, and kept going back with “this is broken” or “can it also do X”. A few of the fixes were pretty specific. For example, PowerPoint won’t save directly into a OneDrive folder, so it saves to temp and moves the file. And the notes window was showing up half on my second monitor because of display scaling. All of that came out of one afternoon of back and forth.
Repo, with screenshots and a v1.0.0 release: https://github.com/singhramandeep/SnapDeck
You need Windows, AutoHotkey v2 and ShareX. PowerPoint and Word are only needed for those output formats; the ZIP works without Office.
Happy to hear feedback or ideas. Next on my list are an undo for the last screenshot and a way to rebuild a deck from an old session.
r/AutoHotkey • u/duscorules • 3d ago
How can i create a script that will close all open CMD (command prompt) windows, using the shortcut CTRL + ALT + W ?
r/AutoHotkey • u/lindsay_wilson_88 • 4d ago
A question and a rant 🤣
The question: WHY does Windows behave the way it does regarding Shift and the Numpad? Why does it strip away/suppress/hide the shift modifier? If I have a keyboard with a numpad, I'm most likely also going to have a nice separate set of arrow keys and a bunch of home/end/pgup/pgdown keys. Why on earth would I want to press shift plus the numpad keys to get these actions?!?
Background: Recently learned about box-drawing characters (https://en.wikipedia.org/wiki/Box-drawing_characters) and figured it would be neat to write a script so I can easily enter them using the numpad keys (so 7 is a top-left corner, 9 is a top-right and so on). If you haven't seen the characters before, they are:
┌ ╭ ┬ ╮ ┐ ┏ ┳ ┓ ╔ ╦ ╗
├ ┼ ┤ ┣ ╋ ┫ ╠ ╬ ╣
└ ╰ ┴ ╯ ┘ ┗ ┻ ┛ ╚ ╩ ╝
─ │ ╱ ╲ ╳ ━ ┃ ═ ║
░ ▒ ▓ █(assuming you're viewing this in a font which supports them)
I finally decided on using ctrl, shift, ctrl+shift and ctrl+alt modifier keys. And of course all hell broke loose when I came to handling the shift modifier, thanks to Windows' behavior of stripping the shift modifier away!
Like others have described, the solution was to handle both key names (e.g. NumpadHome and Numpad7) and then actually check the states of the NumLock and Shift keys using GetKeyState(). For example, here's what I have to handle the "7" key with both the ctrl and ctrl+shift modifiers:
<^$NumpadHome::
<^$Numpad7::
{
if GetKeyState("NumLock","T")
{
if GetKeyState("Shift","P")
{
Send "╔"
} else {
Send "┌"
}
} else {
Send "{LControl}{NumpadHome}"
}
}I now have a functioning script which lets me enter all the characters I want, plus I did another script in v1 (for a WinXP machine). This threw up a few more weird quirks which I won't go in to but they took up some time to fix as well 🤣
All of that faff when a simple <^$Numpad7:: Send"┌" would've worked if Windows treated shift + numpad like every other modifier!
r/AutoHotkey • u/Itz_NiXiN726 • 4d ago
I wrote a script for a game (Brawlhalla) to start a custom match and start another when its finished, and to loop until i end it.
The script works on my other older pc running Win10, but for some reason it doesn't work properly on both of my newer machines (two 5060s). On my first 5060 it would bug out after working for a few moments, but now on my primary 5060 it practically doesn't work at all.
Here's the script, I’ll explain its function;
#Requires AutoHotkey v2.0
F1::
{
Loop
{
Loop(12)
{
Send("C") ;selects character
Sleep(200)
Send("C") ;spams to account for lag
Sleep(200)
Send("C")
Sleep(200)
Send("C")
Sleep(200)
Send("C")
Sleep(200)
Send("C")
Sleep(200)
Send("C")
Sleep(200)
Send("C")
Sleep(16000) ;waits for round start
Send("{Escape}") ;pauses game
Sleep(1000)
Send("W") ;moves up in pause menu
Sleep(1500)
Send("C") ;selects exit game
Sleep(8000) ;waits for delay
Send("C") ;selects rejoin
Sleep(1510000) ;waits for game end
}
Sleep(3600000) ;waits 1 hour for xp cooldown
}
}
F4:: Pause
^F4:: Pause(0)
return
So, this selects the character with some spammed inputs to account for lag and menus, does some stuff pertinent to the game menu, then waits for a 25 minute timer to loop everything all over again, and it repeats this 12 times before taking an hour break due to xp fatigue.
The issue im having now is it will just not register the "Send" commands consistently. Sometimes it registers them, but then once in the game it stops registering inputs. Or most times it doesn't even register the first "Send(C)" or the following ones, or it registers the first one then doesn't register any other code afterwards.
The code itself works, because again this worked flawlessly on my other machine and the code hasn't been touched, but that machine isnt working at the moment for me to use. And the code registers within a notepad, but the inputs for some reason do not translate into this game on both of my Win11 machines but worked on my Win10 machine.
Anyone know whats going on here?
r/AutoHotkey • u/heartips • 5d ago
Hello, everyone, I discovered Autohotkey, and I like the freedom it gives me. I would like to share one project that I did to help me in my daily tasks, I wanted to have feedback, or maybe some people can find it useful. Thank you.
Contextool, a free AutoHotkey v2 script that opens a pop-up menu anywhere with a single shortcut (default Ctrl+Shift+F9 or Ctrl+right click). I bind it to my mouse’s 4th button. It looks like the native Windows 11 context menu and follows your dark/light theme.
What’s inside:
Tools:
Settings live in Documents\AHK SETTINGS\Contextool, so updating means replacing one file.
GitHub: link
I’m not a developer and built it step by step with AI assistance, so feedback, bug reports, and suggestions are very welcome.
r/AutoHotkey • u/heartips • 5d ago
Hi everyone,
SnipDo went subscription-only, so I made a free alternative in AutoHotkey v2: SnipBar.
Select text in any app and a small bar appears above the selection with one-click actions:
( ) or { }You choose which buttons are shown in the settings. The look is a black pill with white icons at about 70% opacity. There’s no blur and no screenshots of your screen, so CPU/GPU usage stays minimal. It can start with Windows.
GitHub: [link]
I’m not a developer and built it with AI help, so I’d love feedback or ideas for more actions.
r/AutoHotkey • u/MachineVisionNewbie • 6d ago
edit: excuse the codeblocks. currently fighting with the reddit UI to fix them edit: fixed them
I have some simple Cheatsheets for most of my programs. (Runs through a formatter called ShowHelp() which adds some color, but not important for this question)
Requires AutoHotkey v2.0
#HotIf WinActive("ahk_exe mintty.exe")
F1::ShowHelp_Mintty()
#HotIf
ShowHelp_Mintty() {
ShowHelp([
{ title: "SSH AGENT (F2 types these in order)", rows: [
["set +H",
"Disables bash history expansion - needed because the ! in the repo name would otherwise trigger it"],
["eval $(ssh-agent -s)",
"Starts the ssh-agent for this shell session"],
["ssh-add ~/.ssh/id_2026",
"Adds the private key to the agent, so the passphrase is asked once instead of every time"] ] },
"SSH / Git Cheatsheet - F1",
I wanted to change it so instead of writing my cheatsheet in .ahk, it reads in local .md files. Creating a #HotIf instance for each file found.
Like this: Foldercontents: 'Cheatsheet.ahk' 'mintty.md' 'powerpoint.md' 'brave.md' ->
Requires AutoHotkey v2.0
pseudo_code to give you an idea:
FindFiles() ->
FoundFile1 = "mintty.md"
FoundFile1_exe = Regex(FoundFile1) -> "mintty.exe"
#HotIf WinActive("ahk_exe " FoundFile1_exe)
F1::ShowHelp_FoundFile("." FoundFile1)
#HotIf
#HotIf WinActive("ahk_exe " FoundFile2_exe)
F1::ShowHelp_FoundFile("." FoundFile2)
#HotIf
Am I thinking in the correct direction?
r/AutoHotkey • u/ReportFree2773 • 7d ago
Hello, im trying to make a script that presses the "J" key on the keyboard every 2 minutes and also pairs that input with a jump (Space) on the keyboard. I dont know anything about auto hotkey but i want to learn and installed it mainly for this. Anyone know how i can write a script for this purpose? Its for a game and i want to overnight a task in the game and this simple script should do the job.
r/AutoHotkey • u/Comfortable-Goat-267 • 8d ago
I was looking for a shortcut to always show taskbar when I need it, but have it auto hide otherwise to avoid OLED monitor burn-in. I couldn't find anything so I asked AI to vibe code a script.
The shortcut is set to Ctrl+Shift+X in this script but you can change it in the line "^+x::".
#Requires AutoHotkey v2.0
#SingleInstance Force
^+x::
{
; Windows taskbar AppBar constants
ABM_GETSTATE := 0x00000004
ABM_SETSTATE := 0x0000000A
ABS_AUTOHIDE := 0x00000001
ABS_ALWAYSONTOP := 0x00000002
; Locate the taskbar
hwnd := WinExist("ahk_class Shell_TrayWnd")
if !hwnd {
MsgBox("Cannot find the Windows taskbar.")
return
}
; Create APPBARDATA structure
size := (A_PtrSize = 8) ? 48 : 36
abd := Buffer(size, 0)
NumPut("UInt", size, abd, 0)
NumPut("Ptr", hwnd, abd, A_PtrSize)
; Read current state
state := DllCall("Shell32\SHAppBarMessage",
"UInt", ABM_GETSTATE,
"Ptr", abd,
"UPtr")
; Toggle auto-hide
newState := (state & ABS_AUTOHIDE)
? ABS_ALWAYSONTOP
: ABS_AUTOHIDE
NumPut("Ptr", newState, abd, size - A_PtrSize)
; Apply new state
DllCall("Shell32\SHAppBarMessage",
"UInt", ABM_SETSTATE,
"Ptr", abd,
"UPtr")
}r/AutoHotkey • u/Agreeable-Device5199 • 8d ago
Yeah so in short, I wanted to get statistics on what keys I press the most on my computer for a thing, so I made this. This script, if combined with an ini file, can note for you and later show you exactly all the keys you've pressed when using the script (in order), and then you can do whatever you want with it, such as for myself putting all this on Excel to get an idea of what keys I use the most.
I'm sure some guy probably has already done this, but I wanted to make mine, and knowing the little extra things I added for my case, maybe I actually had to redo it from scratch, I dunno (but I did want to do it myself).
I'm sharing this both in case someone might be interested in using it and also to get some reviews of my code, as I've heard I'm not good at AutoHotKey, so I was curious to hear any possible mistakes or imperfections.
Be careful though, if you want to use it... yeah, you'll kind of have to redo lots of things lol. My keyboard is like ultra different from yours no doubt, so you'll probably have to change the scancodes (btw there is in the script a way to easily find scancodes (showSC)), as well I implemented ways to not count some hotstrings I use (such as "jj", ";;", "²²"...) that you probably don't have, though this might give you ideas if you want to do something similar. (also this script is just for single keys; obviously, for keyboard shortcuts it would be doable by adding all them in a similar way but I didn't do it here. Also, talking about keyboard shortcuts, the keyboard shortcuts are never counted here even if it uses one of the keys in the script, like "CtrlS" doesn't add s to the stack anywhere)
I won't explain in ultra detail for understandable reasons, but in short it's just adding to a stack all the keys in strings using simple one input hotkeys, saving the stack in an ini file once the script ends, and also adding the times when you started and ended the script for extra info, and also adding a counter to not overwrite things.
Sorry if the script is long btw, I hesitated to send it to pastebin or something or remove the repetitive parts, but just to be sure I left basically everything:
#Requires AutoHotkey v2.0
#SingleInstance
iniFile := A_ScriptDir "\StatistictsSettings.ini"
Counter := IniRead(iniFile, "ScriptReloads", "Count") + 1
starthour := FormatTime(, "HH") "h" FormatTime(, "mm") "m" FormatTime(, "ss") "s" ; Get current time at the start of the script
~SC010::{ ;a
RecordHotkey("reset")
StatPush("a")
}
~SC011::{ ;z
RecordHotkey("reset")
StatPush("z")
}
~SC012::{ ;e
RecordHotkey("reset")
StatPush("e")
}
~SC013::{
RecordHotkey("reset")
StatPush("r")
}
~SC014::{
RecordHotkey("reset")
StatPush("t")
}
~SC015::{
RecordHotkey("reset")
StatPush("y")
}
~SC016::{ ;"uu" is a hotstring for me and I don't want to count it, go look at the code of "~SC024" for details
History := RecordHotkey()
if(History.prior = "~SC016"){
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("u")
}
~SC017::{
RecordHotkey("reset")
StatPush("i")
}
~SC018::{
RecordHotkey("reset")
StatPush("o")
}
~SC019::{
RecordHotkey("reset")
StatPush("p")
}
~SC01A::{
RecordHotkey("reset")
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush("^")
else StatPush("¨")
}
~+SC01A::{
RecordHotkey("reset")
StatPush("¨")
}
~SC01E::{
RecordHotkey("reset")
StatPush("q")
}
~SC01F::{
RecordHotkey("reset")
StatPush("s")
}
~SC020::{
RecordHotkey("reset")
StatPush("d")
}
~SC021::{
RecordHotkey("reset")
StatPush("f")
}
~SC022::{
RecordHotkey("reset") ;have to mention you could probably remove all these that aren't related to hotstring removals, it's just that without you can do something like type one of keys related like "ù", type somes keys that would record history and then type ù again and this one wouldn't be counted, but adding those might be costly and it isn't ultra necessary
StatPush("g")
}
~SC023::{
History := RecordHotkey()
if(History.prior = "~SC023"){ ;"hh" inputs up
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("h")
}
~SC024::{ ;"jj" is one of my hotstrings (it inputs right) and I don't want this key to be counted every time I do this hotstring as it wouldn't be intresting for the info I want to gather, so we pop it.
History := RecordHotkey()
if(History.prior = "~SC024"){
StatPush("Pop")
RecordHotkey("reset") ;we reset the history for this hotstring and all the others simply because inputing j three times would false the data if not (it would execute the condition again and remove the input I did before my first j for no reason and not count this j that could be a real j, while reseting the history means it will wait once again for me to input j twice to recognize I did the hotstring, giving the data I want (that's also why I can't use A_PrioHotkey because you can't reset it)), same for all the similar cases
}
else StatPush("j")
}
~SC025::{ ;same for hotstring "kk" that inputs backspace
History := RecordHotkey()
if(History.prior = "~SC025"){
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("k")
}
~SC026::{
RecordHotkey("reset")
StatPush("l")
}
~SC027::{
RecordHotkey("reset")
StatPush("m")
}
~SC028::{
History := RecordHotkey()
Cpsl := GetKeyState("CapsLock","T")
if(History.prior = "~SC028"){ ; "ùù" is a hostring for the symbol "≥"
StatPush("Pop")
RecordHotkey("reset")
}
else if(Cpsl = false)
StatPush("ù")
else StatPush("%")
}
~+SC028::{
RecordHotkey("reset")
StatPush("%")
}
~SC02C::{
RecordHotkey("reset")
StatPush("w")
}
~SC02D::{
RecordHotkey("reset")
StatPush("x")
}
~SC02E::{
RecordHotkey("reset")
StatPush("c")
}
~SC02F::{
RecordHotkey("reset")
StatPush("v")
}
~SC030::{
History := RecordHotkey()
if(History.prior = "~SC030"){ ;"bb" inputs left
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("b")
}
~SC031::{
History := RecordHotkey()
if(History.prior = "~SC031"){ ;"nn" inputs down
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("n")
}
~SC032::{
History := RecordHotkey()
if(History.prior = "~SC032"){ ;hotstrings ",," and "??" input enter
StatPush("Pop")
RecordHotkey("reset")
}
else{
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush(",")
else StatPush("?")
}
}
~+SC032::{
History := RecordHotkey()
if(History.prior = "~+SC032"){
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("?")
}
~SC033::{
Cpsl := GetKeyState("CapsLock","T")
History := RecordHotkey()
if(Cpsl = false){
if(History.prior = "~SC033" || History.prior = "~SC034"){ ; same as ùù but for "≤" and ":;" does μ
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush(";")
}
else if(History.prior = "~SC034"){ ;"/." does §
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush(".")
}
~+SC033::{
RecordHotkey("reset")
StatPush(".")
}
~SC034::{
RecordHotkey()
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush(":")
else StatPush("/")
}
~+SC034::{
RecordHotkey()
StatPush("/")
}
~SC035::{
RecordHotkey("reset")
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush("*")
else StatPush("!")
}
~+SC035::{
RecordHotkey("reset")
StatPush("!")
}
~SC002::{
RecordHotkey("reset")
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush("&")
else StatPush("1")
}
~+SC002::{
RecordHotkey("reset")
StatPush("1")
}
~SC003::{
RecordHotkey("reset")
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush("é")
else StatPush("2")
}
~+SC003::{
RecordHotkey("reset")
StatPush("2")
}
~SC004::{
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false){
History := RecordHotkey()
if(History.prior = "~SC004" || History.prior = "~SC005"){ ; """"" does « or » and "'"" does... things, it's long to explain but it does somethings
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("''") ;this is just ", but it kind of doesn't work if litterally had entered it and this is a ultra fine way around
}
else StatPush("3")
}
~+SC004::{
RecordHotkey("reset")
StatPush("3")
}
~SC005::{
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false){
History := RecordHotkey()
if(History.prior = "~SC004"){ ; ""'" does... things, similarly to '"
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("'")
}
else StatPush("4")
}
~+SC005::{
RecordHotkey("reset")
StatPush("4")
}
~SC006::{
RecordHotkey("reset")
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush("(")
else StatPush("5")
}
~+SC006::{
RecordHotkey("reset")
StatPush("5")
}
~SC007::{
RecordHotkey("reset")
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush("-")
else StatPush("6")
}
~+SC007::{
RecordHotkey("reset")
StatPush("6")
}
~SC008::{
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush("è")
else StatPush("7")
}
~+SC008::{
RecordHotkey("reset")
StatPush("7")
}
~SC009::{
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false){
History := RecordHotkey()
if(History.prior = "~SC009"){ ; "__" does →
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("_")
}
else StatPush("8")
}
~+SC009::{
RecordHotkey("reset")
StatPush("8")
}
~SC00A::{
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false){
History := RecordHotkey()
if(History.prior = "~SC00A"){ ; "çç" does "« "
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("ç")
}
else StatPush("9")
}
~+SC00A::{
RecordHotkey("reset")
StatPush("9")
}
~SC00B::{
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false){
History := RecordHotkey()
if(History.prior = "~SC00B"){ ; "àà" does " »"
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("à")
}
else StatPush("0")
}
~+SC00B::{
RecordHotkey("reset")
StatPush("0")
}
~SC00C::{
RecordHotkey("reset")
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush(")")
else StatPush("°")
}
~+SC00C::{
RecordHotkey("reset")
StatPush("°")
}
~SC00D::{
RecordHotkey("reset")
Cpsl := GetKeyState("CapsLock","T")
if(Cpsl = false)
StatPush("=")
else StatPush("+")
}
~+SC00D::{
RecordHotkey("reset")
StatPush("+")
}
~SC029::{
History := RecordHotkey()
if(History.prior = "~SC029"){ ;"²²" does ´e
StatPush("Pop")
RecordHotkey("reset")
}
else StatPush("²")
}
~LButton::{
RecordHotkey("reset")
}
~RButton::{
RecordHotkey("reset")
}
RecordHotkey(hk := A_ThisHotkey) {
static current := "", prior := ""
if (hk = "reset") {
prior := ""
current := ""
}
else if (hk != "") {
prior := current
current := hk
}
return { current: current, prior: prior}
}
;to test history
/*SetTimer(TestHistory, 100)
TestHistory() {
History := RecordHotkey("")
h := "current:" History.current " prior:" History.prior
ToolTip h
}*/
;to easily get scan codes
/*SetTimer(ShowSC, 100)
ShowSC() {
ScanCode := Format("SC{:X}", GetKeySC(A_PriorKey))
ToolTip ScanCode
}*/
StatPush(c){
static stat := []
if(c = "Pop")
stat.Pop()
else if(c != "0")
stat.Push([c])
return stat
}
/*SetTimer(ShowArray, 100) ;to test your live inputs, I know this representations has mistakes (for hotstrings I wanted to remove) for reasons I don't want to know and fix, but it's mostly accurate
ShowArray(){
stat := StatPush("0")
static i := 1
static test := ""
;count := Counter(1)
while(stat.Has(i) != 0)
;while(i <= count)
{
test := test . " " . stat.Get(i)[1]
i := i + 1
}
ToolTip test
}*/
ArrayString(){
stat := StatPush("0")
test := ""
i := 1
while(stat.Has(i) != 0)
{
test := test . " " . stat.Get(i)[1]
i := i + 1
}
return test
}
OnExit Save
Save(ExitReason, ExitCode){
CurrentDate := FormatTime(, "dd-MM-yyyy")
hour := FormatTime(, "HH") ; Get current time at the end of the script
min := FormatTime(, "mm")
sec := FormatTime(, "ss")
IniWrite(ArrayString() " /date:" CurrentDate " start:" starthour " end:" hour "h" min "m" sec "s", iniFile, "Stats", "Inputs" Counter,)
IniWrite(Counter, iniFile, "ScriptReloads", "Count")
}r/AutoHotkey • u/Worth_Monitor8251 • 9d ago
This probably has been asked numerous times already, but I cannot find a solution that works on my side, so that's why I'm asking here directly. What did I do wrong with this cause im relatively new to AutoHotkey, I'm just using it for keybinds to make my life easier; everything seems to work except the Shift key. Any help would be appreciated :DD
#HotIf WinActive
Numpad1:: Ctrl
Numpad2:: Alt
Numpad3:: Shift
Numpad4:: i
Numpad5:: o
Numpad6:: d
Numpad7:: ^+x
Numpad8:: ^b
Numpad9:: ^+v
NumpadAdd:: ^+
NumpadDiv:: ^z
NumpadDot:: +Space
NumpadEnter::Space
NumpadMult::^+z
NumpadSub:: ^-
#HotIfr/AutoHotkey • u/AnthonyJames696 • 10d ago
I'm currently working on translating my v1 master script to v2. In V1 I had this:
^#!e::
DetectHiddenWindows, On
SetTitleMatchMode, RegEx
WinGet, ahkWindows, List, ahk_class ^AutoHotkey$,, i)Keyboard Fixes.ahk
Loop % ahkWindows
WinKill, % "ahk_id " . ahkWindows%A_Index%
returnwhich killed v1 as well as v2 scripts. For the v2 version, I frankensteined this together:
^#!e::
{
DetectHiddenWindows(true)
SetTitleMatchMode("RegEx")
ahkWindows := WinGetList("ahk_class ^AutoHotkey$",, "i)Keyboard Fixes.ahk")
for hwnd in ahkWindows
WinKill("ahk_id " hwnd)
}But this only kills v2 scripts and leaves the v1 ones running, and I can't figure out why. Especially considering that if I swap WinKill for MsgBox, I get the ID for the v1 scripts as well, so it can't be a problem with the list. I'm super new to v2 and I've been trying to find smth useful online and on the "handbook" on their website, but I'm at my wit's end. Please help me TwT
r/AutoHotkey • u/Relevant-Explorer267 • 11d ago
Hi everyone
I've been using an AHK (V2) Script to remap my keyboard to Colemak for the last few months and today I tried reverting back to qwerty because I'm using a qwerty keyboard. I wanted to stop the script but it's not appearing in my taskbar where it usually did. I tried uninstalling AHK altogether and deleting all the files related to it, and I checked in Windows settings but it says it's set to qwerty. I don't really know where else to look, since I assumed that deleting AHK would stop the script. Any help would be appreciated.
Windows 10 Pro build 19045.6466
(this is my first time posting here, sorry if I didn't include any important info)
EDIT: I fixed it by running '/i386/Clear remapping.reg' in the colemak windows package
r/AutoHotkey • u/arapplepie • 11d ago
I am new to AutoHotkey (just joined a hour ago) and ive been trying to replace two hyphens with a em-dash, Ive tried every code i could find and tried every video explaining the scripts but i cant seem to find one that will work. I dont know if i am running the script wrong or if all the scripts i tried were wrong—one of the scripts i used were :*?:--::— and ive gotten to the point where i know how to open the notes for the script. please help cause all i want is my em-dash ):
r/AutoHotkey • u/staaandup • 12d ago
i made this little color picker in ahk v1 as a local replacement for the rapidtables RGB color picker, and i also added a pick-from-screen feature. everything seems to work fine, but there's one weird visual issue i can't figure out: there's what looks like a single stray pixel on the left edge of the saturation/value box, roughly 15 pixels below the top, and i'm not even sure if it's actually sticking out or replacing the pixel that's supposed to be there. the weird part is that when i move the selection circle over that exact spot, the preview picks up the color of that pixel, while the hex value says "#F0F0F0", which is what that pixel is supposed to be according to the gradient, so the displayed pixel seems to have a different color from the actual color calculated by the picker. i've already tried asking AI to figure it out, but haven't managed to get a proper explanation or fix. the whole thing is also mostly vibe-coded, so that makes it even harder for me to figure out what's actually causing the problem
r/AutoHotkey • u/cs_cast_away_boi • 12d ago
I didn't know what flair to use because this isn't really an autohotkey script but rather a Windows application I made for Autohotkey.
Here is the screenshot of what it looks like.
Onto the post...
I write a lot of AHK v1 in CodeQuickTester and got tired of alt-tabbing to the help file and digging through old scripts. So I built a small tray native Windows app in C# that sits beside it. It's only active while CodeQuickTester is the active window and does nothing anywhere else. No AI, no network. Everything it inserts is always valid v1.
Honestly, in the age of AI, one is often tempted to just have it do everything. But there is a still a need for handwritten AHK because often you have to do things like a macro script where you're switching windows and clicking on certain controls within windows or moving windows to where you want them, etc. This tool easily lets you do that with integrated window/click detection by hotkey. No more pulling up windowspy or a million different tools. You literally aim your mouse at the highlighted region and it sends the exact AHK you need into CodeQuickTester! But that's not all, it has all autocomplete and docs lookup and even code snippets/search across all your scripts. It's fucken' awesome for V1. I optimized it for CodeQuickTester because it became my default editor since I always just want to test scripts without saving them first.
The tech stack is: C# / .NET / WPF.
NOTE: I shared it because i'm not sure how many people use V1/GeekDude's CodeQuickTester. I may consider making it open source so everyone who needs it can use it on their own scripts/setup.
Here is an AI summary of its main features.
✍️ Writing
🎯 Pickers that write the Press a hotkey and click something on screen to get ready-to-run v1 code:
📚 Docs without leaving the editor
🧠 Your own scripts as a knowledge base
🧩 Recipes with Tab stops
🩺 Nudges A background linter for common v1 mistakes:
Most nudges have a one-key fix (one undo step), and you can add your own regex rules.
🗂️ Docked card workspace
r/AutoHotkey • u/Aromatic-Finding-797 • 14d ago
Hey everyone,
I built an AHK v2 script that reads a text file and types it out into VS Code (or any focused editor) like a real human would. Standard paste macros look way too robotic for UI demos and testing, so I wanted something that actually looks like someone sitting at the keyboard.(its not perfect I'd appreciate feedback)
What it does:
.txt file and types it out using hotkeys (F6 to start, F7 pause, Esc to emergency kill).Everything is configured in a single SimConfig class at the top of the script..(You can watch the short gif on the github page b4 installing to see if youd be interested)
GitHub Repo: https://github.com/Mwakio-empire/ahk-typing-simulator
Would love some feedback on the timing engine or if anyone has ideas for making the typo-correction logic feel even more natural.
r/AutoHotkey • u/Swimming-Ice-655 • 14d ago
Hey guys,
I would have posted this in the AHK forum but I haven't been able to get an activation email for my account yet. I have average skills in AHK to make basic QoL shortcuts. I use OBS Studio which allows me to have overlays over gameplay footage (known as scenes), and each can be swapped via in-app shortcuts. Unfortunately there is no cycle feature baked into the software to save on remembering and wasting shortcut space on my keyboard. An example of an OBS short would be ctrl+shift+alt+q = Scene #1.
So I thought why can't I make a super shortcut that can work with one key press and each input is a different shortcut from OBS ( then it would cycle back to the first shortcut). I interpret this as the following (not actual code but follows examples of what I've seen online):
^!m::
{
key++
(list of shortcuts from OBS i.e. ^+!{e}, ^+!{f})
if key press = 1
{
Send "^+!{e}"
}
else if key press = 2
{
Send "^+!{f}"
}
}
I can visualize this but this follows from what I've seen as AHK V1 syntax so it doesn't work I've seen v2 examples using static values but I don't understand. If anyone can point me in the right direction I'd greatly appreciate it!
r/AutoHotkey • u/yellow90 • 15d ago
I'm a relatively new user of AutoHotKeys, and I’m trying to solve the same problem described here (link for reference, as it gives a clearer starting point). However, the solution in the link didn't work, as I'm using AHK v2. Script for AHK v1:
F1::
IfWinActive, ahk_class MultitaskingViewFrame
MsgBox, windows is in task view mod ; [sic]
returnEdit: Seems like ahk_class can also be: "Windows.UI.Core.CoreWindow". Can anyone confirm/unconfirm?
I have “show desktop” (a built-in function in Windows 11) assigned to an advanced gesture for when I swipe down on the touchpad. When I swipe up, task view opens. A downward swipe while task view is active closes task view and restores the last window I had open. I'd like to keep this behavior.
The challenge is that I have a widget on my desktop that also minimizes when “show desktop” or Win+D is triggered, so I want to set Win+M (or anything else that replicates the same action) as a custom shortcut under advanced gestures because it shows the desktop while leaving the widget on the desktop.
The problem is that when I set Win+M as a custom shortcut, it doesn’t take into account that task view is active. Because of this, I want to create a script that checks whether task view is active and only triggers Win+M (or other similar shortcuts) when it isn't.
TL;DR:
I'd like to create a script that implements the following two-step behavior while task view is active (when using advanced gesture on touchpad):
I have two questions:
r/AutoHotkey • u/MadFurai • 18d ago
I'm new to AHK, but not scripting. From everything I've found in my searches, global variables should work across multiple scripts. I have several variables that will change frequently that I need to reference from multiple scripts. Below is a snippet of my code. The error is popping from script2.ahk and it's claiming BaseSpeed has never been assigned a value. Please help, thanks!
;script1.ahk runs first with this
#Include functions.ahk
global AdjSpeed := .00 ; this is what changes
global BaseSpeed := Round(28, 2) ; this never changes
RunWait "script2.ahk"
;script2.ahk contains this
#Include functions.ahk
global AdjSpeed
global BaseSpeed
CheckAdjSpeed
;script with all my functions has this:
CheckAdjSpeed()
{
global BaseSpeed
global AdjSpeed
If (BaseSpeed > 28) {
AdjSpeed := Round(((1 + (BaseSpeed - 28)) / 28), 2)
}
If (BaseSpeed == 28) {
AdjSpeed := .00
}
If (BaseSpeed < 28) {
AdjSpeed := Round(((1 - (BaseSpeed - 28)) / 28), 2)
}
}