Jump to content

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


Go to solution Solved by JLogan3o13,

Recommended Posts

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?

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • Moderators
  • Solution

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

"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!

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...