Jump to content

Recommended Posts

Posted

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

Posted

What happens when you point the AutoIt Windows Tool to the box?  Does it give you the control id?  If so you can then use Control functions to get the text.

Posted

The tool shows what I want in "visible text", thanks.

I'm  testing with WinGetText() and get back if it works.

 

Posted (edited)

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
Posted

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?

 

Posted (edited)
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."

Posted

You would need to be more specific, if you're using the full AutoIt Editor, run the code within Scite and check the Scite console as to where the issue is.

Posted

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

Posted
2 hours ago, Nine said:

Please provide the content of Au3Info.exe for that specific line control...

Here:

 

control.jpg

visible.jpg

Window.jpg

Posted

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
 

 

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
×
×
  • Create New...