Nymphetamine Posted February 5, 2014 Posted February 5, 2014 Hi all. I am kinda new in this new scripting language and i'd like to have a bit of help. I am basically working for a tool about server files of a game. In poor words, each time that a server file crash, a popup shows up. I'd like to make a tool which closes the process when this popup shows up and then execute back the process. Is that possible?
FireFox Posted February 5, 2014 Posted February 5, 2014 Hi, Welcome to the autoit forum Take a look at the helpfile (F1 in SciTE editor) for the WinWaitActive/WinExists and ProcessClose functions. Br, FireFox.
Nymphetamine Posted February 5, 2014 Author Posted February 5, 2014 WinWaitActive=Pauses execution of the script until the requested window is active. ( So as i understood this makes the script start only if the popup shows up) [usefull] WinExists = Checks to see if a specified window exists. (Usefull) ProcessClose= Terminates a named process. (Usefull) So 50% of work is done already. I am needing only now how to press the OK button automatically and after it start the process back (Thanks a lot for the welcome and for the help)
FireFox Posted February 5, 2014 Posted February 5, 2014 Functions: ControlClick (use autoit3info tool) and ProcessExists.Br, FireFox.
Nymphetamine Posted February 5, 2014 Author Posted February 5, 2014 (edited) Functions: ControlClick (use autoit3info tool) and ProcessExists. Br, FireFox. Alright i'll try this now About the control click.Mmm..can't be done with keyboard directly? I'd have to take the screen coordinates and would not be that accurated since it can change by screen resolution About the "title" and "text" of the window, is that possible write only a part of the error , or i am forced to write everything? Edited February 5, 2014 by Nymphetamine
FireFox Posted February 5, 2014 Posted February 5, 2014 The thing about Control* functions is you don't need screen coordinates. About the title you can use the WinTitleMatchMode option to 2 (Opt(" ....). Br, FireFox.
Nymphetamine Posted February 5, 2014 Author Posted February 5, 2014 (edited) Perfect it's all clear now, thanks a lot,will just need a bit of time to understand try them all up. Opt("WinTextMatchMode", 1) ;1=complete, 2=quick Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase I guess u meant these, the only thing that is left to understand is how use these functions. I mean, to use a part of text only as you said i need to use the second option (Quick) And what for the title one? And tbh sorry for that much questions :S Edited February 5, 2014 by Nymphetamine
Solution FireFox Posted February 5, 2014 Solution Posted February 5, 2014 (edited) The TextMatchMode is for the text readable in the window (and I never use the "text" parameters).Set the TitleMatchMode to 2 so you can search for a part of the title.Br, FireFox. Edited February 5, 2014 by FireFox
Nymphetamine Posted February 5, 2014 Author Posted February 5, 2014 (edited) The TextMatchMode is for the text readable in the window (and I never use the "text" parameters). Set the TitleMatchMode to 2 so you can search for a part of the title. Br, FireFox. U clarified everything. Thanks firefox Edited February 5, 2014 by Nymphetamine
Nymphetamine Posted February 5, 2014 Author Posted February 5, 2014 (edited) Alright it's the first thing i code alone so don't know how did it come up Here's the code expandcollapse popup#include <MsgBoxConstants.au3> errorchecker() Func errorchecker() ; Run GS Run("Desktop\gameserver\gameserver.exe") ; Wait 10 seconds for the gameserver window to appear. WinWait("[CLASS:gameserver]", "", 10) ; Test if the window exists and display the results. If WinExists("[CLASS:E]") Then Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase ProcessClose ( "gameserver.exe" ) Else MsgBox($MB_SYSTEMMODAL, "", "There is no error yet") EndIf EndFunc ;==>Example startgameserver() Func startgameserver() ; Run GS Run("Desktop\gameserver\gameserver.exe") ; Wait 1 seconds for the GS window to appear. WinWait("[CLASS:gameserver]", "", 1) ; Wait for 2 seconds. Sleep(2000) EndFunc ;==>Example I found a problem, each time i start the gameserver.exe the tool does his function and works fine, there is no error, but the problem is that then the tool closes. I would like to have it keep running in background even if the gameserver.exe started Edited February 5, 2014 by Nymphetamine
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