Jump to content

Close a popup and execute back a process


Go to solution Solved by FireFox,

Recommended Posts

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?

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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 by Nymphetamine
Link to comment
Share on other sites

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 by Nymphetamine
Link to comment
Share on other sites

  • Solution

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 by FireFox
Link to comment
Share on other sites

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 by Nymphetamine
Link to comment
Share on other sites

Alright it's the first thing i code alone so don't know how did it come up

Here's the code

 
 
#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 by Nymphetamine
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...