This is a bit closea but still not sure
hotkeyset("r","pressr")
While 1
Sleep(10)
WEnd
func pressr()
send ("a"); active untitled notepad
sleep(50) ;<-------------------------------------------------this helps alot(add sleep, send/sleep/controlsend)
AutoItSetOption("WinTitleMatchMode", 4)
$handle = WinGetHandle("classname=Notepad", "")
ControlSend($handle, "", "Edit1", "logger")
Endfunc