I'm trying to run a number of steps on a background window without giving it focus. I've managed to send the first keystroke, but can't figure out how to send the rest. I'm using ControlSend as I read that's what would be needed.
These are the steps I need to run:
F3
Tab
Paste %stringSource%
Tab
Paste %stringTarget%
F12
This is what I have so far:
Code: Select all
#IfWinActive ahk_exe SDLTradosStudio.exe
F12::
Clipboard =
Send, {Control Down}{c}{Control Up}
ClipWait, 0
stringSource = %Clipboard%
msgbox, 4096, Next, Please move to the target segment in Studio, select the term, and then click OK
Clipboard =
Send, {Control Down}{c}{Control Up}
ClipWait, 0
stringTarget = %Clipboard%
; Just to confirm both variables are fine
MsgBox, %stringSource%`r`n%stringTarget%
Sleep 300
SetTitleMatchMode, 2
ControlSend, ,{F3}, SDL MultiTerm
Sleep 300
ControlSend, ,{Tab}, SDL MultiTerm
Sleep, 300
ControlSendRaw, ,%stringSource%, SDL MultiTerm
Sleep 100
ControlSend, ,{Tab}, SDL MultiTerm
Sleep 100
ControlSendRaw, ,%stringTarget%, SDL MultiTerm
Sleep 100
ControlSend, ,{F12}, SDL MultiTerm
Return