jiglei Posted July 19, 2009 Share Posted July 19, 2009 (edited) Hello. Once again im stuck within a problem that seems to be easy to solve... But I can't find anywhere how... Here it goes: I'm having Winlist to detect how many windows with a certain title exist, and then I make ControlGetText to check the text within those windows. And then, when a certain text is found in the window, I want it to return me some text that is included in the window title, that for this case, is beetween [ ]. I'll give you this part of my script so that you can understand what i pretend, better: $var = WinList("Wintitle") For $i = 1 to $var[0][0] $sText=ControlGetText($var[$i][0],"",606) If Stringinstr($sText, "The Text") Then "Tell Me whats beetween [] on $var[$i][0]" Now I have no idea what to do so that autoit returns whats in the title, i can get the title, since it is $var[$i][0] but how can I make it to return ONLY whats beetween [ ] on the title? The title is something like: [This is what should be returned] "Other Stuff on the tile......" Thanks for your attention, hope you can help me out with this, since this is stopping me from finishing my code . EDIT: I've found another way to pass through my problem, but anyways I'd like to know how to pass this if this ever comes to me, Knowledge is never too much . Edited July 19, 2009 by jiglei Link to comment Share on other sites More sharing options...
Authenticity Posted July 19, 2009 Share Posted July 19, 2009 Dim $aMatch = StringRegExp($var[$i][0], '\[([^]]*)\]', 1) If IsArray($aMatch) Then $sText = $aMatch[0] You could also use StringInStr and StringLeft or anything else to extract the substring from the string. Link to comment Share on other sites More sharing options...
Beege Posted July 19, 2009 Share Posted July 19, 2009 Should be able to use _StringBetween() Func too. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
jiglei Posted July 19, 2009 Author Share Posted July 19, 2009 Should be able to use _StringBetween() Func too.Works perfect for what I needed ^^Thanks a lot. Link to comment Share on other sites More sharing options...
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