Sign in to follow this  
Followers 0
gcue

how to make script wait

7 posts in this topic

how can i force a script to wait until a gui is closed before continuing?

If FileExists($aDIR & "assets.ini.bak1") Then
            MsgBox(262144, "", "Your config is missing but at least 1 backup copy was found. Please chose a config to restore from.")
            ViewBackups_GUI()
;what can i put here to make the script wait until ViewBackups_GUI is closed?
        EndIf

thanks!

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

WinWait()

or example listed above..

or add a Global $var = 0, which changes when ViewBackups_GUI closes and check it in:

While $var = 0

sleep(100)

Wend

Edited by GodlessSinner

_____________________________________________________________________________

Share this post


Link to post
Share on other sites

how can i force a script to wait until a gui is closed before continuing?

If FileExists($aDIR & "assets.ini.bak1") Then
            MsgBox(262144, "", "Your config is missing but at least 1 backup copy was found. Please chose a config to restore from.")
            ViewBackups_GUI()
;what can i put here to make the script wait until ViewBackups_GUI is closed?
        EndIf

thanks!

I doubt you can put anything there to wait until ViewBackups_Gui is closed. It depends of course on what the function does. If it creates a gui and waits for a response then the function should close the gui before returning so nothing else is needed. You might want to disable to main gui before the function is called and enable it afterwards though. Buit anything like the suggestions before which don't handle events from the gui you are waiting to be closed will just wait forever.

Or maybe I guessed wrongly what th efunction does.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

actually this worked

$var = False
            ViewBackups_GUI()

            While $var = False
                If WinExists("Restore Assets List") Then
                    Sleep(10)
                Else
                    Exit
                EndIf
            WEnd

i do wait for a response, but the response exits the main script anyway

no response (they close viewbackups_gui) exits the script too =)

so it works out!

thank you very much for your help =)

have a good weekend fellas.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Global $var

ViewBackups_GUI(); inside func set $var to False, OnCloseGUI - to True

While $var = False

If WinExists("Restore Assets List") Then; Not optimal, you already using variable for this.

Sleep(10)

Else

Exit

EndIf

WEnd

Edited by GodlessSinner

_____________________________________________________________________________

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