How to send TAB to background window

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ndiaz
Posts: 73
Joined: 10 Jan 2017, 17:05
Contact:

How to send TAB to background window

06 Jan 2020, 13:21

Hello,

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
It works as far as sending F3. Could it be that TAB cannot be sent with ControlSend to a background application?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Tech Stuff and 388 guests