Jump to content

Array of all Visible Text


Recommended Posts

I'm new to AutoIT, coming from a Python background. For this project it's easier to automate the front end then the backend through an API. All I can say is keep up the greatwork. I needed a way to poll the Visible Text on a window. A quick search on this forum brought me to StatusBarGetText, and when I searched that in the help file I got to ControlGetText, which got me to WinGetText.

Keep up the great work!

Link to comment
Share on other sites

Welcome :(

I'm not sure exactly what you're asking, do you need help with the polling part, or splitting it into an array?

Posting a sample bit of code (even if it doesn't work) would be alot of help.

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

Hi Fulano-

My whole point is that the work on this forum and in the help file has been so good that even a newbie to AutoIt can find what they need. I added this post to thank everyone for the great work and to add to the body of answers. If someone has the same problem as I did they now have a searchable post to point them to WinGetText.

It turns out that I didn't need an array. (In python I'd expect to have a function return a list of strings and I'd use the syntax "If string in list"...) The StringInStr function did all I needed.

$InterError = False ;Assume the assembly will pass the test
While 1 ;Loop until testing is finished
   $VisibleText = WinGetText("Interferences") ;Get all visible text in the "Interferences" window
   If StringInStr($VisibleText, "No Interferences Found", 1) Then ExitLoop
   If StringInStr($VisibleText, "Show All Interfering Volumes", 1) Then
      $InterError = True ;Error Found
      ExitLoop
   EndIf
WEnd

If you need an array of Visible Text you could take the text returned by the WinGetText function and split it into an array using the StringSplit function as written in the help file.

Thanks again!

Edited by SeaWolf
Link to comment
Share on other sites

Gotcha :( And I agree, the documentation is exceptionally well written.

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

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