ControlSend question Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
PipeDreams
Posts: 165
Joined: 19 Dec 2015, 00:20

ControlSend question

Post by PipeDreams » 05 May 2023, 21:30

So in the AHK Doc it says, ControlSend fails on win 11 when using it to send simulated keystrokes to a minimized window or control... Is there a work around, or do we just have to wait for AHK to be updated?

Code: Select all

Run, Notepad,, Min, PID  ; Run Notepad minimized.
WinWait, ahk_pid %PID%  ; Wait for it to appear.
; Send the text to the inactive Notepad edit control.
; The third parameter is omitted so the last found window is used.
ControlSend, Edit1, This is a line of text in the notepad window.{Enter}
ControlSendRaw, Edit1, Notice that {Enter} is not sent as an Enter keystroke with ControlSendRaw.

MsgBox, Press OK to activate the window to see the result.
WinActivate, ahk_pid %PID%  ; Show the result.

[Mod action: Moved topic to v1 section. The main section is for v2.]

Rohwedder
Posts: 7774
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: ControlSend question  Topic is solved

Post by Rohwedder » 06 May 2023, 02:03

Hallo,
this will not change in the future.
If ControlSend does not work, it is not because of the sender (Autohotkey) of the messages but because the receiver (target window) does not want to or cannot accept the messages. Apparently W11 Notepad and W11 command prompt behave differently than their W10 versions.

Post Reply

Return to “Ask for Help (v1)”