kemo1987 Posted November 14, 2011 Posted November 14, 2011 00:18:03.4 Call (l:'sip:5988@193.221.96.1' r:'sip:00110020100775352@193.221.96.1') - Call failed. Error code: 486 "Busy Here"00:44:31.1 Proxy slot #0 () - Failed to register! error-code: 408, msg: 'Request Timeout'. Retry in 40 second(s). AOR: '<sip:100@177.16.246.156>', proxy: '177.16.246.156', firewall-proxy: 'F'.00:45:39.0 Proxy slot #0 () - Registration failed AOR: '<sip:100@177.16.246.156>', proxy: '177.16.246.156', firewall-proxy: 'F'.00:47:41.0 RequestPlaceCall to 'sip:001900380935188967@177.17.11.203' on an inactive proxy!================$var = ControlGetText("[CLASS:DIAGNOSTICDIAG_CLASS]", "", "Edit1")$var > contain text like abovei want search for highlight text if exist in any line > write that line to result.txtand i want make variable like $words so i can change search value.Thanks in advance.
hannes08 Posted November 14, 2011 Posted November 14, 2011 Hello kemo, just do a SplitString with @CRLF as the delimiter, then you have an array you can loop through. Then you can do a stringInStr, to find the coorect lines. kemo1987 1 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Realm Posted November 14, 2011 Posted November 14, 2011 (edited) How about this handy lil function: StringInStr($var, $words) If $var contains more than one line then you could break up the lines into an array passing through a loop to check each line: $lines = StringSplit($var, @CRLF, 1) For $i = 1 To Ubound( $lines ) - 1 If StringInStr($lines[$i], $words) Then ;Do Something EndIf Next Edit: Yeah, what Hannes08 said, lol Edited November 14, 2011 by Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.
kemo1987 Posted November 14, 2011 Author Posted November 14, 2011 something wrong , i need to send each line contain that $words to notepad?? $var = ControlGetText("[CLASS:DIAGNOSTICDIAG_CLASS]", "", "Edit1") $lines = StringSplit($var, @CRLF, 1) $words = "Error code" For $i = 1 To Ubound( $lines ) - 1 If StringInStr($lines[$i], $words) Then ;Do Something WinWaitActive("[CLASS:Notepad]") ControlSend("[CLASS:Notepad]", "", "", "{ENTER} "& $lines &" {ENTER}") Sleep(5000) EndIf Next
Spiff59 Posted November 14, 2011 Posted November 14, 2011 (edited) You left the subscript ([$i]) off of the $lines reference in your ControlSend() statement. Edit: PS - You'd run a lot faster if you just wrote your output direct to a text file via FileWriteLine(). But if having notepad.exe up and running is a requirement, you could at least use the clipboard to transfer your data as it is light-years faster than having ControlSend() process the whole string. $var = "Line1 Error code" & @CRLF & "Line2" & @CRLF & "Line3 Error code" & @CRLF & "Line4" & @CRLF & "Line5 Error code" & @CRLF $lines = StringSplit($var, @CRLF, 1) $words = "Error code" Run("Notepad.exe") WinWaitActive("[CLASS:Notepad]") ; really slow Sleep(1000) For $i = 1 To Ubound( $lines ) - 1 If StringInStr($lines[$i], $words) Then ControlSend("[CLASS:Notepad]", "", "", $lines[$i] & "{ENTER}") EndIf Next ControlSend("[CLASS:Notepad]", "", "", "{ENTER}") ; slow Sleep(1000) For $i = 1 To Ubound( $lines ) - 1 If StringInStr($lines[$i], $words) Then ClipPut($lines[$i] & @CRLF) ControlSend("[CLASS:Notepad]", "", "", "^v") EndIf Next Edited November 14, 2011 by Spiff59 kemo1987 1
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