Jump to content

Pausing a Script


HeXetic
 Share

Recommended Posts

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}")
Link to comment
Share on other sites

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
Link to comment
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.

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...