Sign in to follow this  
Followers 0
Nymphetamine

Close a popup and execute back a process

12 posts in this topic

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?

Share this post


Link to post
Share on other sites



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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

Functions: ControlClick (use autoit3info tool) and ProcessExists.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by Nymphetamine

Share this post


Link to post
Share on other sites

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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by Nymphetamine

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 by Nymphetamine

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Put your code in a While loop.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Worked . Thanks

Share this post


Link to post
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
Sign in to follow this  
Followers 0