Jump to content

Need help gaining focus on a window


Abs777
 Share

Recommended Posts

I will have a window that I need to gain focus if it doesn't have it and then shut down using a 'ALT+E' keystroke.

What code would I use for this? My window that I want to gain focus has a title bar name "APEX"

Would this work

If WinExists("APEX") then

WinWait("APEX")

WinActivate("APEX")

If WinActive("APEX") then

Send("!E")

Sleep(10000)

Thanks,

ABS

Link to comment
Share on other sites

I will have a window that I need to gain focus if it doesn't have it and then shut down using a 'ALT+E' keystroke.

What code would I use for this? My window that I want to gain focus has a title bar name "APEX"

Would this work

If WinExists("APEX") then

WinWait("APEX")

WinActivate("APEX")

If WinActive("APEX") then

Send("!E")

Sleep(10000)

Thanks,

ABS

Is it giving you any error or anything when you try this? One thing you need to do is make sure to put endif's in your code. Try something like this:

if WinExists("APEX") Then
    WinActivate("APEX")
    sleep(500)
    send("!e")
EndIf

I have it sleep for half a second after activating the window just because sometimes it goes to fast and sends the alt-e before the window actually gets a chance to activate. try it out and see if that works, and let us know if you get any error messages or anything. Good luck!

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...