Using a tool to read window messages i noted that whenever i past something in an edit control with (ctrl v) on a AutoHotkey GUI
it receives a message of wm_paste, is possible somehow to detect when this happens?
How to detect when something is pasted into an edit control?
Re: How to detect when something is pasted into an edit control?
According to the documentation of the AutoHotkey OnMessage() function, it depends on whether the message is sent or posted to the control:
If the message is posted, then OnMessage() should be able to notify your code of the message arrival.
JB
Code: Select all
Messages sent to a control (rather than being posted) are not monitored because
the system routes them directly to the control behind the scenes. This is seldom
an issue for system-generated messages because most of them are posted.
JB
Re: How to detect when something is pasted into an edit control?
Code: Select all
Gui, Font, s10
Gui, Add, Edit, w250
Gui, Show
#If WinActive("ahk_class AutoHotkeyGUI") && guiClassNN("Edit")
~^v::MsgBox, 64, Pasted text, %Clipboard%
#If
guiClassNN(str := "") {
GuiControlGet, classNN, Focus
Return str > "" ? Instr(classNN, str) : classNN
}
Re: How to detect when something is pasted into an edit control?
Good idea (and script), @mikeyww, but what if a paste occurs via Right-click + Paste?
Re: How to detect when something is pasted into an edit control?
Different question, different script, but I'm not sure of the script.