r/AutoHotkey • • 26d ago

Meta / Discussion I supercharged GeekDude's CodeQuickTester for AHK V1!

2 Upvotes

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.

https://imgur.com/a/ZUQr5l1

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

  • Fuzzy autocomplete for commands, functions, directives, keys, your own functions and the current script's variables. wwa finds WinWaitActive. Tab inserts a parameter skeleton you can Tab through.
  • Live syntax hints: after a comma, the current parameter is underlined.
  • Context-aware completions: running programs after ahk_exe, key names inside Send {…}, and Gui sub-commands and options.
  • Closing pairs and auto-ce-aware indenting thatfollows your script's style.
  • Line tools: select line or word, multi-match select, move lines with Alt+↑↓, duplicate, select blockboard.

🎯 Pickers that write the Press a hotkey and click something on screen to get ready-to-run v1 code:

  • Window: WinActivate plus WinWaitActive
  • Click: with the right CoordMode
  • Color: PixelGetColor or a wait-for-color loop
  • Control: ControlClick, ControlSend and friends
  • Geometry: WinMove
  • Key: captures a hotkey combo
  • Chain mode: pick several things in a row and get one script block.

📚 Docs without leaving the editor

  • A Docs card shows the help page for whatever the caret is on and updates as you move. e or by task ("wait for window", "read ini").
  • Browse by category when you don't know what a command is called.
  • One click inserts the syntax or the example.

🧠 Your own scripts as a knowledge base

  • Search every line of every script you've written and insert a line or a whole block.
  • Next-line suggestions: press Enter after a line you've written before and it suggests what usually cthe current window, too.
  • Your own functions show up in autocomplete, with a one-key #Include.

🧩 Recipes with Tab stops

  • Snippets for a script skeleton, a toggle timer, safe clipboard handling, a tray menu, a ListView GUI and more.
  • Stops can be filled straight from a picker.
  • Select some code and save it as a recipe; the Tab stops are guessed for you.

🩺 Nudges A background linter for common v1 mistakes:

  • v2-style syntax pasted
  • Sleep after WinActivate
  • missing return
  • unclosed #If
  • undeclared globals
  • …

Most nudges have a one-key fix (one undo step), and you can add your own regex rules.

🗂️ Docked card workspace

  • Docs, Nudges, Tools, Recipes and My scripts arrange themselves in an automatic grid across the rest of your monitor.
  • Drag cards to dock or f.
  • One hotkey hides everything.
  • When CodeQuickTester is maximized, the cards fold into a strip so no card covers code.

r/AutoHotkey • • 28d ago

v2 Tool / Script Share How I model human typing mistakes in AutoHotkey v2

4 Upvotes

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:

  • Reads from a .txt file and types it out using hotkeys (F6 to start, F7 pause, Esc to emergency kill).
  • Uses randomized, per-character delays (letters are faster, punctuation/symbols are slower).
  • Intentionally makes occasional typos, backspaces to correct them, and retypes the segment.
  • Adds "thinking" pauses and hesitates around code blocks/braces.
  • Waits for VS Code to actually be in focus before it starts.

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 • • 28d ago

v2 Script Help Help with creating one key to cycle through multiple shortcuts? AHK v2

2 Upvotes

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 • • 29d ago

v2 Script Help How to detect whether task view (MultitaskingViewFrame) is active before triggering a custom shortcut?

3 Upvotes

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]
return

Edit: 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):

  • 1st downward swipe closes task view.
  • 2nd downward swipe shows the desktop without minimizing the widget on the desktop.

I have two questions:

  1. Would a script that detects when task view is active solve this issue?
  2. How can I set up a script that makes the advanced gesture preserve the built-in “show desktop” behavior while sending Win+M (or an equivalent), so the desktop widget isn’t minimized?

r/AutoHotkey • • Nov 04 '26

v2 Script Help Global variable not working across scripts

3 Upvotes

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)
}
}


r/AutoHotkey • • Nov 04 '26

v2 Script Help Can someone please clean up this script?

0 Upvotes

Someone from here made this script for me a few months ago. We got to what I wanted eventually after some editing, but that left some bloat behind, and that bloat has finally caught up to me bc I've been experiencing some bugs now due to this script. What I want to retain is the ability for SHIFT to work like a sticky key. That's it. I don't need WIN, ALT, or CTRL to act like sticky keys. And I don't need any GUI. Please can someone clean that stuff from this whilst preserving the SHIFT sticky key function?

Edit- or an easy way to toggle if I want to include CTRL or ALT would be even better

Requires AutoHotkey v2.0

StickyKeys('Shift') StickyKeys.ShowOverlay := false

StickyKeys(mods*) { static trackedKeys := Map(), ih, dh, overlay, otherKeyPressed := 0, _ := Init()

if ih.InProgress
    ih.Stop()
if dh.InProgress
    dh.Stop()
for k in trackedKeys {
    Hotkey '~*' k, 'Off'
    Hotkey '~*' k ' Up', 'Off'
}
trackedKeys.Clear()

ih.KeyOpt('{All}', 'NS'), dh.KeyOpt('{All}', 'N')
for k in mods {
    keyName := GetKeyName(k)
    trackedKeys[keyName] := {isSticky: false, isDown: false}
    if keyName ~= '^(Control|Shift|Alt)$' {
        keys := '{L' keyName '}{R' keyName '}'
        ih.KeyOpt(keys, '-NS')
        dh.KeyOpt(keys, '-N')
    } else  {
        ih.KeyOpt('{' keyName '}', '-NS')
        dh.KeyOpt('{' keyName '}', '-N')
    }
    Hotkey '~*' keyName, OnHotkeyDown.Bind(keyName), 'On'
    Hotkey '~*' keyName ' Up', OnHotkeyUp.Bind(keyName), 'On'
}

Init() {
    if !StickyKeys.HasProp('ShowOverlay')
        StickyKeys.ShowOverlay := true
    ih := InputHook('L0 I')
    ih.OnKeyDown := OnKeyDown
    dh := InputHook('L0 V I')
    dh.OnKeyDown := (dh, *) => (dh.Stop(), otherKeyPressed := 1)
    overlay := Gui('+ToolWindow -Caption +AlwaysOnTop +E0x20 -DPIScale')
    overlay.BackColor := '0D1117'
    overlay.SetFont('s12 Bold cC9D1D9', 'Consolas')
    overlay.AddText('vText')
    WinSetTransparent(255, overlay)
    return 1
}

OnHotkeyDown(keyName, *) {
    if keyName ~= 'LWin|RWin'
        Send '{Blind}{VKE8}'
    trackedKeys[keyName].isDown := true
    downCount := 0
    for k, v in trackedKeys 
        downCount += v.isDown
    if downCount = 1 {
        otherKeyPressed := 0
        dh.Start()
    }
}

OnHotkeyUp(keyName, *) {
    dh.Stop()
    trackedKeys[keyName].isDown := false
    if !otherKeyPressed
        toggleStickyKey(keyName)
}

ToggleStickyKey(keyName) {
    trackedKeys[keyname].isSticky ^= 1
    stickyCount := 0
    for k, v in trackedKeys 
        stickyCount += v.isSticky
    if stickyCount > 0 {
        ih.Start()
        if StickyKeys.ShowOverlay
            UpdateGui()
    } else {
        ih.Stop()
        overlay.Hide()
    }
}

OnKeyDown(ih, vk, sc) {
    ih.Stop()
    overlay.Hide()
    keyName := GetKeyName(Format('VK{:X}SC{:X}', vk, sc))
    pressKeys := '{' keyName '}'
    for k, v in trackedKeys {
        if v.isSticky {
            v.isSticky := false
            pressKeys := '{' k ' down}' pressKeys '{' k ' up}'
        }
    }
    Send '{Blind}' pressKeys
}

UpdateGui() {
    text := ''
    for k, v in trackedKeys {
        if v.isSticky 
            text .= k ' + '
    }
    text := StrReplace(SubStr(text, 1, -3), 'Control', 'Ctrl')
    overlay['Text'].Value := text
    size := TextWidth(overlay['Text'], text)
    overlay['Text'].Move(,, size.Width, size.Height)
    
    xPos := A_ScreenWidth - (size.Width + overlay.MarginX*2 + 50)
    yPos := A_ScreenHeight - (size.Height + overlay.MarginY*2 + 150)
    overlay.Show('NA AutoSize x' xPos ' y' yPos)
}

TextWidth(ctrl, text) {
    hdc := DllCall('GetDC', 'ptr', ctrl.Hwnd, 'ptr')
    hFont := SendMessage(0x31, 0, 0, ctrl.Hwnd) ; WM_GETFONT
    oldFont := DllCall('SelectObject', 'ptr', hdc, 'ptr', hFont, 'ptr')
    size := Buffer(8)
    DllCall('GetTextExtentPoint32', 'ptr', hdc, 'str', text, 'int', StrLen(text), 'ptr', size)
    width := NumGet(size, 0, 'int')
    height := NumGet(size, 4, 'int')
    DllCall('SelectObject', 'ptr', hdc, 'ptr', oldFont)
    DllCall('ReleaseDC', 'ptr', ctrl.Hwnd, 'ptr', hdc)
    return {Width:width, Height:height}
}

}


r/AutoHotkey • • Nov 04 '26

v2 Script Help AHK V2 - looping sending keystrokes to specific application window without pulling focus - beginner (non-coder)

0 Upvotes

Hey lovelies 🩷

Sorry to trouble everybody here.

For context, whilst we're¹ AuDHD² and used to be moderately capable of learning human languages, we've never successfully been able to self-teach ourselves any coding or scripting languages over many decades: not even BASIC 😑🤦‍♀️ We often don't grasp core concepts that others take for granted, but then can learn and understand things deeply if we can get over the initial learning struggle.

We tend to learn best from examples that match what we're trying to do, as they give us context for how something works / is used, rather than generic examples or raw documentation by itself. Sadly, whilst we've managed to make some progress, we've not been able to successfully work out how to do 😔 It's why we've admitted defeat and are finally asking for help.

At a high-level, what we want to do is loop sending a keystroke (down, up) to a specific application window only, irrespective of whether the application window is active or inactive, without pulling focus from or otherwise interrupting other tasks, with a random time range before looping, and with an on/off toggle.

If we understand it correctly, ControlSend is the way to send the key presses to a specific window. We've learnt how to use the AutoHotkey Window Spy to get the ControlID, but we've only managed to get it working when using an application's ClassNN and its title: it doesn't work if we use any ahk_ criteria. Additionally, our attempts to-date have only worked if the application window is focussed, which defeats the purpose.

Just to restate and summarise, in case any of the above is unclear, we'd really appreciate some kind ELI5 assistance, explanation, and best practice recommendations for combining:

  • An on/off toggle (using an F key) for a loop.
  • A loop.
    • Pressing a key (not holding down) in a specified application window only, irrespective of focus.
    • Waiting/sleeping for a random amount of time between a range before looping.

Thank you in advance for empathy and patience 🫶


¹ Plural (median, blurian system), so we typically write with we/us/our instead of I/me/my etc. It's not relevant to the query, but experience has taught us that if we don't explain it, one or more peeps will ask.
² Autistic and ADHD, which is common among many proficient coders.


Edit: Several of the disrespective responses thus far, seemingly from young teens (or adults with the maturity of them), are honestly one of the main reasons why we don't ask for help with things. Also, if you don't know how to help, that's okay, but please don't respond suggesting the use of agentic LLMs etc. No vibe coders, please.

Edit 2: Kinda worked it out, but it causes some odd issues, like preventing the shift key (and other modifier keys) from working. We combined ControlFocus with ControlSend as below.

ControlFocus "ClassNN", "ahk_exe ProgramName.exe"
ControlSend "{Space}", "ClassNN", "ahk_exe ProgramName.exe"

It may work far better with additional changes, but right now it will at least send space bar to the designated window only. Not sure why it's preventing shift/ctrl/alt + keys right now outside of that window, but it's better than before.


r/AutoHotkey • • Nov 03 '26

General Question Could you have the current #HotIf always on-screen when you code?

3 Upvotes

Had a question that I'm sure might be interesting for some other people. In short, I personally code my ahk scripts in VisualStudio using the AHK++ pack. I think it's a very decent way to code ahk scripts, and I like that when you are inside of a hotkey, hostring or even function, the name is still visually there even if it passes the top of the screen; it's very useful, but honestly... I think I would need that more for #HotIfs. Maybe others use this less, but I use it a lot, and there are countless times where I scrolled up to check what was the last #HotIf of my script, it's even more important than knowing the hotkey/hotstring/function, and it's also something you're way more likely to forget or not know! (surprised this is not by default) So can you make the last #HotIf always be on screen in a similar way, either by using something in AHK++ I missed, or maybe in another way? Thanks in advance.


r/AutoHotkey • • Nov 03 '26

v2 Tool / Script Share Open link in Split View Edge Browser

1 Upvotes

r/AutoHotkey • • Nov 03 '26

v2 Script Help Vrto3d failed to activate mouse button as right click.

1 Upvotes

I used uevr and vrto3d to play 3d sbs game on my glass free 3d.

I manage to bind all my keyboard button even alt button. toggle or hold or switch.

However i failed to bind right click.

I have search google for hour now.I tried VK_RBUTTON and 2(not numpad2) all doesnt work.

I also tried auto hotkey and bind right click to numpad4. It does work if im not focus on game app.But when i return to game it just a normal right click again.

This method also disable right click completely and press numpad4 instead

I then channg the autohotkey script to

~RButton::

{

Send("{Numpad4}")

}

this time both rightclick and numpad4 fired simultanously but dont trigger vrto3d hotkeys at all


r/AutoHotkey • • Nov 02 '26

v1 Script Help How do I prevent key up events from interrupting a remapped key?

4 Upvotes

I'm trying to make a script that remaps WASD to the arrow keys while keeping the arrow keys functional for better reaction speeds in Deltarune.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#Persistent

~[::
    Toggle := 0
return

~]::
    Toggle := 1
return

#If Toggle
~w::Send Up
~a::Send Left
~s::Send Down
~d::Send Right

but if I hold down both the directional key and the remapped key, then release only one of either, the input stops. I've tried intercepting the key up events with more conditionals but it didn't do anything.


r/AutoHotkey • • Nov 02 '26

Solved! How to disable a hotkey combination?

2 Upvotes

I need to disable this hotkey, but it's saying it doesn't exist.

~a & WheelUp:: Hotkey, a & WheelUp, Off

Edit: fixed it somehow


r/AutoHotkey • • Nov 01 '26

v1 Script Help Need help with timer and loops

5 Upvotes

I want a timer to always run when a variable is true while keeping the loop going.

Toggle := false
Toggle2 := false

Numpad0::
    Toggle := !Toggle
return

F10::
Toggle2 := !Toggle2
return

macro:
Send, {b down}
sleep, 30
Send, {b up}
return

macro2:
Send, {z down}
sleep, 30
Send, {z up}

return

Home::
loop
{
send, {LButton}
sleep, 30
If Toggle{
        SetTimer, macro, 3000
        }
}
return

XButton1::
send, {9}
sleep, 20
send, {RButton}
sleep, 20
send {1}
return

XButton2::
pause
return

r/AutoHotkey • • Nov 01 '26

v2 Script Help Reverse Mouse Direction in the X-axis only

3 Upvotes

Hi, i want a script that just reverse the mouse direction in the x-direction only, leaving the y-axis as it is. i tried asking chatgpt but none of the solutions worked so far. can someone post a script here please?

i want to avoid my mouse from jittering when the reverse is activated. i also want a toggle button to switch between reversing and not reversing


r/AutoHotkey • • Oct 30 '26

v2 Tool / Script Share [Open Source] AHK v2 on macOS; Running AutoHotkey v2 scripts natively on Apple Silicon & Intel

1 Upvotes

Hi everyone,

I wanted to share an open-source project I've been working on to run AutoHotkey v2 scripts natively on macOS: ahk-v2-macos.

How it works: It is a specialized fork of the Keysharp engine targeting .NET 10, cross-compiling AHK v2 source code directly into in-memory Roslyn assemblies and running on macOS (both ARM64 and x64) using native macOS integrations (Accessibility API, Quartz event taps, IOKit).

What's implemented:

Limitations:

Check out the repo, build instructions, and examples: https://github.com/X6M-Work/ahk-v2-macos
Feedback, issue reports, and testing on various macOS configurations are very welcome!


r/AutoHotkey • • Oct 29 '26

v2 Tool / Script Share [v2] Middle-click the empty tab strip in Brave to open a new tab

0 Upvotes

Missed Firefox's "middle-click empty tab strip = new tab" in Brave, so I made a small AHK v2 script for it. Tabs still close and links still open normally on middle-click.

Uses plain COM UI Automation (no library), no timers, and does nothing unless the click is clearly on the empty tab strip. Windows + horizontal tabs only. Has a debug mode and a tray toggle for run-at-startup.

Repo: https://github.com/barantunca/brave-middle-click-newtab

Written with Claude's help. Feedback welcome!


r/AutoHotkey • • Oct 29 '26

v2 Script Help SendText not sending greek letters except for µ on V2 Linux port

0 Upvotes

I am using AutoHotkey V2 port to Linux (https://github.com/MonoEven/Autohotkey_Linux) v2.0.26, (which uses V2 syntax only but is otherwise equivalent to the Windows version) on Kubuntu 26.04 LTS using Wayland (Plasma 6.6.6). I tried to copy a script I was succesfully using on Windows 11 25H2 to type out greek letters:

#Requires AutoHotkey v2.0
\:: SendText "\"
\ & a:: SendText "α"
\ & b:: SendText "β"
\ & c:: SendText "γ"
\ & d:: SendText "δ"
\ & e:: SendText "ε"
\ & f:: SendText "φ"
\ & k:: SendText "κ"
\ & l:: SendText "λ"
\ & m:: SendText "µ"
\ & n:: SendText "ν"
\ & p:: SendText "π"
\ & q:: SendText "ψ"
\ & r:: SendText "ρ"
\ & s:: SendText "σ"
\ & t:: SendText "τ"
\ & w:: SendText "ω"
\ & x:: SendText "χ"
\ & o:: SendText "θ"
\ & z:: SendText "ζ"
\ & j:: SendText "ι"
\ & 0:: SendText "°"

On Linux, the script types µ, °, and \ when releasing \ key (correct behaviour), but it would not type anything when pressing any other key combination in the script. I tried substituting greek characters with unicode codes as:

\ & a::Send(Chr(0x03B1))

but it just wouldn't work. The script is saved in UTF-8 and doesn't throw any error, except for a few tries I had with V1 synthax, but that's not supported so that's expected.

What may be the reason? If some characters are supported (µ), why not all of them?

Thank you in advance.


r/AutoHotkey • • Oct 29 '26

v1 Script Help HTML/CSS AHK V1 WRAPPING POSSIBLE?

0 Upvotes

Is it possible to wrapp an AHK V1 script with HTML/CSS to make it more look modern?

Just figuring things out, Ask claude for help but the thing cant help me too so i figured might me the masters can help or give me tips. Thanks


r/AutoHotkey • • Oct 28 '26

v2 Tool / Script Share Super Hotkey — Window management and more

25 Upvotes

I've been working on an AutoHotkey v2 project called Super Hotkey.

It has five modules covering window management, a dropdown notepad, customizable key layers and various keyboard utilities.

I mainly wanted something that makes managing windows easier without having to use a full tiling window manager.

It's still a work in progress, so there may be bugs here and there. There's a demonstration GIF in the GitHub README.

GitHub: https://github.com/nroj95/super-hotkey

Feedback is welcome!


r/AutoHotkey • • Oct 28 '26

v2 Script Help How tf does a program differentiate between AHK input and physical Keyboard

8 Upvotes

I have been playing around with macros and scripts for a bit for fun, and something I've noticed is that some games (Specifically AION2 right now) Will detect when AHK is running a macro somehow and ignore the input, however, both Corsair and Logitech software macros run as if I was truly physically pressing the buttons and are not ignored.

Normally This is just fine but I've recently wanted to expand into making more in depth macros and felt AHK2 was the best way to do this, such as using ControlSend to be able to tab out and do homework when i otherwise would be holding down 2 buttons staring at the screen to kill mobs and loot. I would not consider this cheating as 1:The entire community already has macros like this set up, and 2: the game already has an in built macro function, its just a bit simple.

As an example, I have a macro that presses F a lot because you need to press F to loot items. AHK works just fine sending thru almost any send function, however only to chat. As soon as I close chat the game no longer takes the input.

This is genuinely very interesting to me and I've been on a rabbit hole reading but I'm not sure where to start.
My question is, how would a program even go about detecting the difference in inputs like this? From AHK to my physical keyboard and Corsair/Logitech macro software. I am willing to learn if its complicated, and I would like to "simulate" hardware input or do whatever logitech does, if that's possible.


r/AutoHotkey • • Oct 26 '26

Meta / Discussion Pro Tip: Claude Can Merge All Your Scripts into One Master Script!

3 Upvotes

I payed 20 bucks for claude, and then put a folder of all my ahk scripts, v1 and v2 into it, and said make them all v1 and make it all one master script instead of 109 separate scripts

(i need ahk v1 to get around admin issues on the work laptop, and i needed one script to save time, since the no admin route means you must compile each seperately.)

it did it...

wow.

it works too.

my life.. it can do anything ..it could probably make mario 64 run in ahk


r/AutoHotkey • • Oct 24 '26

v2 Tool / Script Share Raylib AHK - graphics library (GPU)

31 Upvotes

Hey everyone,

I decided to finish this project I started 3 years ago.

https://github.com/bceenaeiklmr/raylib_ahk

What it is: a generated binding layer over raylib 5.5. lib/raylib.ahk is autogenerated from the official raylib.h, plus a tiny prebuilt DLL for the handful of calls AutoHotkey's DllCall can't express directly. Clone it and run a demo, no compiler, no raylib install, no runtime redist. Just 64-bit AutoHotkey v2.

What you can do with it, all from a script:

- windows, shapes, gradients, images and textures built in RAM (no asset files)

- custom TrueType fonts, so accents and special characters actually render, instead of the built-in font's friendly row of question marks

- 3D: camera, models, textures

- audio, including synthesising a WAV in memory

- and a working little brick game, which is the demo I keep playing instead of finishing things

There are 7 runnable demos in examples/, and the README has screenshots of every one.

raylib is a C library, so if you've used it before the API is the same one you already know, just with RL. on the front. If you haven't, the demos are probably the fastest way in.

Written for Windows x64. Feedback and "this function is missing" reports very welcome, 84 functions are deliberately left out and each one has a written reason, but I could be wrong about a few.

Cheers,
bceen


r/AutoHotkey • • Oct 25 '26

v1 Script Help Script for editor that doesn't allow copy pasting

0 Upvotes

I have to do a coding assignment on my university's

website

But the website doesn't allow copy-pasting

So I tried using autohotkey

But due to the editor having auto indentation it didn't quite work

It's python code so indentation matters a lot

I tried chatgpt to write a script but it either didn't indent at all, deleted words or either kept pushing towards the right due to accumulated indentation

Can you give me a script that'll work?


r/AutoHotkey • • Oct 25 '26

v1 Script Help Trying to update a script that's been working fine for the better part of a year is making it break in a way that doesn't make any sense to me.

0 Upvotes

I've been using a script to automate a task for about a year now, and it needs updating. This is the script in its unchanged form:

Loop, 770
{

Click, 963 855 ; click position A
Random, DelayValue, 1125, 1175
Sleep DelayValue
Click, 2012 662 ; click position B
Random, DelayValue, 1125, 1175
Sleep, DelayValue
Click, 638, 925 ; clicks the first option for position C
Click, 638, 1005 ; clicks the second option for position C
Random, DelayValue, 1000, 2000
Sleep DelayValue
}

And this worked until the site I was using the script on underwent some visual changes. Positions A and B are unchanged, but now the button at position C can be moved out of position by accompanying text thanks to a font size change.

So I've tried taking a screenshot of the button that's at position C, using ImageSearch to grab its position, defining the x and y it spits out as variables, and changing the position C's click line to use those variables, like so:

ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, [image file path]
Loop, 770
{
Click, 963 855 ; click position A
Random, DelayValue, 1125, 1175
Sleep DelayValue
Click, 2012 662 ; click position B
Random, DelayValue, 1125, 1175
Sleep, DelayValue
Click, %FoundX%, %FoundY% ; click position C
Random, DelayValue, 1000, 2000 ; trying to account for page refreshing time
Sleep DelayValue
}

What I'm trying to get this script to do now, is to use the position from ImageSearch as position C. I have verified that ImageSearch successfully finds the button. I've checked that MouseMove, MouseClick, and Click all work perfectly fine with %FoundX% and %FoundY%. I have tried putting ImageSearch both inside and outside the loop. But for a reason I simply cannot figure out, there is no cursor movement between the click and position B and the click and position C. Multiple ways of using ImageSearch's output for position C's click have worked outside of this loop. I would really like some help understanding why it's not working inside the loop.

While writing this post, I decided to check if ImageSearch actually does anything while the loop is running, so I added an if (ErrorLevel = 1) check inside the loop, before the step that's meant to click at position C. To add to my confusion, an ImageSearch that functions just fine seems to stop functioning while the loop is running. I'm not sure why.


r/AutoHotkey • • Oct 22 '26

Meta / Discussion [Research] Survey on the usability and friction of desktop automation tools (2 mins, completely anonymous)

6 Upvotes

Hi everyone, I'm a Computer Science student researching Human-Computer Interaction (HCI). I'm looking into the friction points, frustrations, and abandonment rates people face when setting up and troubleshooting desktop automation tools and scripts.

If you have 2 minutes, I would really appreciate it if you could fill out this short, 9-question survey.

Privacy note: The form is 100% anonymous and does not require you to sign in with an email. It just asks a few questions about your experience with scripts and AI tools. Your feedback will directly help my research on why some automation tools are harder to use than others.

Form Link: https://spoo.me/ahk

Thank you for your time and for sharing your experience!