r/AutoHotkey 55m ago

General Question what are some practical uses for auto hotkey

Upvotes

so far the only things i've made is whenever type dih it'll make an ACSII drawing of a penis and some hot keys so that i can type out ±,√,≥, and ≤. I want to code something more complicated and more practical, like a calculator, but thats prolly far to difficult for me, do yall have any ideas?


r/AutoHotkey 5h ago

v2 Script Help Trying to use A_PriorPriorHotKey

0 Upvotes

Hi, this is just a little post to say I've been trying to implement "A_PriorPriorHotKey" in AutoHotKey.

If you don't know what "A_PriorHotKey" is, it's just a variable that contains the last HotKey you pressed.

And... I'm sorry if I make mistakes btw, I really don't want to get called out for this again, AutoHotKey is an extremely massive language to a point where people that have used it for 20 years probably could still discover new things about it, so... if I'm not wrong, "A_PriorPriorHotKey", a variable that would contain the second to last HotKey you pressed, is not implemented by default, but I did find a way to implement it.

I don't have the code on this computer and I figured it would be fine if I don't add it in this post, if you want to use it yourself I can give it, but I don't think I need to give it so people can help me do the fix I want to do, hopefully... just know the one thing it doesn't do is that it doesn't store the HotKey if it's the same as A_PriorHotKey, so A_PriorPriorHotKey and A_PriorHotKey are never equal once they start to contain things, and we can say that APPHK contains the second to last HotKey you pressed, but not counting duplicates.

However, it has an annoying thing: to make it work, I used a "SetTimer", which can call a function at a wanted interval, but SetTimer still needs an interval; it can't be every 0s seconds, and so, that means there is a slight delay between the moment the HotKey is pressed and the moment APPHK updates.

And so, let's say I want to do something if I press a, b then c, when I press a, it doesn't get updated yet (that's how A_PriorHotKey works, it waits for the next HotKey to store something), when I press b, APHK gets updated to "a", but when I press c, let's say I wrote a line in the code that checks the value of APHK and APPHK (if (A_PriorHotKey = "b" && A_PriorPriorHotKey = "c")), it won't work, because it will check both variables, see that APHK = "b" and APPHK = whatever, because of this slight delay, let's say SetTimer is set to 10ms, the code will check instantly, and only 10ms APPHK will be set to "a" but it's too late.

Now APPHK can still be used, you can simply add a "Sleep" so that the code does check APPHK after it was updated, but that's still annoying, so, is there a way for APPHK to be instantly updated? I mean, APHK is instantly updated, or at least it gives the feeling it is, wouldn't be surprised if there is a trick with APHK and it's technically not instant, but is there a way to make APPHK work the same?


r/AutoHotkey 1d ago

v2 Tool / Script Share Sharing my AutoHotkey project

22 Upvotes

Put together this AutoHotkey service that works from hotkeys and shortcuts registered in config.json file

It adds a bunch of features around Caps lock as the modifer key and it includes Direct window switching, Window aware shortcut remapping, Screenshot capture, Terminal launching, Profiles , and other such utilities as actions

GitHub Repo Link

Download : Releases

There are two versions one that includes the Full GUI to set everything in the config file other one is minimal which dosen't have GUI. There are no other differences feature wise

Do read Installation instructions and config format for the minimal version

Many of the stuff i had this when i started with AutHotkey, different scripts for each stuff so put together so it runs as a single process and made load things from config.

Had the idea to make it more general and having an UI for general feature like Caps as modifer keys and others.

So I built it the GUI to set the config, manage the service, record shortcuts with UI

I use it mostly use it for avoiding Alt + Tab cycling and kepping my hands either both hands on keyboard or one on mouse and other on keyboard

You can assign things like Caps + LeftButton as Enter, Caps + RightButton as Delete or other shortcuts to avoid moving hand between keyboard and mouse often

For Window Switching it uses Caps + {Key} to bring target window to focus if it exists or can launch a new instance.
You can filter by window title and supports a minimal Alt + Tab styled behavior if there are multiple target windows

E.g. Caps + C = chrome.exe windows. If multiple windows it will show each windows title, u can do like Caps + C + C to switch between those. If there is just one window it will instantly focus it

U can avoid having multiple targets by using title filter. You can add required title as Gmail or GitHub so intances with only those tabs match

If the window is not open run a command to open it.
For Example I have mapped Caps + I to open incognito window regardless of where i am

The ScreenShot tool is so you press a key and instantly name the screenshot save it in a custom location or discard it in a single go.

Hope this gives a idea of some usecases. There are similar other features and actions

Check the Readme for all features

Feedback is welcome!


r/AutoHotkey 17h ago

v2 Script Help How do I make a macro with 2 different toggles for fortnite?

0 Upvotes

I want an AutoClicker that Enables when I press "1" and Disable when I press "F" but it only clicks when I hold Left Click.

Also it does need to have a random offset due fortnite's eac detection.


r/AutoHotkey 1d ago

v1 Script Help Autoclick for me on my second monitor

0 Upvotes

Is there a script for ROBLOX where I can auto click in the game while playing another game on my second monitor? Im new to these stuff


r/AutoHotkey 1d ago

v1 Script Help Capitalizing for Title Case with Hyphen

1 Upvotes

Hi, everyone. Does anybody know how to title case or capitalize words with hyphens?

"StringUpper Clipboard, Clipboard, T" only capitalizes the first word, but not the second one.

hindu-buddhist
to
Hindu-Buddhist?


r/AutoHotkey 3d ago

v1 Tool / Script Share For those like me who don't want to put up with Corsair's iCUE, just to reassign the G-Keys, I wrote a simple AutoHotkey script to reassign G-Keys. No iCUE, only AutoHotkey v1. Simply copy-paste the test below in the script and launch it. Pls note that I have K55 Pro.

5 Upvotes

; ==========================================================

; Corsair K55 RGB Pro G-Keys

; AutoHotkey v1

; ==========================================================

\#NoEnv

\#SingleInstance Force

SendMode Input

SetWorkingDir %A_ScriptDir%

\^+1::

Run, C:\\Windows\\System32\\SnippingTool.exe

return

\^+2::

Run, C:\\Windows\\System32\\SnippingTool.exe

return

\^+3::

Run, C:\\Windows\\System32\\SnippingTool.exe

return

\^+4::

Run, C:\\Windows\\System32\\SnippingTool.exe

return

\^+5::

Run, C:\\Windows\\System32\\SnippingTool.exe

return

\^+6::

Run, C:\\Windows\\System32\\SnippingTool.exe

return


r/AutoHotkey 5d ago

v2 Script Help Setting up a script to simulate repeated LMB clicks to left alt?

3 Upvotes

I'd like to have left mouse click bound to left alt, but when holding down left alt it registers as repeated fast left clicks. I downloaded AutoHotkey and I'm quite confused

How would I set this up?


r/AutoHotkey 6d ago

Resource Hidmacro website

3 Upvotes

I've been looking for a website to download hidmacro for a while now, but the site is offline. I was going to use an old keyboard as a StreamDeck; if anyone has a source for hidmacro, please help me.

The website says it no longer has a domain...


r/AutoHotkey 8d ago

v1 Script Help Need help: Remap F to Alt+Right Click, use LeftClick to exit

3 Upvotes

Hi there,

I'm not a coder but I've been trying to make a pretty simple script. I know why it's not working but can't figure out the solution.

Here is the functionality I need :

  1. When the F key is pressed, send Alt + HOLD Click R Down.

  2. Then when I click the Left Mouse Button, Send Right Click Up

Left Click needs to otherwise work normally outside the script. The problem I'm running into is that I don't know how to nest the Left Click remap conditionally inside the hotkeyed state of the Alt + Click R Down.

Here's what I have currently, which obviously doesn't work because it keeps the Left Click mapped permanently...

F::Send !{Click R Down}
LButton:: Send {Click R Up}
Return

Anyway, I'd really appreciate any help! I'm using v1 because I find the documentation easier to understand, but if needed I can switch to v2.


r/AutoHotkey 10d ago

v2 Script Help Sticky shift, alt, ctrl to 1,2,3,4,5,6

1 Upvotes

Hello, I am seeking advise and I am sure some of you might have the competence :

I am trying to do a simple thing, I have my modifiers shift, ctrl, alt, I want them to be sticky and just tapped, and paired with their corresponding values 1,2,3,4,5,6

My goal is to press shift (not hold) and then pair it with a number. Same for alt and ctrl

This is for keybinds in a game for context.

It’s a simple operation, but i can’t make it work. If you can send me the script I would sincerely appreciate it🙏🏻 thank you


r/AutoHotkey 11d ago

General Question Recommendation from the professionals?

6 Upvotes

I accidentally stumbled upon this sub, thinking it was a place to download apps that can automate hotkeys for you. Turns out this is a scripting sub, sorry, but I also learned you guys are professionals in making macros and such. Any recommendations for auto hotkeys that I can use?


r/AutoHotkey 12d ago

v1 Script Help FileGetShortcut suddenly stopped working Windows 11

4 Upvotes

Has anyone else run into the issue of FileGetShortcut suddenly no longer working in Windows 11? I'm using Version 25H2 (OS Build 2620.8655). With the latest update, shortcuts now look different in windows explorer and FileGetShortcut no longer propogates the ShortcutTarget.

Here is the script that worked for years:

;### <CNTRL><SHIFT>+J - autojump like menu, adds everything in \favorites\ into the menu
^+J::
FavoriteShortcuts := ""
Menu, ShortcutMenu, Add
Menu, ShortcutMenu, DeleteAll
FileList := ""
Loop, Files, C:\Users\user\Favorites\*.lnk
FileList .= A_LoopFileName "`n"
Sort, FileList
Loop, parse, FileList, `n
{
if (A_LoopField = "") ; Ignore the blank item at the end of the list.
continue
ShortcutTarget := ""
FileGetShortcut, C:\Users\user\Favorites\%A_LoopField%, ShortcutTarget
Handler := Func("MenuWindowsHandler").Bind(ShortcutTarget, 0)
Menu, ShortcutMenu, Add, %A_LoopField%, % Handler
}
Menu ShortcutMenu, show
return

Now ShortcutTarget is always empty. Cntrl+Shift+J still returns a list of all the items in /favorites/ I just can't get FileGetShortcut to do its job! Hopefully I'm missing something. Thanks folks.


r/AutoHotkey 11d ago

v1 Script Help Is there a way to make an ahk script that can interact with something like turbowarp?

1 Upvotes

r/AutoHotkey 12d ago

v2 Script Help Help with auto sprint macro

4 Upvotes

Last post was taken down for low effort so I'm gonna try to include more detail.

I'm starting to lose my feelings in the tips of my fingers because of chemotherapy and so I find it a lot harder to sprint in games efficiently. I've searched for a macro to sprint for me without the need to keep double tapping w for a while to no luck so I tried making one but I am no good at making scripts.

The macro essentially is to just double tap W whenever I start holding it, and the second press should keep the input going for as long as I have the key pressed.

I want it to work like the minecraft auto sprint feature where walking is just replaced by sprinting.

This is what I have so far and it double taps w just fine but it won't hold the input, I just get 2 w presses in quick succession then nothing, I'm not sure how to get it to hold. (sorry if format for code is wrong)

#Requires AutoHotkey v2.0
*w::
{
    Send "{w down}"
    Sleep 50
    Send "{w up}"
    Sleep 50
    Send "{w down}"
    KeyWait "w"
    Send "{w up}"
}

r/AutoHotkey 12d ago

v1 Script Help Is a Desktop Camera Possible?

7 Upvotes

Is it possible to move everything on the desktop, or at least make an illusion of that


r/AutoHotkey 15d ago

v2 Script Help Tweaking FFXIV script

2 Upvotes

So currently I'm using this script so I can easily acess my hotbars while doing my rotation and it works great, the issue is now I cant use Q or E to type messages with. Is there any way to make it so I can type when just tapping the key and then Q and E only work as Lctrl and Lshift when I'm holding them down?

#Requires AutoHotkey 2.0

#SingleInstance

#HotIf WinActive("ahk_exe ffxiv_dx11.exe")

q::LShift

e::LControl

#HotIf


r/AutoHotkey 16d ago

v1 Script Help I need help with a script

5 Upvotes

My f2 key is broken, and I want it to run when I press my f9 key. I just downloaded this today, and don't really know anything about coding, or this application yet.

I've so far only tried 3 different ones:

F9::{

Send "{F2}"

}

F9::F2

F9::Send "{F2}"


r/AutoHotkey 16d ago

General Question Looking for the fastest way to detect and erase forbidden words from any editable text field on Windows

3 Upvotes

I'm building a Windows application (AutoHotkey, C++, or any other language if necessary) that acts as a system-wide text filter.

The goal is very specific:

  • Monitor editable text fields across Windows applications.
  • Detect a configurable list of forbidden words or phrases.
  • As soon as one of those words exists in the field, erase the entire contents immediately.

The application is intended to work in programs like:

  • OBS
  • Android emulators
  • Notepad
  • Browsers
  • Other standard editable controls

The important requirement is speed.

A simple polling loop (every 10–100 ms) is not sufficient because a user can sometimes type a forbidden word and press Enter or click a Search button before the next poll runs.

Ideally, the solution should react immediately after the text changes, with the smallest possible delay.

Additional requirements:

  • Run completely in the background (no UI).
  • Detect words regardless of how they appear:
    • typing
    • paste
    • drag & drop
    • autocomplete
    • undo/redo
  • Read the full contents of the field rather than reconstructing keystrokes.
  • If a forbidden word is detected, erase the entire field.
  • Also prevent copying forbidden words to the clipboard and prevent pasting them if possible.

I already experimented with Microsoft UI Automation (UIA), reading the focused control's TextPattern / ValuePattern, and it works surprisingly well—even in OBS and Android emulators. The problem is that polling is still fast enough to miss very quick actions.

My question is:

What is the lowest-latency architecture for something like this on Windows?

Would you use:

  • UI Automation events?
  • WinEvent hooks?
  • Accessibility APIs?
  • CBT/WH_CALLWNDPROC hooks?
  • Text Services Framework (TSF)?
  • A keyboard filter driver?
  • Something else entirely?

I'm interested in approaches that minimize the time between a text change and detection, while remaining compatible with as many applications as possible.

Any suggestions or examples would be greatly appreciated.


r/AutoHotkey 18d ago

v1 Script Help Spamming right click with a modifier key.

1 Upvotes

I am trying to write what I thought was a very simple script.

While holding down backtick, ` i.e., vkC0, I want it to keep CTRL held down and spam right click. However, I always run into problems where either CTRL gets stuck held down, or the script keeps spamming after letting go of the key.

I have tried so many common variants using GetKeyState or keywait, but nothing seems to help.

One suggestion was to use this pattern:

~a::
    tooltip A PRESSED
    return

~a up::
    tooltip A RELEASED
    return

instead, but that still doesn't seem to work.

I've similarly found a comment that suggested this is the best pattern:

a::
    if (a_pressed)
        return
    a_pressed := 1
    ; [...]
    return

a up::
    a_pressed := 0
    return

but it doesn't work for me either. This is a sample attempt in (which isn't ideal because I would prefer CTRL be held down the whole time I hold backtick down).

vkC0_pressed := 0

*vkC0::
    if (vkC0_pressed)
        return

    vkC0_pressed := 1
    SetTimer, SendRightClick, 50
return

*vkC0 up::
    SetTimer, SendRightClick, Off
    vkC0_pressed := 0
return

SendRightClick:
    SendInput ^{RButton}
return

There are other attempts, but I have so many failed attempts that I have completely lost track at this point. I have tried numerous variations of this in v1 and in v2, but I would prefer a v2 solution.


r/AutoHotkey 19d ago

v2 Script Help Im new and very bad at coding can anyone help write a code in ahk to remap the arrow keys to wasd while a certain program is open?

0 Upvotes

One of my friends helped me do this with undertale a couple years ago and it looked really simple but i cant really figure out how to make it myself now that im playing deltarune could anyone please help


r/AutoHotkey 19d ago

v2 Script Help #IfWinActive active window name

3 Upvotes

i'm pretty new to this and i wanted to ask some question since i only find error in 30min, i want to make it so that i can use my right click work just like my left click on certain window.

#Requires AutoHotkey v2.0

#IfWinActive, MSI App Player
RButton::LButton
#IfWinActive

it's pretty much copy pasted from other reddit post, i only changed the window name but not sure if it's correct. so i open window spy and i got this for the windows title, class and process:

MSI App Player
ahk_class Qt672QWindowIcon
ahk_exe HD-Player.exe
ahk_pid 11828
ahk_id 331062

so can someone points out what's my mistake is and how to fix it?

thanks in advance


r/AutoHotkey 21d ago

Meta / Discussion Am I the only one who feels this way?

11 Upvotes
send "Hello world." ; informal (tú)
Send("Hello world.") ; formal (usted)

r/AutoHotkey 20d ago

v2 Tool / Script Share Aseprite, Godot AND, Blender with a profile swap on the X15 mouse

0 Upvotes

#Requires AutoHotkey v2.0

; --- CODE ENGINES & ALIASES ---

S(keys) => Send(keys)

; Universal Hold Engine: Handles the down/up locking logic for any keys cleanly

Hold(physicalKey, keysToSend*) {

for key in keysToSend {

Send("{" key " Down}")

}

KeyWait(physicalKey)

for key in keysToSend {

Send("{" key " Up}")

}

}

; =========================================================================

; COLOR PROFILE CONFIGURATION

; =========================================================================

global ActiveProfile := 1

global MyCustomToolTip := Gui("-Caption +AlwaysOnTop +ToolWindow")

MyCustomToolTip.BackColor := "000000"

MyCustomToolTip.SetFont("cFFD700 s10 Bold", "Segoe UI")

global ToolTipText := MyCustomToolTip.Add("Text", , "Profile 1: Modeling (#FF0000)")

; =========================================================================

; BLENDER INTERFACES & SUB-PROFILES

; =========================================================================

#HotIf WinActive("ahk_exe blender.exe")

F24:: {

global ActiveProfile

ActiveProfile := ActiveProfile + 1

if (ActiveProfile > 3) {

ActiveProfile := 1

}

message := ""

if (ActiveProfile == 1)

message := " Profile 1: Modeling (#FF0000) "

else if (ActiveProfile == 2)

message := " Profile 2: Animation (#00FF00) "

else if (ActiveProfile == 3)

message := " Profile 3: Texturing (#0000FF) "

ToolTipText.Value := message

MyCustomToolTip.Show("X20 Y20 NoActivate")

SetTimer(() => MyCustomToolTip.Hide(), -2000)

}

; --- BLENDER PROFILE 1 (MODELING) ---

#HotIf WinActive("ahk_exe blender.exe") and (ActiveProfile == 1)

F13::S("e") ; [Button 1] Extrude

F14::S("{WheelUp}") ; [Button 2]

F15::S("{WheelDown}") ; [Button 3]

F18::S("^r") ; [Button 6] Loop Cut

F19::Tab ; [Button 7] Native Tab Hold

; --- BLENDER PROFILE 2 (ANIMATION) ---

#HotIf WinActive("ahk_exe blender.exe") and (ActiveProfile == 2)

F13::S("i") ; [Button 1] Insert Keyframe

F14::S("!a") ; [Button 2] Play/Pause

; --- BLENDER PROFILE 3 (TEXTURE PAINT) ---

#HotIf WinActive("ahk_exe blender.exe") and (ActiveProfile == 3)

F13::S("s") ; [Button 1] Sample Color

F14::S("x") ; [Button 2] Swap Colors

; =========================================================================

; GODOT ENGINE PROFILE

; =========================================================================

#HotIf WinActive("ahk_exe Godot_v4.x-stable_win64.exe")

F13::S("^s") ; [Button 1] Save Scene

F14::S("{F5}") ; [Button 2] Run Project

; =========================================================================

; ASEPRITE PROFILE

; =========================================================================

#HotIf WinActive("ahk_exe Aseprite.exe")

F13::Hold("F13", "Alt", "Left") ; [Button 1] Clean Hold for Alt+Left!

F14::S("{WheelUp}") ; [Button 2]

F15::S("{WheelDown}") ; [Button 3]

F16::S("{Enter}") ; [Button 4]

F17::S("b") ; [Button 5] Brush Tool

F18::S("e") ; [Button 6] Eraser Tool

F19::S("{<}") ; [Button 7]

F20::S("{>}") ; [Button 8]

F21::S("9") ; [Button 9]

F22::S("0") ; [Button 10]

F23::Ctrl ; [Button 11] Native Control Hold

; =========================================================================

; GLOBAL KILL SWITCH

; =========================================================================

#HotIf

^+Esc::ExitApp


r/AutoHotkey 21d ago

v1 Script Help How to skip ahead in a long script with hotkeys?

2 Upvotes

I have recorded this very long script with Feiyue's macro recorder to autofarm a game. I have noticed that sometimes the script fails due to latency or other issues. I want to add hotkeys where I can skip ahead to certain parts of the script so it can continue autofarming past areas it already completed.

I have tried Goto with labels, but get this error message "A Goto/Gosub must not jump into a block that doesn't enclose it".

Is there an easy way to implement this without having to change my script into alot of functions? Or perhaps I need to separate all the regions into their own functions, and call them in the main loop.

Really appreciate any feedback. Thanks.

This is a gist of my script so far

Playspeed:=1 

Loop, 1
{
SetTitleMatchMode, 2
CoordMode, Mouse, Window

tt = ahk_exe Game.exe
      WinWait, %tt%
      IfWinNotActive, %tt%,, WinActivate, %tt%

RegionOneLabel:
; very long sequence for region one

RegionTwoLabel:
; very long sequence for region two

RegionThreeLabel:
; very long sequence for region three

Sleep, % 10000
Run taskkill.exe /f /im "Game.exe"
ExitApp
}

F5::
   Goto, RegionOneLabel
return

F6::
   Goto, RegionTwoLabel
return

F7::
   Goto, RegionThreeLabel
return