Sign in to follow this  
Followers 0
HeXetic

Pausing a Script

5 posts in this topic

I'm currently writing a script that will perform a restore using NTBackup. So far all is fine until I get to adding a new backup catalog. When you add a catalog there is about a 5 - 10 second wait before the program becomes responsive again. The problem is the script doesn't wait for this and makes the rest of the script useless.

I can't use WinWaitActive because the backup window is always active. And I can't use WinWaitClose because nothing closes. I tried to use Opt("WinWaitDelay", 10000) but that didn't seem to work. The only other thing I can think of is a message box asking the user to click OK when ready to continue but I'd really rather not have that.

$answer2 = MsgBox(4, "New Catalogue", "Do you want to add the new catalogue?")
If $answer2 = 7 Then
    Exit
Else
    Send("!t")
    Send("t")
    Send ("{ENTER}")

; Needs to wait here for about 10 seconds

        Send("{TAB}") 
        Send("{DOWN}")

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Just a thought, but while the window is unresponsive, can you drag it or change it's state(i.e. minimize, maximize)? I'm thinking you could use a loop to move it to specific coordinates, wait a second, and check if it has moved there. If it has not moved, it will sleep a second or two then restart the loop. You could try the same thing with minimizing or maximizing the window, waiting a second, and then checking the windows' state.

Edited by Varian

Share this post


Link to post
Share on other sites

$answer2 = MsgBox(4, "New Catalogue", "Do you want to add the new catalogue?")
If $answer2 = 7 Then
    Exit
Else
    Send("!t")
    Send("t")
    Send ("{ENTER}")

Sleep(10000)

        Send("{TAB}") 
        Send("{DOWN}")

Just a thought, but while the window is unresponsive, can you drag it or change it's state(i.e. minimize, maximize)? I'm thinking you could use a loop to move it to specific coordinates, wait a second, and check if it has moved there. If it has not moved, it will sleep a second or two then restart the loop. You could try the same thing with minimizing or maximizing the window, waiting a second, and then checking the windows state.

Hmm, good idea.

I can do signature me.

Share this post


Link to post
Share on other sites

Ah yes Sleep was exactly the function I needed. I tried searching for Pause, Delay, Wait but not Sleep. Thanks guys its working great now.

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