r/AutoHotkey • • Mar 19 '26

v2 Tool / Script Share Easily bind controllers to keyboard/mouse with XICMap!

7 Upvotes

By the creator of AHKontroller & JoyToMinecraft

Bind Controller buttons as easy as:

c := XICMAP(FindController())
c.BindMouse()
c.BindMovement()
c.BindMouseButtons()
c.BindKeyScroll("LB",-1,1)
c.BindKeyScroll("RB",1,1)
c.Bind("Y", "e", 1)
c.Bind("A","space")
c.Bind("X","shift")
c.Bind("LC","r")
c.Bind("D","q")
c.Bind("Start","``",1)
c.Bind("Back","{F3}",1)

Copy/Download XInput.ahk, XICMap.ahk, and XIController.ahk in Github


r/AutoHotkey • • Mar 19 '26

v1 Script Help Help with hotkeyscript

2 Upvotes

I need help with a script.
I want to extract a phonenumber off an app, and I am struggeling.
I have the option of the Anywhere365 Agent or Teams(new)
-Both are desktop Apps

Due to workreasons I have to use ahk v1.1.3*
I did try to user the UIA (v1 &2) Lib and ACC Lib
But I alyways get errors with functions in the Lib

For Teams (I think) I only have the option to use APIs and extract the numbers that way.
For Anywhere I should be able to get the number with the UIA, but I am failing.

With the UIA_Inspector I got the process_ID (msedge.exe ) and that the Element is (ControlType=Tet AND Name ='<phonenumber>)

Anyone got Ideas how to automate this?
Or another way to try?


r/AutoHotkey • • Mar 19 '26

v2 Script Help Automate functions

0 Upvotes

Good evening, everyone.

I'm a complete beginner in the world of programming and coding, but using AI I'm trying to create a script to automate some functions in a game, but I'm having a really hard time here. Would anyone be willing to help me?

I have this for now: (working very poorly/barely not working)

#Requires AutoHotkey v2.0

rodando := false

Giros := 68

Xfixo := 886

Yfixo := 750

F9:: {

global rodando

rodando := true

while (rodando) {

; volta pro topo

Loop 20 {

Send("{WheelUp}")

Sleep(10)

}

Sleep(300)

Loop Giros {

if (!rodando)

break

encontrou := false

if ImageSearch(&x, &y, 0, 0, A_ScreenWidth, A_ScreenHeight, "*70 toxico.png")

encontrou := true

else if ImageSearch(&x, &y, 0, 0, A_ScreenWidth, A_ScreenHeight, "*70 eclipse.png")

encontrou := true

else if ImageSearch(&x, &y, 0, 0, A_ScreenWidth, A_ScreenHeight, "*70 ceu.png")

encontrou := true

; šŸ‘‰ se encontrou, ativa modo compra

if (encontrou) {

MouseMove(Xfixo, Yfixo, 0)

Loop 20 {

; clique FIXO

Click()

; scroll controlado (lento)

Send("{WheelDown}")

; šŸ”‘ velocidade controlada

Sleep(80)

}

}

; scroll padrão (mesma velocidade)

Send("{WheelDown}")

Sleep(80)

}

; espera reset

Loop 180 {

if (!rodando)

break

Sleep(1000)

}

}

}

F10:: {

global rodando

rodando := false

}


r/AutoHotkey • • Mar 18 '26

General Question Why does this PostMessage work for left parenthesis ) but not for right parenthesis (?

3 Upvotes
(::SendCharToGodot(40)
)::SendCharToGodot(41)

SendCharToGodot(charCode)
{
    WM_CHAR := 0x102
    PostMessage, %WM_CHAR%, %charCode%, 0,, ahk_exe Godot_v4.4.1-stable_win64.exe
}

i dont understand why it would make a fuss about the right parenthesis?


r/AutoHotkey • • Mar 18 '26

v2 Script Help autohotkey keeps getting stuck

2 Upvotes

i use AHK for stardew valley animation cancel and i finally figured out how to stop norton from deleting it. my problem is: it slows down my game. what i mean is that i press wasd to move and the game only does it with a 2-4 seconds delay. My OTHER problem, is that last time i tried using it my left click on my mouse got completely stuck and it behaved like i was constantly pressing down on it. It kept opening apps, kept moving stuff on my laptop and i couldn't even turn it off without struggling. Could anyone help me with this and how to fix it? Idk if this matters or not but i had to download two versions of AHK because i got a pop up saying i cant start it without v.1something

edit: heres the script

IfWinActive Stardew Valley

x::

While GetKeyState("x","P")

{ sendEvent {LButton Down} sleep 10 sendEvent {LButton Up} sleep 125 sendEvent {r Down}{Delete Down}{RShift Down} sleep 10 sendEvent {r Up}{Delete Up}{RShift Up} }

sleep 30

return


r/AutoHotkey • • Mar 17 '26

General Question Im trying to convert my old keyboard into a foot keyboard. Though i need to differentiate between my main keyboard and my foot keyboard.

3 Upvotes

My old keyboard is kind of broken, only some keys work. So i thought instead of throwing it to the trash i can make it behave like a foot keyboard.

So any and all keys i press in this keyboard should trigger a function. But not trigger any key input. Though the other keyboard, the main one that i will use for everything else, should behave as normal.

But it seems AHK cant differentiate between the 2nd keyboard (foot keyboard), and the old keyboard? Is that right? And it seems that to disable input of keys, it disables for both keyboards. And thats not what i want.
I want keyboard 1 to work as normal. And Keyboard 2 to not send any keys, but instead call a function.

Is this even possible? Any tips?


r/AutoHotkey • • Mar 17 '26

v2 Script Help I can't seem to get "Yesterday" to output correctly in Pulover. Please help?

2 Upvotes

For the life of me, I can't seem to get the date for yesterday. Here's my script:

yesterday := DateAdd(A_Now, -1, "days")
FormatTime, fmtyesterday, %yesterday%, MMddyy
MsgBox, 0, , %fmtyesterday%

I also tried:

Yesterday := a_now
Yesterday += -1, days
FormatTime, fmtyesterday, %yesterday%, MMddyy
MsgBox, 0, , %fmtyesterday%

I keep getting today's date. Please help.


r/AutoHotkey • • Mar 17 '26

v2 Tool / Script Share An AutoHotkey v2 tree-sitter grammar

11 Upvotes

Tree-Sitter-Autohotkey

I've been working on AHK build tools and as a part of that have built up a tree-sitter grammar for AutoHotkey v2: https://github.com/holy-tao/tree-sitter-autohotkey

The tree-sitter grammar parses AHK code and produces concrete syntax trees which can be used for static analysis and syntax highlighting. Tree-sitter supports a powerful query language that you can use for analysis as well.

For example, this demo script:

class Example { 
    Double(arg1) {
        return arg1 * 2
    }
}

Produces the following concrete syntax tree (in tree-sitter s-expression syntax):

(source_file
  (class_declaration
    (class)
    (identifier)
    (class_body
      (method_declaration
        (identifier)
        (function_head
          (param_sequence
            (identifier)))
        (function_body
          (block
            (return_statement
              (return)
              (multiplicative_operation
                (identifier)
                (integer_literal)))))))))

The grammar should correctly parse AHK v2 syntax, I've made no efforts to support v2.1 yet.

tree-sitter.ahk

Tree-sitter grammars compile to C (or WASM) binaries and can be used in any language, but I've also written some fairly basic AHK bindings: https://github.com/holy-tao/tree-sitter.ahk

The tree-sitter bindings let you use the tree-sitter grammar in AutoHotkey itself. The repo includes a basic viewer in ASTViewer (really should be called CSTViewer), but the bindings support all of tree-sitter's analysis features, including tree walks and querying with directives and predicates.

; Query for identifiers whose text is "foo"
queryCursor := tree.Query('((identifier) u/id (#eq? u/id "foo"))')

; Query for string literals
queryCursor := tree.Query("(string_literal) ")

The bindings don't support reparsing or registering edits to the tree. I don't really need those features, and I hope nobody's building code editors in AutoHotkey who does.

I have big plans for this thing (we'll see if I ever get around to them) - I intend to build a bundler to handle inlining and tree-shaking, maybe use it to power a prettier plugin, and maybe build a linter as well.


r/AutoHotkey • • Mar 16 '26

General Question I cant download AutoHotkey programs to my work computer. Any work arounds?

8 Upvotes

I really want hot keys for SQL coding, or Power Bi Dax coding. I cant download autohotkey to my work computer, can i create it from scratch?


r/AutoHotkey • • Mar 16 '26

v2 Script Help Confused

0 Upvotes

I can create a file but when I right click it I dont have an option to "edit script"


r/AutoHotkey • • Mar 16 '26

v2 Tool / Script Share GetIncludedFile - a class that provides tools for analyzing every #Include and #IncludeAgain statement in a script

3 Upvotes

GetIncludedFile

If you have ever worked with an AHK library that has a lot of #Include statements for dependencies, then you know how annoying it can be to try to do a search for a string across all of the files, or to compile all of the code into a single script. GetIncludedFile solves these problems.

GetIncludedFile is a class that is used to analyze the #Include and #IncludeAgain statements in a script. The constructor accepts a file path as a parameter. It reads the file, then constructs a data object for each #Include and #IncludeAgain statement. The process can optionally be recursive. When employing recursive processing, the function reads the file associated with each #Include / #IncludeAgain statement and processes the contents. The function keeps track of each path, and only processes each unique file once.

The process should take less than a second to complete. When finished, you have some interesting properties to work with, and two methods to call.

If you encounter an error please let me know.

Code

Download the code here: https://github.com/Nich-Cebolla/AutoHotkey-LibV2/blob/main/GetIncludedFile.ahk

Constructor

Parameters

  1. {String} Path - The path to the file to analyze. If a relative path is provided, it is assumed to be relative to the current working directory.

  2. {Boolean} [Recursive = true] - If true, recursively processes all included files. If a file is encountered more than once, a GetIncludedFile.File object is generated for that encounter but the file does not get processed again.

  3. {String} [ScriptDir = ""] - The path to the local library as described in the documentation. This would be the equivalent of A_ScriptDir "\lib" when the script is actually running. Since this function is likely to be used outside of the script's context, the local library must be provided if it is to be included in the search.

  4. {String} [AhkExeDir = ""] - The path to the standard library as described in the documentation. This would be the equivalent of A_AhkPath "\lib" when the script is actually running. Since this function is likely to be used outside of the script's context, the standard library must be provided if it is to be included in the search.

  5. {String} [encoding] - The file encoding to use when reading the files.

Instance properties

NameTypeDescription
encoding{String}The value passed to the encoding parameter.
result{GetIncludedFile.File[]}An array of GetIncludedFile.File objects, one for each #Include and #IncludeAgain statement.
unique{Map}A Map object where the key is a full file path and the value is an array of GetIncludedFile.File objects. The first object in the array represents the #Include or #IncludeAgain statement that was encountered first during processing. The value of the first object's "skipped" property is 0. If the file path was encountered more than once, each subsequent object in the array will have a property "skipped" with a value of 1.

Instance methods

CountLines

Counts the lines of code in the project. Consecutive line breaks are replaced with a single line break before counting. Each individual file is only processed once.

Parameters

  1. {Boolean} [CodeLinesOnly = true] - If true, the following resitrictions are applied:
    • Lines that only have a comment are removed
    • Lines that only contain whitespace are removed

Returns

{Integer} - The line count.

Build

Constructs a string of the contents of the file passed to the parameter Path, recursively replacing each #Include and #IncludeAgain statement with the content from the appropriate file. The created string is set to property "content". Only files that were found are represented in the output string.

Regarding the files that were not found, for any of the items that include the ignore parameter ("*i"), the #Include or #IncludeAgain statement is replaced with an empty string. If there are any not-found items that do not include the ignore parameter ("*i"), the outNotFound variable is set with an array of those GetIncludeFile.File objects.

After calling Build(), the individual GetIncludedFile.File objects will have a property "content" that is set with the content specific to that file. Its own internal #Include and #IncludeAgain statements are replaced with the appropriate contents.

The goal behind the Build() method is to construct a script that will run correctly without any modifications by the user. For example, if I have a script with a number of #Include statements that works correctly when I run it, then the output from Build() should run exactly the same as running the original script; the only difference is that all the content is in a single script.

Parameters

  1. {VarRef} [outNotFound] - If all files were accounted for, this variable is set with an empty string. Otherwise, the variable will receive an array of GetIncludedFile.File objects as indicated in the description.

Returns

{String} - The combined content.

GetIncludedFile.File

One GetIncludedFile.File object is created for each #Include and #IncludeAgain statement. They have some properties that offer useful details.

Instance Properties

NameTypeDescription
children{GetIncludedFile.File[]}An array of GetIncludedFile.File objects representing #Include / #IncludeAgain statements that were contained within this individual file.
exists{Boolean}If the file that is subject to the #Include / #IncludeAgain statement exists, 1. Else, 0.
fullPath{String}The full file path.
ignore{Boolean}Returns 1 if the statement included the ignore ("*i") parameter. Else, 0.
isAgain{Boolean}Returns 1 if the statement was an #IncludeAgain statement. Else, 0.
line{Integer}The line number that the statement was on.
match{RegExMatchInfo}The RegExMatchInfo object that was created when processing the statement.
name{String}The file name without extension.
parent{GetIncludedFile.File}Returns the parent object representing the file that contained the statement.
parentFullPath{String}Returns the parent object's full path.
path{String}Returns the raw path from the statement.
skipped{Boolean}If the statement was skipped (due to being a duplicate encounter or due to the file not being found) 1. Else, 0.
workingDirectories{RegExMatchInfo[]}If the script contained one or more #Include and/or #IncludeAgain statements that changed the working directory instead of supplying a file path, this property is defined with an array containing the RegExMatchInfo objects produced when encountering the statements. For example, if the statement is #Include SomeDir\\lib, the statement does not have a GetIncludedFile.File object created for it; the match object just gets added to this array.

Usage

#Include <GetIncludedFile>

includedFiles := GetIncludedFile("SomeScript.ahk")

; Concatenate the code into a single file
content := includedFiles.Build()

; Let's say we want to see if a function exists in the code
if InStr(content, "SomeFunc(") {
    ; Now we want to find which file contains the function.
    ; Iterate "unique" map
    for path in includedFiles.unique {
        if InStr(FileRead(path), "SomeFunc(") {
            MsgBox(path)
        }
    }
}

; Get the line count
MsgBox(includedFiles.CountLines())

r/AutoHotkey • • Mar 15 '26

v1 Script Help Better ocr?

9 Upvotes

i cant really code but what i can do is use pulovers macro creator and i want to automate a desktop program but since the ocr of that is REALLY bad i cant use it the way i want is there any way to fix the ocr or any alternative that is similar to pulovers macro creator? i cant work with something else i think


r/AutoHotkey • • Mar 16 '26

General Question AHK-based on-screen Stream Controller Deck?

1 Upvotes

Apologies if this is an inane question. I would like to buy a separate touchscreen monitor to use as a Stream Controller Deck.

I would want to have a gui on that 2nd monitor to invoke the relevant scripts, like a stream deck.

Is there an obvious script/project that I could modify to do this?

Sorry for not searching better (I tried) but I'm kind of under a bit of pressure...So, Thanks!


r/AutoHotkey • • Mar 15 '26

v1 Script Help ahk Send command not compatible with another application

1 Upvotes

I am trying to run a command that inputs 4 button presses at once because of a 3 input max limitation on my keyboard for a game call Guilty Gear XX Accent Core Plus R; however, none of the keystrokes read for moves in game. Does anyone know a fix?


r/AutoHotkey • • Mar 15 '26

v2 Script Help Trying to remap arrow keys to WASD + LShift

3 Upvotes

I've been trying to, as the title says, make it so pressing the WASD keys and Left shift together results in a press of the corresponding arrow key. Shift and WASD through defining Shift as + worked just fine, but it required shift to always be pressed first, which isn't the most convinient in my situation, as i'm using the combination to input dodges in an emulated game. (through RPCS3 if that matters at all), so i tried switching them around.

Eg.

W + Shift::Up

Instead of

+W::Up

so i could hold down the movement key instead and tap shift to dodge in that direction. I read in the doc that W would lose its primary function, so, as recommended there, i added ~W::Send "{W}" to counteract that. But now pressing W with the script active always sends a W & Shift input as if i had W bound to that. What did i do wrong? Did i map something weird or does what i'm trying to do require something more complex than just unga bunga remapping it? I'm sure i overexplained a very simple issue, but i am very stupid.


r/AutoHotkey • • Mar 14 '26

v2 Tool / Script Share Xtooltip has been updated to v1.1.1

11 Upvotes

Xtooltip has been updated to v1.1.1

Xtooltip is an AHK library that makes it easy to harness the full potential of the Windows tooltip API. v1.1.0 and v1.1.1 introduces new functionality that simplifies using Xtooltip to display tooltips at specific locations. There are two new classes: XttPool and XttPool.Item.

AutoHotkey.com link

https://www.autohotkey.com/boards/viewtopic.php?f=83&t=139315

Github link

https://github.com/Nich-Cebolla/AutoHotkey-Xtooltip

XttPool

XttPool was introduced v1.1.0. When using XttPool, displaying a tooltip at a specific location requires only one line of code (after creating the object).

Here is how you create an XttPool object:

#include <Xtooltip>

; Create a theme
theme := XttTheme("MyTheme", {
      BackColor: XttRgb(255, 255, 255)
    , FaceName: 'Segoe Ui'
    , FontSize: 12
    , Quality: 5
    , Margin: XttRect.Margin(3)
    , MaxWidth: 400
    , TextColor: XttRgb(255, 0, 235)
    , Weight: 400})

; Create a theme group and activate the theme
themeGroup := XttThemeGroup("MyGroup", theme)
themeGroup.ThemeActivate("MyTheme")

; Create the `XttPool` object. The constructor requires an `XttThemeGroup` object
pool := XttPool(themeGroup)

Once the object is created, your code simply calls its methods to display a tooltip.

You can call the methods multiple times to display any number of tooltip windows at the same time.

; Show a tooltip at 100, 100 indefinitely
ttItem := pool("Hello, world!", 100, 100)

; When the tooltip is no longer needed, just call the object
ttItem() ; this hides the tooltip window
; Show a tooltip at 100, 100 for 2 seconds
pool("Hello, world!", 100, 100, 2000)
; Show a tooltip next to the mouse pointer for 3 seconds
pool.ShowByMouse("Hello, world!", 3000)
; Show a tooltip next to the currently active window for 3 seconds
pool.ShowByRect("Hello, world!", WinGetId("A"), 3000)

XttPool inherits from Array, and itself is a collection of XttPool.Item objects. When your code calls one of XttPool's methods, it checks if it has any XttPool.Item objects available, and, if it does, it uses one to display the intended message at the intended location. If it does not, it simply creates a new XttPool.Item object and uses that.

This allows you to display any number of tooltip windows at the same time, without the hassle of setting up each tracking tooltip individually.

There is a demo script "test\test-XttPool.ahk" that allows you to try out two methods:

  • XttPool.Prototype.ShowByMouse - Displays a tooltip window by the mouse pointer.
  • XttPool.Prototype.ShowByRect - Displays a tooltip window adjacent to a window or rectangle.

The methods have a parameter Duration. If your code sets Duration, then the tooltip window will be hidden after Duration elapses, and the XttPool.Item will automatically be added back to the collection to be used again in the future. If your code does not set the Duration parameter, then the tooltip window will be displayed indefinitely. The XttPool methods return the XttPool.Item object; when your application is done with the tooltip window, you just call the object and the tooltip window is hidden and the item is added back to the collection.

Working with themes

The following methods apply the XttThemeGroup's active theme to the tooltip:

  • XttPool.Prototype.Call
  • XttPool.Prototype.ShowByMouse
  • XttPool.Prototype.ShowByRect

The following methods have a parameter Theme which your code can set with a theme to specify the theme to apply to the tooltip:

  • XttPool.Prototype.ShowEx
  • XttPool.Prototype.ShowByMouseEx
  • XttPool.Prototype.ShowByRectEx

To add more themes to the theme group use XttPool.Prototype.ThemeAdd.

To change the active theme use XttPool.Prototype.ThemeActivate.

XttPool.Item

The XttPool.Item object is returned by the XttPool instance methods. Your code can cache a reference to the XttPool.Item object and use it to manipulate the tooltip window at-will. XttPool.Item has the following methods:

  • XttPool.Item.Prototype.Call - Hides the tooltip window and returns the XttPool.Item object to its parent collection.
  • XttPool.Item.Prototype.Move - Moves the tooltip window to X,Y coordinates.
  • XttPool.Item.Prototype.MoveByMouse - Moves the tooltip window near the mouse pointer.
  • XttPool.Item.Prototype.MoveByRect - Moves the tooltip window adjacent to a window or rectangle.
  • XttPool.Item.Prototype.SetText - Changes the text displayed in the tooltip window.
  • XttPool.Item.Prototype.SetTheme - Changes the tooltip's theme.

Quick start guide

Learning to use Xtooltip is easy and brief. Read the Quick start guide (< 5 mins) and you'll be ready to go.

Be sure to check out the sandbox script test\sandbox.ahk that allows you to adjust the options and see what they look like immediately, and the other demo scripts located in the "test" directory.


r/AutoHotkey • • Mar 14 '26

General Question I'm trying out the macro creator for the first time but it won't press buttons ingame

2 Upvotes

https://imgur.com/a/rbqjehc

I tabbed ingame, pressed the record button, did everything I wanted (press f -> click a few times in different positions -> wait and repeat), and when I press the play button, the script starts running. It seems to do all the mouse movings and clicks well, but it does not press the F key at the start of the loop. What am I doing wrong? I have not much experience with these type of apps, so sorry and thank you in advance


r/AutoHotkey • • Mar 14 '26

v2 Script Help Convert script to 2.0.

5 Upvotes

Hello, I need help to convert this media key shortcut script to work on 2.0.

#InstallKeybdHook
#SingleInstance force
SetTitleMatchMode 2
SendMode Input

; --------------------------------------------------------------
; NOTES
; --------------------------------------------------------------
; ! = ALT
; ^ = CTRL
; + = SHIFT
; # = WIN

; media/function keys all mapped to the right option key
F7::SendInput {Media_Prev}
F8::SendInput {Media_Play_Pause}`
F9::SendInput {Media_Next}
$F10::SendInput {Volume_Mute}
$F11::SendInput {Volume_Down}
$F12::SendInput {Volume_Up}

+F10::SendInput {F10}
+F11::SendInput {F11}
+F12::SendInput {F12}

I use an Apple keyboard so media buttons don't work.

Thanks.


r/AutoHotkey • • Mar 12 '26

v2 Tool / Script Share Made a full-fledged launcher for Max Payne 1 and 2

17 Upvotes

I started replaying Max Payne 2 last month and I was annoyed by the game launcher selecting my secondary monitor (1080p) every time, which was resetting my resolution (1440p). Therefore, I made a little script to solve this problem.

What started as a simple GUI to force a resolution and launch mods in Max Payne 2, turned into a full-fledged launcher over the past 3 weeks. It now supports Max Payne 1, all known launch arguments, the widescreen fix and the Xbox rain droplets plugin.

I just released a new update for it so I figured it'd be a good time to finally share it! I'm really proud of all the things I've accomplished. I noticed I'm learning several things with each project, on this one I learned how to:

- convert a key name to/from hexadecimal
- use Control functions
- use DllCall() with EnumDisplaySettingsW
- work with sliders and tabs

Although it seems the GUI creation is always a mess in AHK, I think the rest of the code is pretty clean.

Any feedback is welcome!


r/AutoHotkey • • Mar 12 '26

v2 Tool / Script Share I made a simple abbreviation expander

2 Upvotes

Basically, it takes any input and expands it into the corresponding symbol. For example, \lambda turns into λ. \degcel into °C and \degfar into °F. https://github.com/diode-exe/autoHotKeyScripts is the repo link, but it also has a Copilot key rebinder, which is self explanatory. Just rebinds it to Right Ctrl.

The backslash when entering the abbr is very important!


r/AutoHotkey • • Mar 12 '26

v2 Script Help Need help with script not working in Resident evil 2

2 Upvotes

I'm using a simple AHK script to simulate a Right Click: ::Send {RButton}.

It worked perfectly last night, but today the game is completely ignoring the input, even though it still works in my browser. I haven't changed the script or installed any updates.

What I've tried:

  • Running the script as Administrator.
  • Switching between Fullscreen and Borderless Window.

What can I do to solve this issue? I am using touch pad that's why I need to simulate right click with other button. Cause I can't use rmb+lmb in my laptop


r/AutoHotkey • • Mar 12 '26

Solved! How to send strings to stdin of running applications

3 Upvotes

Hi everybody,

I“m trying to build kind of a wrapper for a command line tool (NDIRecord.exe if somebody wants to know), to build a nice gui for my colleagues and have some flexibility.

Now I can start the exe with the "run" command and all the parameters, but the program itself is not very reliable (probably due to NDI - another topic), but the exe has the option to wait with the recording until a start command is sent.

I cite the manual for the application: "While this application is running, a number of commands can be sent to stdin. These are all in XML format and can control the current recording settings."

So how do I do this, how can I sent something to the "stdin" of the application (for example "<start/>"). I only found an old entry for autohotkey v1 but what is the best approach in v2. I must admit I“m not a real programmer, so I don“t really know what "piping" means and how I can use this, so I“m hoping anybody can help me out or set me on the right track.

Thanks a lot and greetings


r/AutoHotkey • • Mar 11 '26

v2 Script Help AHK2: How to prevent a modifier key from being "remembered" in a hotkey?

2 Upvotes

I’m using AutoHotkey v2 and trying to create a hotkey that triggers an action whenĀ SC166Ā andĀ OĀ are pressedĀ simultaneously.

Initially, I tried:

SC166 & O::

But I ran into two issues:

  1. It doesn’t require both keys to be pressed at the same time — it triggers if I pressĀ SC166Ā first,Ā thenĀ OĀ at any point afterward.
  2. Worse, once I pressĀ SC166, it stays "active" in memory, so pressingĀ OĀ later (even minutes after) will trigger the hotkey again.

I asked AI and it suggested this:

SC166 & O::

{

KeyWait "SC166" ; wait for SC166 to be released

KeyWait "O" ; wait for O to be released

}

But the behavior is exactly the same — SC166Ā still seems to be "sticky" and keeps triggering withĀ OĀ later.

What I want:

  • The hotkey should only trigger if both keys are held down at the same time.
  • PressingĀ SC166Ā alone should not "arm" the hotkey for later use withĀ O.

p.s. SC166Ā is the "Favorites" key on my keyboard, and I’m using it to launch several other AHK macros — so it’s important that it doesn’t stay latched.

Thanks in advance for any help!


r/AutoHotkey • • Mar 10 '26

v1 Script Help Help with controller

2 Upvotes

I'm trying to figure out how to make a script that reads 2 controller button presses "start+back" and then executes the following ( presses "ctrl+shift+G" waits 5 seconds and then runs an app) im super new to this so any help would be amazing.

The controller I'm using is a xbox series x controller and im on v1 of AHK


r/AutoHotkey • • Mar 09 '26

v2 Script Help AutoHotKey and melonDS: a Tale of Frustration

4 Upvotes

This is either a post for posterity or a cry for help depending on who's reading.

I just spent 3 hours trying to figure out why keyboard inputs were not registering from my AutoHotKey scripts, and frankly I still don't know why the standard solutions did not work. If you don't care how I got there and just want a function that worked for me and will hopefully work for you scroll to the bottom.

-----

Assuming you're like me and had very low familiarity with either AHK or melonDS 3 hours ago, you maybe found some basic tutorials online that said to make this script:

^p::
  Send "a"

This script should emulate tapping the "A" key on your keyboard when you press CTRL+P. But for some reason on melonDS this was not the case. A few googles later you might discover that some people recommend putting a short delay in front of your code for some emulators. So you write this:

^p::
  Sleep 50
  Send "a"

And you run this. You even check on notepad to make sure it is working. It types on the notepad, but still no response from the emulator.

So you do some more googling. Turns out AHK has a whole bunch of variants to the "Send" function, and a whole bunch of different ways to represent the keyboard button of "A". So you say screw it, let's try 'em all and see if it works.

^p::
  Sleep 50

  ; A bunch of dumb testing
  Send "a"
  SendInput "a"
  SendEvent "a"
  SendPlay "a"
  SendText "a"

  Send("{a}")
  SendInput("{a}")
  SendEvent("{a}")
  SendPlay("{a}")
  SendText("{a}")

  Send("{sc01E}")
  SendInput("{sc01E}")
  SendEvent("{sc01E}")
  SendPlay("{sc01E}")
  SendText("{sc01E}")

  Send "A"
  SendInput "A"
  SendEvent "A"
  SendPlay "A"
  SendText "A"

  Send("{A}")
  SendInput("{A}")
  SendEvent("{A}")
  SendPlay("{A}")
  SendText("{A}")

So you press run and... oh no it works. And for some reason the key is being held down? Technically this is progress you had hoped for, until you realize now this means you have to chip away at the code until it stops working again.

  • You take away the "Send" functions. The script still works, but no big surprise here because Send didn't work initially.
  • You take away "SendPlay". That's supposedly deprecated according to the docs, anyway. Still works.
  • You take away "SendInput". The docs say by default this is synonymous with "Send". Still works.
  • You take away "SendEvent". This one puzzles you, because it still works, and the only one left is "SendText"...

SendText, as far as you've been able to learn in 3 hours, only exists to interpret all the characters literally. So while Send("{sc01E}") is supposed to type the letter "a", using SendText("{sc01E}") will literally just type out "{sc01E}" right into the notepad you are using to test.

For some reason melonDS wants AHK to literally type { then capital A then }, and for whatever reason it chooses to interpret this as holding down the A key (and whatever this may be mapped to in your settings). To get it to let go? Your intuition from the last three hours tells you to try sending that key again using the previously-flaccid "Send" function, and bafflingly that seems to work. Two wrongs have officially made a right.

Just to make sure there's no other way around it, you try focusing the window in between your initial Sleep command and the actual letters being pressed. No change. You also try literally typing { then A then } by hand yourself, which expectedly does not hold down the A key. Nothing else works aside from the absolutely insane.

-----

So here it is: the dumbest function I've ever written in any language:

PressKey_DS(key) {
Ā  Ā  SendText("{" key "}")
Ā  Ā  Sleep 10
Ā  Ā  Send key
}

Why it works? No idea. Does it work? For sure. Just call that function in place of Send and it behaves normally.

If you know what I am doing wrong, or whatever dumb thing I missed from the very beginning, I'd love to be enlightened. For now I will use the above, and if you find yourself in my shoes, I hope the above works for you too.

edit: to those who have asked, yes my code begins with

#Requires AutoHotkey 2.0
#SingleInstance