Jump to content

pause/resuming a script when certain text disappears from window


Recommended Posts

How would one pause a script until a certain text string disappears? I am automating Cakewalk Pro audio to record several short tracks and then export each to wave.

It all works very well, except I have to include a long script Sleep during the export to wave process to prevent the script from continuing before the export is compete. Winwaitactive does not work for some reason.

I want to get rid of the sleep and have the script wait until the cakewalk status text that says "Exporting Audio" disappears.

How would one do that?

Darren

Link to comment
Share on other sites

I'd have a look at "ControlGetText" and alternatively "WinGetText" in the helpfile.

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

Do you already have the status bar text stored in a variable? If you do, take the second line out of this script and replace $status with your variable:

While 1
  $status = StatusbarGetText("Cakewalk")
  If $status <> "Exporting Audio" Then ExitLoop
  Sleep(100)
WEnd
(you can take out the Sleep line, but CPU usage tends to jump up in that tight of a loop). Be sure to replace "Cakewalk" with the actual window title. You can combine the second and third lines, if you want. There's no reason to use the variable except to make your script a little more readable.

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

Statusbargettext did not work, because for some reason the Status bar text does not change during the audio export process.

What does change is the color of the status bar, which becomes a blue percentage progress bar indicating how much of the export is complete.

This code did the trick:

While PixelGetColor (153, 1013) <> 15723486 ; waits until export is done by checking pixel color

Sleep(100)

WEnd

Where 15723486 is the normal color of the status bar.

I think WinGetText would have worked as well, since the window text does change according to Autoit Window Info.

Thanks for your help. My script runs alot faster now.

Darren

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