The other day I demonstrated how to send “paste” to a window instead of sending keystrokes.
As with all things, there are multiple ways to achieve your goal. In this version I demonstrate Pasting with SendMessage in AutoHotkey to paste on “some” windows.
Pasting with SendMessage in AutoHotkey
;~by jeeswg https://www.autohotkey.com/boards/viewtopic.php?p=271514 (tweaked by Joe Glines)
ClipSave := ClipboardAll ; Save Clipboard
Clipboard := “this is from my script” ; Update Clipboard with Text to send
ControlGetFocus, vCtlClassNN, A
ControlGet, hCtl, Hwnd,, % vCtlClassNN, A
SendMessage, 0x302,,,, % “ahk_id ” hCtl ;WM_PASTE := 0x302
Clipboard := ClipSave ; Restore Clipboard