Jump to content

How to wait for a dialog to be ready


Recommended Posts

Hi,

I have a dialog in SubtitleEdit that loos like that when it's finished working:

common2.jpg.a9c4eeb50ede089b4bf86befffe44db4.jpg

 

Notice on the bottom the text in red that appears when the dialog has finished.

How do I read the content of this lower status area?

If I knew,  could use:

$ready = 0

while $ready <> 1

$x = {red content}

{code to set $ready to 1 if #x contains the word "errors" or "nothing"}

wend

Link to comment
Share on other sites

Ok, thanks to your suggestion to use the tool, I got this working:

  $ready = 0
  while $ready <> 1
     Sleep(200)
     $Text = WinGetText ("Fix common error")
     $match  = StringInStr ( $Text, "errors" , 0)
     If $match > 1 then
       $ready = 1
     ElseIf
       $match  = StringInStr ( $Text, "nothing" , 0)
       If $match > 1 then $ready = 1
     Endif
  wend
 

Edited by BobFX
Link to comment
Share on other sites

I tried, but somehow I misread something, and it did not work.

But I'm getting an error in expression sometimes here, with a line number that's way above the number of lines of the file. Any idea what's wrong in my syntax?

 

Link to comment
Share on other sites

11 minutes ago, BobFX said:

But I'm getting an error in expression sometimes here, with a line number that's way above the number of lines of the file.

This is because the lines of the includes are also counted.

@BobFX : EDIT -> Have a look e.g. at  scriptlinenumber-shows-incorrect-line-number

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

I made a syntax error just after the includes, at line 10, and I got an error at line 6368, so I should remove 6358 to the error number if I understand well.

The problem is I get the error at line 6464, so it should be 6464-6358 = line 106 in the file.

But 106 is well before the new code where I get the error, so I'm baffled.

I attached both the au3 file, and a PDF showing the line numbers for clarity.

The new code includes a third possible string and is:

>  $ready = 0
>  while $ready <> 1
>     Sleep(200)
>     $Text = WinGetText ("Fix common error")
>     $match  = StringInStr ( $Text, "errors" , 0)
>     If $match > 1 then
>       $ready = 1
>     ElseIf
>       $match  = StringInStr ( $Text, "nothing" , 0)
>       If $match > 1 then
>          $ready = 1
>       ElseIf
>          $match  = StringInStr ( $Text, "applied" , 0)
>          If $match > 1 then
>            $ready = 1
>          Endif
>       Endif
>     Endif
>  wend
 

I'm not sure if:

>    If $match > 1 then $ready = 1

is correct, so I used instead:

>          If $match > 1 then
>            $ready = 1
>          Endif

Thanks for your help guys.

 

 

DoCleanSubs-3.5.13.pdf DoCleanSubs-3.5.13.au3

Link to comment
Share on other sites

Here is the much cleaner code that seems to work:

 

  $ready = 0
  while $ready <> 1
     Sleep(200)
     $Text = WinGetText ("Fix common error")
     $match1  = StringInStr ( $Text, "errors" , 0)
     $match2  = StringInStr ( $Text, "Nothing" , 0)
     $match3  = StringInStr ( $Text, "applied" , 0)
     $match4  = StringInStr ( $Text, "fixes" , 0)
     If ($match1 > 0) or ($match2 > 0) or ($match3 > 0) or ($match4 > 0) Then
       $ready = 1
     EndIf
  wend
 

 

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