LovelyJane Posted September 9, 2014 Posted September 9, 2014 Hi, I am trying to return to previous window after AutoIt has run: Func ActivateWindow2() If WinExists("AutoIt Forums -", "") Then WinActivate(""AutoIt Forums -", "") WinWaitActive("AutoIt Forums -","") EndFunc But I am having issue with the below code: Func SwitchBackToPrevious() Send("{ALTDOWN}{TAB}{ALTUP}") EndFunc The ALT+TAB keys combination does not seem to take effect? Is there another method to return back to previous active window?
MikahS Posted September 9, 2014 Posted September 9, 2014 (edited) Func ActivateWindow2() If WinExists("AutoIt Forums -", "") Then WinActivate("AutoIt Forums -", "") WinWaitActive("AutoIt Forums -","") EndFunc Func SwitchBackToPrevious() Send("!{TAB}") EndFunc If you want the function to be run on the press of a single button, do this and choose which key you'd prefer HotKeySet("{F1}", "SwitchBackToPrevious") ; put this at the top of your script Edited September 9, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
Moderators Solution JLogan3o13 Posted September 9, 2014 Moderators Solution Posted September 9, 2014 (edited) Rather than resorting to Send, I would do something like this: $sTitle = WinGetTitle("[ACTIVE]") ;Get title of active window before switching Func ActivateWindow2() If WinExists("AutoIt Forums -", "") Then WinActivate("AutoIt Forums -", "") WinWaitActive("AutoIt Forums -","") EndFunc Func SwitchBackToPrevious() If WinExists($sTitle, "") Then WinActivate($sTitle, "") WinWaitActive($sTitle,"") EndFunc Edited September 9, 2014 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
LovelyJane Posted September 9, 2014 Author Posted September 9, 2014 (edited) Oh it works, I tried yours MikahS, then I added Call ("ActivateWindow2") before the Send hoping it will send me back to previously correctly in order, with that in there it kind of "not work" anymore... derp me xD *Edit* Thank you again JLogan3o13, I will use yours instead. Edited September 9, 2014 by LovelyJane
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now