Sign in to follow this  
Followers 0
Tobytja

Waiting for action

5 posts in this topic

Hello,

I need to modify an au3 script I got.

The script simulates user actions in certain software and sometime pauses for several seconds, because the software is quite slow. Sometimes the scripts sleeps for more than a minute just to be sure it doesn't go ahead of the software. Like a command is given to the software to open a dialogue window, which sometimes takes a very long time. So the script waits for a minute to be sure the window is opened. But sometimes (most of the time) the window is opened after some 10 seconds and the script waits for almost a minute in vain, which impedes work.

So I need some feature to tell the script "Wait until something happens". This is the example of the script:

Send("{ALTDOWN}4{ALTUP}")
        Send("{DOWN}{DOWN}{DOWN}{DOWN}")
        Send("{ENTER}")
        sleep(40000)
        Send("{ENTER}")
            #Add activity history
        sleep(1500)
        send("Issue is PtC: Report from SDM shows 0 violations.")
        sleep(200)
        Send("{tab}")
        sleep(200)
        Send("{space}")

Anyone able to help?

Thanks in advance

Share this post


Link to post
Share on other sites



instead of Sleep(), use WinWaitActive() to wait for the desired window to appear. see the AutoIt help, there are examples and totorials there,

Share this post


Link to post
Share on other sites

OK, thanks. Now if the window has no title at all and only empty text field is its contents, can I just put WinWaitActive("") in the script?

Share this post


Link to post
Share on other sites

do this first:

1) use the tool "AutoIt Window Info" (installed with AutoIt), it will give you all the info you need to identify the window

2) look at the help for WinWaitActive() to see what parameters you can work with.

the rest you will simply need to try.

Share this post


Link to post
Share on other sites

OK, 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