BobFX Posted March 2, 2020 Posted March 2, 2020 Hi, I have a dialog in SubtitleEdit that loos like that when it's finished working: 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
Subz Posted March 2, 2020 Posted March 2, 2020 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.
BobFX Posted March 2, 2020 Author Posted March 2, 2020 The tool shows what I want in "visible text", thanks. I'm testing with WinGetText() and get back if it works.
BobFX Posted March 2, 2020 Author Posted March 2, 2020 (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 March 2, 2020 by BobFX
Subz Posted March 2, 2020 Posted March 2, 2020 You could also use ControlGetText and use Control Id to select the control.
BobFX Posted March 2, 2020 Author Posted March 2, 2020 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?
Musashi Posted March 2, 2020 Posted March 2, 2020 (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 March 2, 2020 by Musashi "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
Subz Posted March 2, 2020 Posted March 2, 2020 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.
Nine Posted March 2, 2020 Posted March 2, 2020 Please provide the content of Au3Info.exe for that specific line control... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
BobFX Posted March 2, 2020 Author Posted March 2, 2020 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
BobFX Posted March 2, 2020 Author Posted March 2, 2020 2 hours ago, Nine said: Please provide the content of Au3Info.exe for that specific line control... Here:
BobFX Posted March 2, 2020 Author Posted March 2, 2020 I found the syntax error: using ElseIF instead of Else. Not sure yet it will work as intended.
BobFX Posted March 2, 2020 Author Posted March 2, 2020 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now