Abs777 Posted January 16, 2007 Share Posted January 16, 2007 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 More sharing options...
FitzChivalry Posted January 16, 2007 Share Posted January 16, 2007 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 More sharing options...
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