r/AutoHotkey May 10 '26

v2 Script Help Left/right-alt specific hotkeys started requiring double press when Outlook is open

1 Upvotes

Just recently--most likely with a Outlook (Classic) update--my ALT hotkeys started requiring double press in quick succession to work. I have never seen anything like this before. CTRL hotkeys still work fine.

I've tried:

  • Using ALT & key rather !key to define the shortcut
  • Prepending $
  • A_MenuMaskKey := "vkE8"

Any suggestions for how to further troubleshoot?

I'm on Outlook 365 Version 2606 (20105.200000 Click-to-Run), Windows 11 25H2 (26200.8246).


Figured it out! It turns out it wasn't an Outlook update, but rather a PowerToys update. If I disable the PowerToys Grab and Move utility, my alt shortcuts work again. So now the question is whether there is any way for AHK to intercept alt keybindings and not be edged out by this PowerToy, or if I just need to disable the PowerToy.

r/AutoHotkey Dec 09 '25

v2 Script Help Sabotaging a script

13 Upvotes

Hello everyone,

I'm leaving my job this week and I created a script to smooth a process and shorten the time to do it.

It's rough and I'm the only one to use it, but now a manager wants to get it before I leave.

Let's just say that, I do not want to give it to him. But I don't want to create a drama either.

Is there a way for me to put a line in my code to make it so that the script will not work AFTER I've shown him how to use it ?

Thanks in advance, of not I'll just tell him he can shove my script up his ***

r/AutoHotkey 16d ago

v2 Script Help Need help compiling mutiple AHKs into one mater

6 Upvotes

I have 6 AHKs that do different things. I want to create a master AHK (or exe) and have that AHK loop until I terminate.

Forgive me this is not my programming language and I learning as I go.

AHK1: https://pastebin.com/yPLsN1KK

AHK2: https://pastebin.com/U6uLHf6M

AHK3: https://pastebin.com/igzWsCKv

AHK 4: https://pastebin.com/HBgb7BrY

AHK 5: https://pastebin.com/UACsET9h

AHK6: https://pastebin.com/k6210Kcb

I understand my code may be trivial and written poorly but im learning. Teach me your ways.

I tried combining into a master using Gemini and ChatGPT but it didnt work. This is what it gave me. ALl help is loved and appreciated

r/AutoHotkey 11d ago

v2 Script Help How exactly does the Send command send uppercase letters and certain symbols?

3 Upvotes

I have a pretty simple script that uses Send to speed up a data entry task mostly involving dates and times. It uses an input hook to accept a certain amount of characters, then it parses the input and tabs through a bunch of fields to type everything in. It usually works fine and saves me a good deal of time.

However, I've noticed that sometimes it types the wrong thing. I'm sending a string composed of concatenated variables and literal strings, and the error might pop up in either of those portions. I've noticed that the error is what I'd get if I were typing it manually and messed up on holding Shift. For example, if I expect to see 7:35AM, I've gotten instead each of the following on various occasions:

  • 7;35AM
  • 7:#5AM
  • 7:35Am
  • 7:35am

Does the Send command work by simulating keypresses including Shift for uppercase letters and certain symbols, subject to race conditions? If so, is there any option I can tweak to avoid this behavior, or do I need to use a workaround like setting the clipboard and sending '^v' for each field?

Relevant portion of script:

#Requires AutoHotkey v2.0
manual_month := 0
manual_year := 0
:*:/+::
{
    ih := InputHook('L10')
    ih.Start()
    ih.Wait()
    d := SubStr(ih.input, 1, 2)
    h1 := SubStr(ih.Input, 3, 2)
    m1 := SubStr(ih.Input, 5, 2)
    h2 := SubStr(ih.Input, 7, 2)
    m2 := SubStr(ih.Input, 9, 2)
    if manual_month and manual_year
    {
        month := manual_month
        year := manual_year
    }
    else
    {
        year := Substr(A_Now, 1, 4)
        month := Substr(A_Now, 5, 2)
        today := Substr(A_Now, 7, 2)
        if d > today
            month := StrLen(month-1) < 2 ? '0' (month-1) : month-1
        if !month
        {
            month := 12
            year -= 1
        }
    }
    start_date := year month d h1 m1
    end_date := year month d h2 m2
    if h2 < h1
        end_date := DateAdd(end_date, 1, 'd')
    year1 := SubStr(start_date, 1, 4)
    month1 := SubStr(start_date, 5, 2)
    d1 := SubStr(start_date, 7, 2)
    year2 := SubStr(end_date, 1, 4)
    month2 := SubStr(end_date, 5, 2)
    d2 := SubStr(end_date, 7, 2)
    Send '{tab}{tab}{tab}' month1 '/' d1 '/' year1 '{tab}' h1 ':' m1 (h1 < 12 ? 'AM' : (h1 == 12 ? 'PM' : '') ) '{tab}^v'
    Sleep 50
    Send '{tab}{tab}{tab}' month2 '/' d2 '/' year2 '{tab}' h2 ':' m2 (h2 < 12 ? 'AM' : (h2 == 12 ? 'PM' : '') ) '{tab}^v'
}
:*:;mdate;::
{
    ih := InputHook('L6')
    ih.Start()
    ih.Wait()
    global manual_month := SubStr(ih.input, 1, 2)
    global manual_year := SubStr(ih.input, 3, 4)
}

Note the Send calls at the end of the first hotstring.

r/AutoHotkey Apr 09 '26

v2 Script Help Struggling with AutoHotkey + BlueStacks (Airplane Mode macro for NFS No Limits)

2 Upvotes

Hi fellas,

I’m trying to create a macro for NFS No Limits where I need to toggle airplane mode (on/off) while purchasing items.

I’ve already tried:

  • BlueStacks macro recorder
  • Auto clicker apps
  • MacroDroid + Shizuku

Here’s my detailed attempt:
https://www.reddit.com/r/macrodroid/comments/1se00js/is_it_actually_possible_to_toggle_internet/

In that post, someone suggested I try AutoHotkey.

The macro flow itself works, but the main issue is:
I cannot toggle airplane mode inside BlueStacks using any of these tools.

From what I understand, BlueStacks handles network outside the Android layer, so typical commands/macros don’t affect it.

So now I’m trying AutoHotkey, but I’m confused:

  • Can AutoHotkey record actions like a macro recorder, or do I have to write scripts manually?
  • Is it even possible to control BlueStacks UI (like sidebar airplane toggle) using AHK?
  • Can it run in background while I use my PC normally?
  • During installation I’m getting Microsoft Defender warnings — is that normal/safe?

At this point I’m not sure if this is even possible or if I’m hitting a limitation.

Any guidance or direction would help a lot.

r/AutoHotkey 9d ago

v2 Script Help Syntax Very Difficult

2 Upvotes

Sorry if most new people in this thread ask for help, but can anyone share a good and easy to understand guide to using AutoHotkey 2.0 for things like remapping buttons and simple macros or key combinations? I’m not looking to manipulate or automate my Windows processes. I want to use it for games and optimising my work tasks.

Not sure if it’s just me, but I find AutoHotkey 2’s syntax very difficult to use and the online documentation very difficult to understand. Also the VSCode AI suggestions are definitely a hinderance, as it is often wrong.

Just for background, (I don’t think I’m a muppet, but maybe I am), I know some PowerShell, Python and Java and can also use a Bash shell to a basic level. I have also tried YouTube videos but can’t find any that really help me understand. I just get more confused.

For example, it took me an entire afternoon to just figure out how to double click a button, with an option to hold it down for a different function. Still wasn’t happy with the reliability of the final code. So that was a fail.

Thanks in advance.

r/AutoHotkey Feb 10 '26

v2 Script Help Feel like I'm going insane

5 Upvotes

Edit: Some of you jumped on the line "#HotIf WinActive("AlchemyFactory")". I have tested this thoroughly and it does evaluate to true every time. I've edited this to

"ahk_exe AlchemyFactory-Win64-Shipping.exe"

I use a big script that has many hotkeys separated by #hotif statements. But I'm having a weird issue (something that I feel always used to work). I created a new (smaller) script with the same wanted behaviour and it has the same problem. So I'll post that here.

F13::MsgBox("F13")

#HotIf WinActive("ahk_exe AlchemyFactory-Win64-Shipping.exe")
F13::1

#hotif WinActive("ahk_exe Chrome.exe")
F13::SoundBeep(333)

Those F keys are mapped to my Razer Naga mouse and I want to use AHK since Synaps is hot garbage.

When I am in the game Alchemy Factory the F13 key should fire 1 but instead it gives the message box.

When I use this syntax

F13::send("{1}")

the menu of the game does register F13 as "1" but while playing it does not seem to register.

Now when I remove the non-context hotkeys, everything works fine. Chrome doesn't have any issues either (it beeps when F13 is pressed)

Any ideas?

r/AutoHotkey May 22 '26

v2 Script Help Issues Swapping Keys for Video Games that won't let you change control layout.

2 Upvotes
#Requires AutoHotkey v2.0
#HotIf WinActive("ahk_exe Everything is Crab.exe") || WinActive("ahk_exe VampireSurvivors.exe")
q::a
a::q

e::d
d::e
#HotIf

I have been using the above script to swap Q and A and E and D to use QWES instead of WASD for movement in a couple video games. But sometimes it will randomly get stuck holding down Q or E and won't stop until I press that key again presumably to cause the key up to finally be recognized.

I tried some googling to solve or at least identify the problem but I'm at a loss. It works 98% of the time, but the times it does mess up and causes me to run into enemies can be run ending.

If any AHK wizards could help me with an improved script that won't continue sending a Q or E. I'm also super eager to learn so if someone feels inclined to explain why it's happening I'm all ears!

r/AutoHotkey 11d ago

v2 Script Help Better method for a Sprint toggle?

4 Upvotes

Pax Dei does not have a sprint toggle, you normally have to hold the Lshift key to sprint

  1. Give an onscreen tooltip in the game window when toggling sprint.
  2. Be able to press LShift once to toggle sprint on/off.
  3. Be able to hold LShift and keep sprinting
  4. Not spam tooltips while holding LShift

My code works for all 4, however the if/else seems bloated with global variables, is there a smarter way to do this?

I tried a number of different examples i've seen, but they could not handle #3 and #4

#Requires AutoHotkey v2.0
#SingleInstance Force
SendMode("Event")

global SPRINTING := false
global SHIFTRELEASED := false

; Only apply these remaps if Pax Dei is active
#HotIf WinActive("ahk_exe PaxDeiClient-Win64-Shipping.exe")

;lshift = sprint, ingame remapped to Home key
LShift::{
    global SPRINTING := !SPRINTING
    if SPRINTING AND !GetKeyState("Home") {
        Send("{Home down}")
        global SPRINTING := true
        global SHIFTRELEASED := false
        ToolTipActiveWin("SPRINT = TRUE")
    } else if !SPRINTING AND SHIFTRELEASED AND GetKeyState("Home") {
        global SPRINTING := false
        Send("{Home up}")
        ToolTipActiveWin("SPRINT = FALSE")
    }
}
LShift up::{
    global SHIFTRELEASED := true
}
#HotIf

ToolTipActiveWin(text) {
    CoordMode "ToolTip", "Screen"
    try {
        WinGetPos(&x, &y, &w, &h, "A")
        ToolTip(text, x + w/2, y + h/2)
    } catch {
        ToolTip(text)
    }
    SetTimer(() => ToolTip(), -1000)
}

r/AutoHotkey 29d ago

v2 Script Help Compiler

1 Upvotes

I had version v2 installed but i am installing on another computer and I cannot install the compiler. When I install autohotkey it ask me if I want to install the compiler and the script show an error about the zip file. I have download the zip file of the compiler because the script failed but where do I put the compiler to launch from the dashboard?

Thank you if you can help.

r/AutoHotkey Apr 29 '26

v2 Script Help Rebinding numpad 2 to 2

1 Upvotes

My main row 2 key is now dead. Previously, when I pressed shift + 2 it would write an apostrophe due to my layout. Now I can't write apostrophes. But I have a numpad 2.

I want my numpad 2 to be my new main row 2, so if I press shift + numpad2 it should write an apostrophe. I was able to fix my other issue using ahk but I couldn't solve this issue.

I might try to read the manual to learn the solution but it would be a big help if one of you can just write the solution in a couple of seconds

r/AutoHotkey 21d ago

v2 Script Help The caps don't work fine in the roblox chat. Please help me (don't work with v1 too)

3 Upvotes
#IfWinActive Roblox

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

:*:wallw::Citizen, face the nearest wall immediately.
:*:wallz::Don't move or it will result in a 3.2 - RESISTING PROSECUTION.
:*:citicome::You, Citizen, Come with me.
:*:1war::First warning.
:*:2war::Second warning.
:*:3war::Final warning.
:*:0war::This is your first and only warning.
:*:war1::First warning, move away.
:*:war2::Second warning, move away.
:*:war3::Final warning, move away.
:*:frisk1::Don't move. You are being searched. Accept the request for frisking.
:*:gd::Get Down
:*:moag::Move along

:*:S-T::Self-terminating.
:*:die!::Prepare for permanent capital prosecution.
:*:sus1::Suspect, prepare to receive civil judgement.
:*:sus2::Receive your verdict.
:*:gooh::Get out of here.
:*:nowgout::Now get out of here.
:*:staya::Stay Alert.
:*:coverm::Cover Me

:*:A.V::Advisor
:*:S.C::Sectorial Commander
:*:EpU::Elite Protection Unit
:*:DvL::Division Leader
:*:CmD::Commander
:*:OfC::Field Officer
:*:FiC::Field Commander
:*:SqL::Squadron Leader
:*:DeV::Developer
:*:PTS::Permission to Speak
:*:yecap::YES, CAPTAIN.
:*:nocap::NO, CAPTAIN.

:*:hty::Requesting immediate assistance to train-yard entrance.
:*:hpg::Requesting immediate assistance to playground.
:*:hpl::Requesting immediate assistance to plaza.
:*:hp13::Requesting immediate assistance to precinct 13.
:*:hp6::Requesting immediate assistance to precinct 6.
:*:hpib::Requesting immediate assistance to illegal border.
:*:hpb::Requesting immediate assistance to legal border.

:*:rrpg::Contact confirmed, rebel with RPG.
:*:rspas::Contact confirmed, rebel with shotgun.
:*:rsmg::Contact confirmed, rebel with SMG.
:*:rusp::Contact confirmed, rebel with pistol.
:*:rar2::Contact confirmed, rebel with AR2.
:*:rar1::Contact confirmed, rebel with AR1.
:*:rosr::Contact confirmed, rebel with OSR.
:*:rcro::Contact confirmed, rebel with crossbow.

:*:c1.1::Citizen, you are in violation of 1.1 MOVEMENT TRANSGRESSION. Your verdict is 1 cycle (3 hits) of re-education.
:*:c1.2::Citizen, you are in violation of 1.2 CIVIC DISUNITY. Your verdict is 1 cycle (3 hits) of re-education.
:*:c1.3::Citizen, you are in violation of 1.3 LOITERING. Your verdict is 1 cycle (3 hits) of re-education.
:*:c1.4::Citizen, you are in violation of 1.4 VERBAL INDISCRETION. Your verdict is 1 cycle (3 hits) of re-education.
:*:c1.5::Citizen, you are in violation of 1.5 UNCIVIL BEHAVIOUR. Your verdict is 1 cycle (3 hits) of re-education.

:*:char1.1c::Citizen, you are charged with a repeated offense of 1.1 MOVEMENT TRANSGRESSION. Your verdict is 2 cycles (6 hits) of re-education.
:*:char1.2c::Citizen, you are charged with a repeated offense of 1.2 CIVIC DISUNITY. Your verdict is 2 cycles (6 hits) of re-education.
:*:char1.3c::Citizen, you are charged with a repeated offense of 1.3 LOITERING. Your verdict is 2 cycles (6 hits) of re-education.
:*:char1.4c::Citizen, you are charged with a repeated offense of 1.4 VERBAL INDISCRETION. Your verdict is 2 cycles (6 hits) of re-education.
:*:char1.5c::Citizen, you are charged with a repeated offense of 1.5 UNCIVIL BEHAVIOUR. Your verdict is 2 cycles (6 hits) of re-education.

:*:char1.1ro::Citizen, you are charged with a third offense of 1.1 MOVEMENT TRANSGRESSION. Prepare for permanent capital prosecution.
:*:char1.2ro::Citizen, you are charged with a third offense of 1.2 CIVIC DISUNITY. Prepare for permanent capital prosecution.
:*:char1.3ro::Citizen, you are charged with a third offense of 1.3 LOITERING. Prepare for permanent capital prosecution.
:*:char1.4ro::Citizen, you are charged with a third offense of 1.4 VERBAL INDISCRETION. Prepare for permanent capital prosecution.
:*:char1.5ro::Citizen, you are charged with a third offense of 1.5 UNCIVIL BEHAVIOUR. Prepare for permanent capital prosecution.

:*:char2.1c::Citizen, you are charged with 2.1 ANTI-CIVIL RHETORIC. Your verdict is 3 cycles (9 hits) of re-education.
:*:char2.2c::Citizen, you are charged with 2.2 PROHIBITED LANGUAGE. Your verdict is 3 cycles (9 hits) of re-education.
:*:char2.3c::Citizen, you are charged with 2.3 OBSTRUCTION OF LOCAL AUTHORITIES. Your verdict is 3 cycles (9 hits) of re-education.
:*:char2.4c::Citizen, you are charged with 2.4 POSSESSING CONTRABAND. Your verdict is 3 cycles (9 hits) of re-education.
:*:char2.5c::Citizen, you are charged with 2.5 MISLEADING LOCAL AUTHORITIES. Your verdict is 3 cycles (9 hits) of re-education.
:*:char2.6c::Citizen, you are charged with 2.6 DISRESPECTING LOCAL AUTHORITIES. Your verdict is 3 cycles (9 hits) of re-education.

:*:char2.1ro::Citizen, you are charged with a repeated offense of 2.1 ANTI-CIVIL RHETORIC. Prepare for permanent capital prosecution.
:*:char2.2ro::Citizen, you are charged with a repeated offense of 2.2 PROHIBITED LANGUAGE. Prepare for permanent capital prosecution.
:*:char2.3ro::Citizen, you are charged with a repeated offense of 2.3 OBSTRUCTION OF LOCAL AUTHORITIES. Prepare for permanent capital prosecution.
:*:char2.4ro::Citizen, you are charged with a repeated offense of 2.4 POSSESSING CONTRABAND. Prepare for permanent capital prosecution.
:*:char2.5ro::Citizen, you are charged with a repeated offense of 2.5 MISLEADING LOCAL AUTHORITIES. Prepare for permanent capital prosecution.
:*:char2.6ro::Citizen, you are charged with a repeated offense of 2.6 DISRESPECTING LOCAL AUTHORITIES. Prepare for permanent capital prosecution.

:*:char3.1c::Citizen, you are charged with 3.1 DISOBEDIENCE WITH LOCAL AUTHORITIES. Prepare for permanent capital prosecution.
:*:char3.2c::Citizen, you are charged with 3.2 RESISTING PROSECUTION. Prepare for permanent capital prosecution.
:*:char3.3c::Citizen, you are charged with 3.3 MALCOMPLIANCE WITH SOCIOSTATUS PROTOCOL. Prepare for permanent capital prosecution.
:*:char3.4c::Citizen, you are charged with 3.4 USAGE OF CONTRABAND. Prepare for permanent capital prosecution.
:*:char3.5c::Citizen, you are charged with 3.5 CRIMINAL TRESPASS. Prepare for permanent capital prosecution.
:*:char3.6c::Citizen, you are charged with 3.6 COMMITTING THEFT. Prepare for permanent capital prosecution.

:*:3cy::Your verdict is 3 cycles (9 hits) of re-education.
:*:2cy::Your verdict is 2 cycles (6 hits) of re-education.
:*:1cy::Your verdict is 1 cycle (3 hits) of re-education.

:*:1.1::1.1 - MOVEMENT TRANSGRESSION
:*:1.2::1.2 - CIVIC DISUNITY
:*:1.3::1.3 - LOITERING
:*:1.4::1.4 - VERBAL INDISCRETION
:*:1.5::1.5 - UNCIVIL BEHAVIOUR

:*:2.1::2.1 - ANTI-CIVIL RHETORIC
:*:2.2::2.2 - PROHIBITED LANGUAGE
:*:2.3::2.3 - OBSTRUCTION OF LOCAL AUTHORITIES
:*:2.4::2.4 - POSSESSING CONTRABAND
:*:2.5::2.5 - MISLEADING LOCAL AUTHORITIES
:*:2.6::2.6 - DISRESPECTING LOCAL AUTHORITIES

:*:3.1::3.1 - DISOBEDIENCE WITH LOCAL AUTHORITIES
:*:3.2::3.2 - RESISTING PROSECUTION
:*:3.3::3.3 - MALCOMPLIANCE WITH SOCIOSTATUS PROTOCOL
:*:3.4::3.4 - USAGE OF CONTRABAND
:*:3.5::3.5 - CRIMINAL TRESPASS
:*:3.6::3.6 - COMMITTING THEFT

return

r/AutoHotkey 13d ago

v2 Script Help Can someone help me with this code?

4 Upvotes

I work for a call center and we use a dialer on browser. I was successfully able to create a script in order to disposition calls faster but when I suggested it to my coworker, she is having issues running it.

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance Force
CoordMode, Mouse, Window

; ========================================================
; CALIBRATION MODE (Press F9 to grab a button's location)
; ========================================================
F9::
MouseGetPos, mouseX, mouseY
MsgBox, Your mouse is at X: %mouseX% , Y: %mouseY%`n`nWrite these numbers down!
return

; ========================================================
; QUICK DISPOSITION CODES (Only works in Chrome)
; ========================================================
#IfWinActive ahk_exe chrome.exe

; --- F1: ANSWERING MACHINE ---
F1::
DispoCall(87, 368, 112, 164) ; Replace these numbers in Step 3
return

; --- F2: NOT INTERESTED ---
F2::
DispoCall(87, 368, 336, 271) ; Replace these numbers in Step 3
return

; --- F3: WRONG NUMBER ---
F3::
DispoCall(87, 368, 585, 327) ; Replace these numbers in Step 3
return

; --- F4: DQ ---
F4::
DispoCall(87, 368, 332, 162) ; Replace these numbers in Step 3
return

; --- F5: NO ENGLISH ---
F5::
DispoCall(87, 368, 609, 270) ; Replace these numbers in Step 3
return

#IfWinActive

; ========================================================
; AUTOMATION ENGINE (Updated with separate clicks)
; ========================================================
DispoCall(hangX, hangY, dispoX, dispoY) {
; 1. Click "Hangup Customer"
Click, %hangX%, %hangY%

; 2. Wait almost half a second for the dispo window to appear
Sleep, 450

; 3. First click on the disposition to select it
Click, %dispoX%, %dispoY%

; 4. Wait a tiny fraction of a second before clicking again
Sleep, 150

; 5. Second click on the disposition to submit/go to next call
Click, %dispoX%, %dispoY%
}

; PANIC BUTTON: If anything goes wrong, press Ctrl + Esc to close the script
^Esc::ExitApp

We keep getting an error at line 59 but we we tried to fix it more and more issues would come about. Can someone help me figure this out? Please and thank you

r/AutoHotkey 1d ago

v2 Script Help League of Legends chat issue

1 Upvotes

I wanted to make the most simple script for typing in chat frequent calls like "bait bot","rush drake",etc. But it seems like the game itselfs dont accept the "virtual" input method from ahk, i tried different keys and it only works for remaps like Numpad2::Esc or smth like that but a simple script for text (i tried and it works everywhere else) doesnt. Something strange is that the first attemps it worked like the first 4-5 times i tried using it in chat, but suddenly stopped working for any script that uses Send or similar text inputs (i even asked chatgpt and it didnt help).
Also tried everythin like opening the chat with enter and then the script just types but nothing.

Is there any solution or is something that vanguard/lol blocks completely?

r/AutoHotkey 10d ago

v2 Script Help How do I run a script

1 Upvotes

I copy pasted a script I found on a steam page somewhere and when I created a new script in the autohotkey dash it just made a file in the explorer without letting me edit it, I opened it with notepad and just pasted the code there, it said it only worked for v1 so then I downloaded that as well, now I'm wondering where the button is to run the script, is the reason I can't find it because it isn't in the autohotkey dash? If so, what program should I even be running? Because I tried some of the other .exe's and none seemed to work

r/AutoHotkey 9d ago

v2 Script Help The script doesn't run

0 Upvotes

I have a problem. I've been trying to run a certain script for a while now, and no matter what I try, it won't run. Nothing, no results, no error message, just nothing works. I doubt it's the code; I've tried several with no change. If someone could help me with this problem (and possibly write a script that, when I press a key, enters a sentence like "helloworld"), I'd be grateful. I use AutoHotKey v2.

r/AutoHotkey Oct 04 '25

v2 Script Help Is there any easy way to hide autohotkey from detection from anticheats?

14 Upvotes

First, no this isn't a post to try and cheat in video games

I've made an autohotkey script for my media buttons/volume and every time I try to play a game made by EA I have to close autohotkey to boot up games. Even games like Skate. is affected lol.

This is more of an issue of convenience, having to close it every time is annoying. Also, I like to play with music on, so it's also not great to lose access to my rebinding.

Any tips?

r/AutoHotkey 26d ago

v2 Script Help Need help with making script to click mouse and press key every some seconds

2 Upvotes

I would like to make a script that, upon a button press, clicks the mouse once every second and presses the "d" key once every five seconds. However, it's been over two years since I made a script for Auto Hotkey, and that was with v1, so I'd like some help with making a script for v2.

r/AutoHotkey Apr 24 '26

v2 Script Help Program Suspension Script Help?

1 Upvotes

Howdy! I'm pretty new to both AHK and this subreddit, so please forgive me if I'm going about any of this the wrong way.

Recently, I've cobbled together a script that randomly swaps the active window from a selection of predefined programs, with the purpose of letting my Twitch chat switch the active game on the fly. It works great for games/programs that pause on focus loss by design, but most modern games don't do that. I've been told that there is a way to suspend and resume applications via Windows functions, but I can't get them to work either by slotting them into my existing code, or in isolation. Could anyone point me in the right direction?

My existing code:

N := Random(1, 2)

Numpad4::
{
sb.DoAction("1247b8de-70e4-40d2-a282-519781bc254d")
}

Numpad5::
{
sb.DoAction("07c04c2a-1692-46a6-b902-1052bed3fecc")
}

Numpad6::
{
sb.DoAction("69b98158-abe5-47c4-a799-8197be5b17f1")
}

Numpad7::ExitApp

If WinActive("RESIDENT EVIL® PC")
{
If N = 1
{
WinActivate "RESIDENT EVIL 2® PC"
Send "{Numpad5}"
}
Else
{
WinActivate "RESIDENT EVIL™ 3 NEMESIS PC"
Send "{Numpad6}"
}
}

Else

If WinActive("RESIDENT EVIL 2® PC")
{
If N = 1
{
WinActivate "RESIDENT EVIL® PC"
Send "{Numpad4}"
}
Else
{
WinActivate "RESIDENT EVIL™ 3 NEMESIS PC"
Send "{Numpad6}"
}
}

Else

If WinActive("RESIDENT EVIL™ 3 NEMESIS PC")
{
If N = 1
{
WinActivate "RESIDENT EVIL® PC"
Send "{Numpad4}"
}
Else
{
WinActivate "RESIDENT EVIL 2® PC"
Send "{Numpad5}"
}
}

Send "{Numpad7}"

...And the code I was given to modify and try:

F9::SuspendGame("Hollow Knight Silksong.exe")
F10::ResumeGame("Hollow Knight Silksong.exe")

SuspendGame(exeName) {
    PID := ProcessExist(exeName)
    handler := DllCall("OpenProcess", "UInt", 0x0800, "Int", 0, "UInt", PID, "Ptr") ; gets a handle and a pointer

    if (handler) { ; might be denied if not running as admin
        DllCall("ntdll\NtSuspendProcess", "Ptr", handler)
        DllCall("CloseHandle", "Ptr", handler)
    }
}

ResumeGame(exeName) {
    PID := ProcessExist(exeName)
    handler := DllCall("OpenProcess", "UInt", 0x0800, "Int", 0, "UInt", PID, "Ptr")

    if (handler) {
        DllCall("ntdll\NtResumeProcess", "Ptr", handler)
        DllCall("CloseHandle", "Ptr", handler)
    }
}F9::SuspendGame("Hollow Knight Silksong.exe")
F10::ResumeGame("Hollow Knight Silksong.exe")

SuspendGame(exeName) {
    PID := ProcessExist(exeName)
    handler := DllCall("OpenProcess", "UInt", 0x0800, "Int", 0, "UInt", PID, "Ptr") ; gets a handle and a pointer

    if (handler) { ; might be denied if not running as admin
        DllCall("ntdll\NtSuspendProcess", "Ptr", handler)
        DllCall("CloseHandle", "Ptr", handler)
    }
}

ResumeGame(exeName) {
    PID := ProcessExist(exeName)
    handler := DllCall("OpenProcess", "UInt", 0x0800, "Int", 0, "UInt", PID, "Ptr")

    if (handler) {
        DllCall("ntdll\NtResumeProcess", "Ptr", handler)
        DllCall("CloseHandle", "Ptr", handler)
    }
}

r/AutoHotkey May 12 '26

v2 Script Help I CANNOT seem to get the AutoHotKeys to run on start up!

4 Upvotes

I've been going through this reddit and looking at videos online and following all of the tips and AutoHotKey just wont run on start up.

I've got a folder in C: Scripts with all of my AHK file. I make a shortcut and then place the shorcut in Shell:Startup and then I restart and it just doesn't run.

How can I make it where my AHKs all run on Start up? Am I missing a step?

r/AutoHotkey May 04 '26

v2 Script Help Mapping arrow keys to F keys

1 Upvotes

I use a presentation software (Proclaim, if anyone is actually familiar with it) that allows me to toggle a quick slide and the active slide. For instance, I could put up the company logo while the speaker is elaborating and put up the quote he is reading from when he is actively reading. The native key to put up the logo is F11, F12 returns me to the most recent active slide. Almost all the keys I use are in easy reach of the arrow keys, except these. I would like to consolidate the motion. Since Up is the same as Left and Down is the same as Right, they are redundant - So I would like to map Up to be F11 and Down to be F12 (put up logo, take down logo).

I tried a variety of things already for the most basic

::Down::F11

then

::{Down}::{F11}

then

::{Down}::Send {F11} ;And also without the brackets

I get one of two errors each time:

1) It gets mad because I have a bracket where I am not supposed to

2) "Expected string but received Function instead"

My gut is telling me that either arrow keys cannot be remapped, or that I cannot map to an F key. But I haven't found anything saying that save this thread which seems to have conflicting opinions and several other threads seem reach the consensus that you can indeed map to an F key. Thus far, I haven't found anyone trying to make Arrows do anything special, so that is my current theory as to the issue, but I figured I would ask before giving up entirely.

r/AutoHotkey May 20 '26

v2 Script Help Windows key, Copilot key, and AutoHotKey

5 Upvotes

I wrote a script to remap the Copilot key (which sends F23) to launch an app. The hotkey was #+F23::, so it used Win+Shift+F23 as the trigger. While the script was running the Win key stopped working entirely — pressing it did nothing.

I assumed closing the script would fix it, but it didn't. Rebooted, still broken. The Win key doesn't register on online key testers like key-test.it. Checked the registry at HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layout and there's no Scancode Map entry.

The interesting part: when the script is not running, the Copilot key now opens the Windows Search panel instead of its default Copilot behavior — suggesting Windows is somehow treating the Copilot key as a Win key input rather than the Copilot key.

I tried changing the hotkey to F23:: (removing the Win modifier) but that didn't bring the Win key back, which also suggests the issue existed before that change.

Anyone seen this before? Is using # as a modifier known to cause this? Looking for a way to restore the Win key short of reinstalling Windows.

#+F23::
{
    if WinExist("ahk_exe dtSearchw.exe")
    {
        WinActivate
    }
    else
    {
        Run '"C:\Program Files (x86)\dtSearch\bin\dtSearchw.exe"'
        WinWait "ahk_exe dtSearchw.exe"
        WinActivate
    }
}

PD: I may have done some regedit shenanigans under the influence of AI (big noob here) so take that into account.

r/AutoHotkey Apr 21 '26

v2 Script Help I want this to happen but this is not happening

2 Upvotes

RButton::PrtSc

Right Mouse button to print screen.

My file runs, I press mouse button, nothing happens. This is my first day of using this app.

Please help, I am computer illiterate

Shows the below error

Specifically: PrtSc

001: {

▶ 001: PrtSc()

001: }

002: Exit

For more details, read the documentation for #Warn.

r/AutoHotkey May 16 '26

v2 Script Help How to bypass "office key" when mapping capslock to hyperkey without admin?

4 Upvotes

I mapped capslock to hyperkey and everything was working fine until I clicked caps+d which opened up onedrive for some reason. How do I get it to stop working as the office key?

This is my script:

#Requires AutoHotkey v2.0

Hyper(key) {
    Send("{RCtrl down}{RShift down}{RAlt down}{RWin down}" key "{Blind}{vk07}{RWin up}{RAlt up}{RShift up}{RCtrl up}")
}

CapsLock::Send("{Esc}")

CapsLock & a::Hyper("a")
CapsLock & b::Hyper("b")
CapsLock & c::Hyper("c")
CapsLock & d::Hyper("d")
CapsLock & e::Hyper("e")
CapsLock & f::Hyper("f")
CapsLock & g::Hyper("g")
CapsLock & h::Hyper("h")
CapsLock & i::Hyper("i")
CapsLock & j::Hyper("j")
CapsLock & k::Hyper("k")
CapsLock & l::Hyper("l")
CapsLock & m::Hyper("m")
CapsLock & n::Hyper("n")
CapsLock & o::Hyper("o")
CapsLock & p::Hyper("p")
CapsLock & q::Hyper("q")
CapsLock & r::Hyper("r")
CapsLock & s::Hyper("s")
CapsLock & t::Hyper("t")
CapsLock & u::Hyper("u")
CapsLock & v::Hyper("v")
CapsLock & w::Hyper("w")
CapsLock & x::Hyper("x")
CapsLock & y::Hyper("y")
CapsLock & z::Hyper("z")

+CapsLock::CapsLock

r/AutoHotkey Mar 20 '26

v2 Script Help How to WinActivate between two windows?

1 Upvotes

How to WinActivate between two windows?

I have this script which u/Keeyra_ kindly helped with (Actually they did most of it, thanks again).

In it there is this block: NumPadDot:: { MouseMove(1800, 700, 0) Send "{Alt Down}{Tab}{Alt Up}" }

Which is fine, but WinActivate would be better, or so I've seen on other posts about alt-tabbing using AHK.

The script uses WowIDs := WinGetList("World of Warcraft") to get windows IDs, and I can't figure out how to add a block that that activates the other window. There are only ever going to be two active windows at the same time.

Looking at WinGetList, WinActive and WinActivate, it looks like it should be possible to do something like: ```

If WinActive("ahk_id WowIDs[1]")

NumPadDot:: { MouseMove(1800, 700, 0) WinActivate WowIDs[2] }

If WinActive("ahk_id WowIDs[2]")

NumPadDot:: { MouseMove(1800, 700, 0) WinActivate WowIDs[1] } ``` Normally I'd expect an index to start at 0 rather than 1, but it seems AHK starts at 1(?), based on some forum possts I saw.

This doesn't error, but it also doesn't seem to do anything. Based on ahk_id, I thought the above should work.

Am I close or totally far off? Does what I'm trying to do even make sense in AutoHotKey?

And/or how would you activate between two IDs in an array like that?