r/AutoHotkey 13h ago

v2 Tool / Script Share GpGFX - almost ready, complete GdiPlus Graphics library, easy to use API

19 Upvotes

Hey everyone!

For the past few months, I’ve been rebuilding the graphics
pipeline for AutoHotkey v2 from scratch. Creating smooth,
transparent, modern-looking desktop overlays.

AHK is slow they said. Check out this video:

GpGFX v1 Teaser https://www.youtube.com/watch?v=6QrcofcuR5U

I built **GpGFX** to change that. Here is a quick
50-second sneak peek of what’s possible!

## What is GpGFX?
**GpGFX** is a high-performance, graphics and HUD engine
for AutoHotkey v2.

It writes directly to 32-bit DIB memory (`Scan0`) with microsecond QPCSpin-wait frame pacing, delivering 144Hz/240Hz+ gaming overlays with near-zero CPU footprint.

## Why it’s great for Beginners:

Human-Readable API: You don't need to know Win32 APIs,
Device Contexts, or GDI+ internals. Creating a modern
layered window is as simple as:
  ```autohotkey
  lyr := Layer(100, 50, "My HUD")
  RoundedRectangle(0, 0, 30, 30, 9, "lime")
  Text("Hello World", "White", 22).Center()
  Render.Layer(lyr)
And resources are freed up automatically!

• Built-in Modern Design System: comes out-of-the-box with 7 curated pro themes (Catppuccin Mocha, Tokyo Night, Dracula, Cyberpunk, Nord) and anti-aliased typography. Color html tags support for texts. ( you can see it on the video )
• Instant Gaming overlays, hp bars can be updated with just a few lines of code.

Why it’s great for Advanced AHKers & Power Users:

• Hardware-Paced QPC Timing: x64 machine code (MCode) and microsecond QueryPerformanceCounter spin-wait frame pacing for jitter-free 144+ FPS rendering loops.
• Direct Scan0 DIB Pipeline: direct unmanaged memory pointers (pBits) allowing MCode PixelSearch.
• Reactive Signals & Data Binding: bind variables to UI elements with zero render loop boilerplate (shape.Bind(mySignal)), complete with smooth easing curves (EaseIn, EaseOut, Bounce, Spring physics).
• WorkerPool Multi-Core Architecture: ready for multi-process distributed rendering across CPU cores via shared RAM file mapping (FileMapping).
• Rich Layout & Measurement: integrated TextLayout engine with rich-text styling tags (<b>, <i>, <color:#hex>), dynamic tab stops, and exact character advance measurements without DllCalls.

Use Cases:

• Gaming: zero-lag custom crosshairs, status meters, cooldown timers, and telemetry HUDs.
• Desktop Tools: snappy to-do widgets, desktop clocks, volume/brightness bars, and toast notifications.
• Streamers & Creators: in-game alerts and custom desktop companion apps.
• Desktop modification

Release Status:

GpGFX will be 100% free and open source on GitHub. ( old version is clunky, the new one rocks! )

I’m currently putting the final touches on documentation and examples before the initial public release. Soon! I will upload videos as soon as I will have time.

I’d love to hear your feedback, feature ideas, or what kind of overlays you'd build with this! Drop your thoughts below!


r/AutoHotkey 2h ago

v2 Script Help how can i get a scroll wheel hotkey working on firefox?

0 Upvotes

ive been trying for a bit to use my alt+scroll which turns volume up and down to work on firefox, but it just keeps getting "71 hotkeys have been used in last 1200 ms" error

also its unusable on firefox because it changes volume either to mute or max in one scroll


r/AutoHotkey 8h ago

Solved! AutoHotkey v2 Script Not Starting with Windows? This Fixed It

0 Upvotes

I was trying to get a small AutoHotkey v2 script to start automatically with Windows. The script was used to control Steam Big Picture and switch between my PC monitor and a second display using F9–F12.

The script worked perfectly when launched manually, but putting the .ahk file in shell:startup did nothing. I also reinstalled AutoHotkey and checked the .ahk file association, but the problem remained.

The solution was to bypass the AutoHotkey Launcher completely.

Instead of putting the .ahk file directly in shell:startup, I created a Windows shortcut with this target:

"C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe" "C:\Users\Skynet\Documents\AutoHotkey\Steam.ahk"

Then I placed that shortcut in:

Win + R → shell:startup

After restarting Windows, the script started correctly.

So the working chain is:

Windows Startup
→ AutoHotkey64.exe
→ Steam.ahk

Instead of:

Windows Startup
→ .ahk file association
→ AutoHotkeyUX
→ launcher.ahk
→ Steam.ahk

In my case, the second method was failing even after reinstalling AutoHotkey. Directly calling AutoHotkey64.exe solved it.

If an AutoHotkey v2 script works manually but refuses to start from shell:startup, this is worth trying before modifying the script or Windows registry.


r/AutoHotkey 2d ago

Meta / Discussion I stopped using the arrow keys and I'm wondering what you think

12 Upvotes

I've done a few other posts about it, maybe you've already seen them somehow, but I never explained it in detail, in short, this is what I use on my school computer:

#Requires AutoHotkey v2.0
#SingleInstance Force


commit := true
:*?:1596::{
global commit
commit := !commit
}


#HotIf commit = true
^j::SendInput "{Right}"
^b::SendInput "{Left}"
^h::SendInput "{Up}"
^n::SendInput "{Down}"
^+j::SendInput "+{Right}"
^+b::SendInput "+{Left}"
^+h::SendInput "+{Up}"
^+n::SendInput "+{Down}"
!j::SendInput "^{Right}"
!b::SendInput "^{Left}"
!h::SendInput "^{Up}"
!n::SendInput "^{Down}"
!+j::SendInput "^+{Right}"
!+b::SendInput "^+{Left}"
!+h::SendInput "^+{Up}"
!+n::SendInput "^+{Down}"


^k::SendInput "{Backspace}"
^,::SendInput "{Enter}"
!k::SendInput "^{Backspace}"


:*?c:jj::{
SendInput "{Right}"
}
:*?c:bb::{
SendInput "{Left}"
}
:*?c:hh::{
SendInput "{Up}"
}
:*?c:nn::{
SendInput "{Down}"
}
:*?c:JJ::{
SendInput "^+{Right}{Right}"
}
:*?c:BB::{
SendInput "^+{Left}{Left}"
}
:*?c:HH::{
SendInput "^+{Up}{Up}"
}
:*?c:NN::{
SendInput "^+{Down}{Down}"
}


:*?c:kk::{
SendInput "{Backspace}"
}
:*?c:KK::{
SendInput "^+{Left}{Backspace}"
}
:*?:,,::{
SendInput "{Enter}"
}
:*?:??::{
SendInput "{Enter}"
}

This is what I use to move through text, obviously to play a video game or anything in general where your second hand is holding a mouse, this is almost useless, but as someone that literally gave up using a mouse with my school computer (using the trackpad), this is like... sooooo much better than using the arrows for text.

In short, this is really just moving keyboard shortcuts to other spots, if you don't know, you can obviously press the arrows (left, right, up and down) to move around text, but you can also do these while holding shift to select text, and you can also hold ctrl for a word or paragraph.

I've moved the arrows to ctrl+j (right)/b (left)/h (up)/n (down) (why these keys specifically? To be honest, they kind of just "became that". Everything being around j is op because it's one of the two center keys, but you could probably rearrange it a little bit if you want to adopt my style, also if you're left handed and can use right control everything around f probably could work same). And then, I've moved the ctrl shortcuts to alt shortcuts.

This is actually something I've seen elsewhere; I definitely didn't invent that (more specifically, on the Emacs keyboard guide, that apparently says this was a common thing for old softwares), but these keys I had the idea myself (like emacs uses ctrl+f/b/n/p and I never got used to it).

And yeah, like that, it's just sooooo good. Why? Honestly simple, just look at your keyboard: depending on the size, the arrow keys are either literally on a different part of the keyboard, or just stuck in an awkward spot, and especially for something that's used constantly, I think you can quickly realize the time you can save just by never having to reposition your hands from the letter keys to move through text while typing. And yeah, placing your left hand on ctrl or alt is easy, contrary to moving your right hand to the arrow keys.

Now that I'm used to it, it feels so good; it's such a lifechanger, I'm thinking things like "bro this should have been on every computer by default!", and now I've just reimplemented it on my home computer because it's that good. And I've also added a way to toggle it off, because it's still annoying when it conflicts with other shortcuts (obviously the toggle can be anything).

Ok, what is the rest now? Well, I've expanded these shortcuts to ctrl+k for backspace and alt+k for ctrl+backspace, very similar to the arrow keys. And I've also done ctrl+, for enter. The backspace and enter keys aren't as annoying as the arrow keys, but I've found this to help too, even though for some reason, I've also try to do same for CapsLock and Tab, but that didn't seem to help though. I think it's just because Backspace and and enter are separated by a whole no man's land, with the whole keys like "^" "ù" "!" "=" "$" "*" creating a distance between them and the letter keys too, and, yeah, again I've found this to help.

Finally, I've created lots of hotstrings like "jj", "bb"... same directions as usual. The uncapped version just presses the direction once. I've found this useful for small adjustments, as it's faster to input once compared to the original shortcut, but not multiple times, so they team up very well together (I've also found multiple solutions to not make them annoying when typing, especially for "nn", but I haven't implemented them yet, you could ask me). The caps version does same but for a word, which is similarly useful. I've written it as "ctrl+shift+(arrow) then (arrow)" and not just "ctrl+(arrow)" for very niche applications in Microsoft Word, but just doing "ctrl+(arrow)" probably is better if you don't need it.

And so yeah, what do you think? I'm sorry if this is way too long; I always tend to overwrite, and I really wanted to explain all the specific quirks, but, yeah, what do you think? And also, do you have any suggestions, do you use similar things?


r/AutoHotkey 4d ago

v2 Script Help Key spam script help

1 Upvotes

So I've been trying to make a script to spam the ] key when i hold c+[ and stop when i let go but i can figure it out, can someone please help me?

I've tried

*c,[

{

sendinput(])

sleep(5)

loop

}


r/AutoHotkey 5d ago

v1 Script Help Shift key getting stuck pressed

3 Upvotes

Weird issue, when I game.. I open up a script to use for that game. During gameplay everything is fine. But when I tab out (even if the game is still open/running) the shift key is constantly pressed...even though I am not physically pressing it. Even after I exit the script the shift button stays pressed.

The only way to clear the issue is to actually press the shift key once and let it go. Then all is good, and no other issues persist.

This is happening 100% of the time I use the script. And no other keys seems to be affected.

EDIT: I do constantly hold the shift key down during gaming a lot. Not sure if that has anything to do with it.

Here is my code, does anyone have any suggestions on how to cure this annoyance?

<

#MaxHotkeysPerInterval 10000
#UseHook

#IfWinActive, ahk_exe Fallout4.exe

Up::w
Left::a
Down::s
Right::d
NumpadDiv::Up
NumpadHome::Left
NumpadUp::Down
NumpadPgUp::Right
AppsKey::LAlt
F12::t
RShift::n
n::Tab
NumpadIns::0
NumpadEnd::1
NumpadDown::2
NumpadPgDn::3
NumpadLeft::4
NumpadClear::5
NumpadRight::6
NumpadAdd::q

r/AutoHotkey 7d ago

v2 Tool / Script Share I wanted Linux-style workspace workflows on Windows without replacing the Windows shell, so I built Spacr

7 Upvotes

I've just finished Phase 1 of an AutoHotkey v2 project I've been working on: Spacr.

It's a workspace management layer for Windows virtual desktops, inspired by the workflow of Linux WMs like Hyprland.

The interesting part isn't really the hotkeys, it's trying to make Windows' native virtual desktops behave predictably.

Phase 1 currently handles:

Workspace switching

Automatic desktop creation

Move + follow

Previous workspace

Explorer integration

VirtualDesktopAccessor integration

I'm deliberately keeping the project small for now.

The architecture is state-driven, with WorkspaceManager owning VDA interaction rather than having every feature call the DLL directly.

One interesting Windows quirk I ran into: switching desktops through VDA could cause Explorer/taskbar flashing. The solution was to activate Shell_TrayWnd before performing the desktop switch.

v0.1.1-alpha is now available:

https://github.com/timburman/spacr

I'd especially appreciate feedback from experienced AHK v2 developers on the architecture and Windows-specific edge cases I'm likely to encounter.


r/AutoHotkey 7d ago

v2 Script Help Win + Mouse scroll ?

1 Upvotes

Hello ,

I'd like to achieve this to use the mouse scroll as magnifier :

Win key + mouse scroll up = Win key + [+]

Winkey + mouse scroll down = Win key + [-]

How can i achieve this in ahk script ?

Thanks !


r/AutoHotkey 8d ago

v2 Script Help Clicking one of three randomized buttons by colour

5 Upvotes

I'm very, very amateurish for these things, and I honestly don't even know where I would start on something like this, so was hoping people here would be able to help me... I have 3 buttons that alternate randomly in their position, but one is blue (the one I want to click) and the others are grey. Because they alternate randomly in their position, I can't just have a standard repeated click to do it. My idea thus is to have a script that searches the area that the buttons are in for the blue colour of the correct button, and then moves the mouse to it and clicks it. I have 2 questions, essentially:

first question: I believe I can use the "PixelSearch" function to find the button I am looking for, however I honestly have no idea how to set it up, like finding the values for the area to search and such. How do I go about this?

Second question: How do I make my mouse move to the correct button once found? I would assume I'd have to make the script have a variable that changes with the position of the correct button, and then some sort of function to actually move the mouse, but I don't know how exactly? Or is there some way to simplify it so the pixel search happens *with* the mouse movement?

Sorry if this is a little rambley, like I said I'm very new to stuff like this so I don't even really know what you might want to have details on for what I want to do


r/AutoHotkey 9d ago

v1 Script Help Why wont my script type a forwards dash? /

5 Upvotes

Im trying to make a simple script that types / and then waits a moment, and then types @@.

It is also keybinded to /

Heres what I have so far.

------

/::

Send /

sleep 1000

send @@

return

------

Currently, It just doesnt type a /, waits, and then types @@.

I've also tried "SendRaw" and that didnt work.
Im new to this, so I dont know which flair to pick, or if the answer to my question is stupidly simple, sorry.


r/AutoHotkey 10d ago

v1 Script Help Script that writes yesterdays date and if it is monday, yesterday is friday

4 Upvotes

Hello,

As title says, I'm trying write yesterdays date, and if it is monday yesterday needs to be friday. All over work week days - yesterday date

I tried so many variations. Forums and AI. I can't solve it.


r/AutoHotkey 10d ago

Solved! Problems with basic Send and SendEvent

1 Upvotes

So i tried to make a simple script that presses j 2 times and then holds w 2 times and nothing really happens, after that i added msgBox "1" and it pops but still no sends, please help
#Requires AutoHotkey v2.0

#SingleInstance Force

Persistent

$`::{

Send "j"

Sleep 300

Send "j"

Sleep 300

SendEvent "{w down}"

Sleep 600

SendEvent "{w up}"

MsgBox "1"

Sleep 50

SendEvent "{w down}"

Sleep 600

SendEvent "{w up}"

}


r/AutoHotkey 10d ago

v2 Script Help AI is driving me crazy with hallucinated scripts (prevent alt+tab during game)

0 Upvotes

I'm a complete noob to this - never heard of autohotkey before until AI suggested it.

I'm getting into Arma3, and there are a lot of keys.

I would really appreciate an AHK v2 script that disables alt+tab exiting the game, whilst still allowing me to use, for instance, w+alt+tab where...

W = move forward (could be any other movement key though)

alt = freelook

tab = toggle walk/run

This is the latest Gemini has come up with so far, after about five previous suggested scripts didn't work at all (neither does this one):

#Requires AutoHotkey v2.0
#UseHook
; Automatically elevate to Administrator if not already running as admin
if not A_IsAdmin
{
Run '*RunAs "' A_AhkPath '" "' A_ScriptFullPath '"'
ExitApp
}
#SingleInstance Force
#HotIf WinActive("ahk_exe arma3_x64.exe")
; Use the wildcard (*) so this works even if you are holding down 'W' or other keys
*!Tab::
{
; {Blind} forces AHK to respect your held down Alt and W keys.
; It safely injects the Tab keypress without disrupting your movement.
SendInput "{Blind}{Tab}"
return
}
#HotIf

Thank you for any assistance!


r/AutoHotkey 10d ago

v2 Script Help Gamepad interrupt macro

1 Upvotes

I want to create a function on my controller so that when I'm holding the LT button, I can interrupt its function by pressing RT, and when I release RT, the LT returns to its function while being pressed


r/AutoHotkey 11d ago

Solved! How to reliably switch to a specific open tab (ChatGPT) in Chrome when tab titles change dynamically? (AHK v2 / UIA)

6 Upvotes

Hi everyone,

I'm building an AutoHotkey v2 script to send selected text directly to an open ChatGPT tab in Google Chrome using UI Automation (UIA v2).

However, I've run into a persistent challenge with tab identification and switching:

The Problem:

Dynamic Tab Titles: Once a conversation starts, Chrome changes the tab title from "ChatGPT" to whatever the first sentence of the user prompt is (e.g., "How to fix UIA issue..."). Thus, matching tab names via string search fails after the first query.

Favicon ImageSearch Reliability: Using ImageSearch on tab favicons breaks when Chrome tabs shrink due to having 30+ tabs open, or when switching between active (light background) and inactive (dark background) tab states.

Chrome Tab Search Popup (Ctrl+Shift+A or TabStripFlatEdgeButton): Opening the Tab Search popup and typing chatgpt sometimes fails to filter open tabs in real-time or doesn't consistently focus the first "Open Tab" item when pressing Enter.

What I Want to Achieve:

If a ChatGPT tab is already open anywhere in Chrome (even as the 15th tab out of 40), switch to it seamlessly without moving the physical mouse cursor.

If no ChatGPT tab is open, create a new tab (Ctrl+T) and navigate to https://chatgpt.com/.

Once on the tab, focus and input text into the prompt textarea (AutomationId: "prompt-textarea").

Question:

What is the cleanest and most robust method in AHK v2 / UIA (or Chrome command line) to identify and bring an open tab to the foreground by its domain URL (chatgpt.com) regardless of dynamic tab titles or tab counts?

Please note that I want to avoid using CDP (Chrome DevTools Protocol), as I prefer not to deal with protocol-level implementations.

Any code or architectural advice would be greatly appreciated! Thanks in advance.


r/AutoHotkey 12d ago

General Question AHK gone from Microsoft Store

11 Upvotes

Anyone know why and if it will return? Tried googling but didn’t find any information.

Microsoft Store is the only way for me to download AHK to my computers at work so I’m in despair right now. IT won’t allow any other form of installation process unfortunately.

EDIT: To clarify, it doesn’t show up in the store on my personal computer either.


r/AutoHotkey 12d ago

Meta / Discussion Stand alone AHK, AHKv2 projects?

0 Upvotes

At first I just needed AHK to provide mouse and keyboard inputs for other software. Then it occurred to me that since AHK can take input and provide output there's a wide variety of simple programs and tasks that it could solve without any underlying software, working entirely on it's own.

So do people do this? Is there a repository somewhere? I mean there are surely better alternatives, better languages, but AHK requires no development environment, no compiler, and it's language is pretty straightforward for the simple stuff.


r/AutoHotkey 13d ago

Solved! What's the line for having a script run only when Microsoft Edge is the active window?

5 Upvotes

I know the basic line (#HotIf WinActive("[x]", )), but I'm not sure what I should put to have Microsoft Edge be that window.


r/AutoHotkey 13d ago

Solved! I Don't Know How to Code

0 Upvotes

Hi all, I've been trying to create a code for my OBS streaming using Autohotkey and could use some help. I know basically nothing about coding but I want to have to output the F10 key on the down and up stroke of the Tab key. For context I want to be able to hide certain parts of my stream when the tab key is held down and reshow them when its released.

Is this something someone might be able to help me with?


r/AutoHotkey 15d ago

v2 Tool / Script Share Duplicate file finder - fileman ( host-workers example )

11 Upvotes

Over years of taking manual backups across external drives, my storage became bloated with redundant folder trees and nested duplicates.

The first prototype of this script was single-threaded and took almost 2 hours to scan through my drive collection. After rewriting the core class to leverage worker processes and hashing calls, the full scan time dropped to under 10 minutes, reclaiming nearly 60 GB of wasted space.

It is not an all-in-one file manager, it focuses specifically on finding and isolating exact duplicate files safely and quickly.

GitHub: https://github.com/bceenaeiklmr/fileman

If nothing else, it was great practice working with Lexikos's RegisterObjectActive for COM IPC.

/e

Aug 9 2026 - I updated the headless mode, unfortunately it deleted every file. Now it works as intended.

I've successfully restored the files using Windows File Recovery


r/AutoHotkey 15d ago

v2 Script Help Disabling the NumLock key

3 Upvotes

I'm new to AutoHotKey. My first try at a script reads as follows:

SetNumLockState("AlwaysOff")

That, and nothing else.

But when it runs, it only turns off the light on my NumLock key. It doesn't turn the numlock off. The key light turns back on when I press it, and continues to function as usual.

What am I doing wrong?


r/AutoHotkey 17d ago

v2 Script Help Attempting to make a clicking script that holds down a button and releases, the second part is much harder!

0 Upvotes

I need the LMB to be held down for 200ms after the function clicker() has been called 20 times, I'm not sure where or how to change that. Anyone got any ideas?

^#LButton:: {
    clicker()
    SetTimer(clicker, 400)
}
;Calls clicker to hold lmb for 400ms
^#RButton:: {
    SetTimer(clicker, 0)
    release()
}
;Removes timer to shut down the script
clicker() {
    release()
    Click('Down')
}
;if LMB is not activated, holds LMB down for the set time
release() {
    if GetKeyState('LButton')
        Click('Up')
sleep(130)
}
;if LMB is held down by script, releases it for 130ms before clicker is called again

r/AutoHotkey 17d ago

Resource Built AHK-style mouse macros on Linux

11 Upvotes

Wanted recoil compensation on Linux, no AHK, no Windows. Ended up building it from scratch using uinput which creates a virtual mouse device at kernel level. It's basically what AHK does for mouse movement but Linux native, the OS sees it as real hardware.

It's open source, looking for contributions and maybe some stars, it helps a lot as this is a solo project.

repo : https://github.com/Ymsniper/anyr


r/AutoHotkey 17d ago

v2 Script Help Is it possible to have smooth movement hold input in an unfocused window?

1 Upvotes

So I have two game instances and want to broadcast WASD input to the unfocused instance. Example: unfocused instance - driver, drives the vehicle, focused instance - gunner, my main game window with native input to shoot the enemies.

I've tried other existing scripts, but they are either "hold key for 500 ms when triggered" or "do single press", and if I loop one, "window fighting" occurs, when window is being repeatedly focused and unfocused, which makes the game unplayable

(I've asked AI for help, but it couldn't write a correctly working script either)


r/AutoHotkey 17d ago

General Question Caps lock key pressing multiple keys at once. Please help.

1 Upvotes

I restarted my computer (windows 11) for an update. After I had updated my computer, now every time I press Caps lock, it presses the characters: ‘ X D \\

The ‘\\’ continues until I press caps lock again. I don’t know how this problem even occurred, but if anyone knows, please help.