mjg Posted May 9, 2007 Share Posted May 9, 2007 Hi, I'm trying to make a script that will close an application (only knowing the executable and class) properly (by send 7 {esc} keys) but am unable to figure out how to do this. Can anyone point me in the right direction? I tried using controlfocus but I'm unsure if that is the correct command to use in this scenario. Thanks, Link to comment Share on other sites More sharing options...
erebus Posted May 9, 2007 Share Posted May 9, 2007 You mean like something this? Run(@WindowsDir & "\notepad.exe", @WindowsDir) $title = WinGetTitle("notepad.exe") WinActivate($title) Sleep(2000) Send("!{F4}") Link to comment Share on other sites More sharing options...
evilertoaster Posted May 9, 2007 Share Posted May 9, 2007 Do you know the name of the window (if any) it is using? What about ProcessClose()? If the window is already active and you just want to send esc 7 times use Send("{ESC 7}") Link to comment Share on other sites More sharing options...
mjg Posted May 9, 2007 Author Share Posted May 9, 2007 Do you know the name of the window (if any) it is using?What about ProcessClose()?If the window is already active and you just want to send esc 7 times use Send("{ESC 7}")No, I have no way of knowing what the title of the window. It is a network application and basically if user1 signs on the window will be called TMS_Workstation1 and if user2 signs on it will be called TMS_Workstation2. I don't believe I can use a wild card w/ winactivate can i?The only issue with using process close is that the application has to be closed properly (with 7 esc keys). If it doesn't close properly, then our backups can not be performed. I do know the class, and read somewhere that you could focus the window by just knowing the class, but was unsuccessful in my attempts. -mjg Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 9, 2007 Share Posted May 9, 2007 Didn't test that before typing it, did'ya? Look in the help file at WinTitleMatchMode:WinTitleMatchModeAlters the method that is used to match window titles during search operations.1 = Match the title from the start (default)2 = Match any substring in the title3 = Exact title match4 = Advanced mode, see Window Titles & Text (Advanced)-1 to -4 = force lower case match according to other type of match.The default match is String*. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
evilertoaster Posted May 9, 2007 Share Posted May 9, 2007 I don't believe I can use a wild card w/ winactivate can i?You can. Check out the WinTitleMatchMode option. Set it to 2 Link to comment Share on other sites More sharing options...
mjg Posted May 9, 2007 Author Share Posted May 9, 2007 Wow perfect, thank you very much! 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