erezlevi Posted November 17, 2007 Share Posted November 17, 2007 hi, I am looking for a way to select a certain phrase within a text following a keyword. like: if I have multiple lines: "got information from server for user 2345" "didn't get information from server for user 5566". "got information from server for user 8899" "got infromation from server for user 9999" "didn't get information from server for user 5454". how can i go directly to the "didn't" word and then skip within that line to "5566" and put 5566 in an integer $i? also the same will apply to user 5454. the information is within a window so i am using the "wingettext". Thanks for everyone who will answer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2007 Moderators Share Posted November 17, 2007 #include <array.au3> $sString = ClipGet();I copied your text you put that you wanted to read, you'd replace clipget with your own way of getting the text $a = StringRegExp($sString, "(?s)(?i)didn't.+?(\d+)", 3) _ArrayDisplay($a)If you need any other explanation, I'd suggest looking in the help file to understand what was done here, seeing as you didn't provide an effort code to begin with. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
rasim Posted November 17, 2007 Share Posted November 17, 2007 (edited) hi, I am looking for a way to select a certain phrase within a text following a keyword. like: if I have multiple lines: "got information from server for user 2345" "didn't get information from server for user 5566". "got information from server for user 8899" "got infromation from server for user 9999" "didn't get information from server for user 5454". how can i go directly to the "didn't" word and then skip within that line to "5566" and put 5566 in an integer $i? also the same will apply to user 5454. the information is within a window so i am using the "wingettext". Thanks for everyone who will answer. Example: #include <Array.au3> Global $SortTxtArr[1] $text = WinGetText("test - Notepad") $SplitString = StringSplit($text, @CRLF) For $i = 1 To $SplitString[0] If StringInStr($SplitString[$i], "didn't") Then $varStr = StringRegExpReplace($SplitString[$i], "[^0-9]", "") _ArrayAdd($SortTxtArr, $varStr) EndIf Next _ArrayDisplay($SortTxtArr) Edited November 17, 2007 by rasim 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