Page 1 of 1

Alt Tab Script

Posted: 09 Jun 2018, 14:25
by YungGod
Hey forum!
So I'm wondering if it's possible to make a script where u can be alt tabbed out of the program you want the script to run in. So simply put: Can i make a script that only runs in a specific program and let's me do other stuff meanwhile it runs?
Looking forward to seeing your suggestions!

- YungGod -

Re: Alt Tab Script

Posted: 09 Jun 2018, 22:59
by brutus_skywalker
Not much to go on, but you can 'Control' a window that's in the background as below.

https://autohotkey.com/docs/commands/ControlSend.htm

Code: Select all

While WinActive("ahk_exe targetApplication.exe"){
	;.... stuff here only happens while targetApplication.exe is active/foreground
}
While WinExists("ahk_exe targetApplication.exe"){	;.... stuff here only happens while targetApplication.exe exists
	;You can use ControlSend to send keystrokes to the window or control while in the background.
	ControlSend [, Control, Keys, WinTitle, WinText, ExcludeTitle, ExcludeText]
	ControlSendRaw: Same parameters as above.
}