Sign in to follow this  
Followers 0
LovelyJane

Problem with Func... EndFunc usage with Send("{ALTDOWN}{TAB}{ALTUP}")

4 posts in this topic

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?

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My 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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#4 ·  Posted (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. :D

Edited by LovelyJane

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0