lolp1 Posted May 3, 2007 Posted May 3, 2007 (edited) I decides to make a new thread, seign as the problem my old thread was about was solved. To make things clear, my end goal here is to detect a new line, how many lines there were, and what the last line detected was ! So far I've got steps one and two. The code below detects a new line on the window, then tells me how many lines there are, the problem is I need to find out how to get the text of the new line it detected. (So the out put looks something like: "New line found, now X amount of lines, last line detected was: Hello". Any suggestions on how to do this, much appreciated. EDIT: I seen the reply below to try: MsgBox (0, "No. Lines", "The control has " & $string[0] & " lines." & @CRLF & "Last line: " & $string[$String[0]]) How ever, this still returns a blank line. I tried it like this DOUBLE EDIT: Just to make sure it was actualy returning text, I also added a Clipput($ctrltext) into the code, and pasted it in note pad, the last line of text was defiantly there, althogh the message box turned up plain AutoItSetOption("WinDetectHiddenText", 1) While 1 $ctrltext = WinGetText("[gvbaals, online in channel op vala] - StealthBot v2.6 Revision 3", "") If $ctrltext <> WinGetText("[gvbaals, online in channel op vala] - StealthBot v2.6 Revision 3", "") Then $ctrltext =WinGetText("[gvbaals, online in channel op vala] - StealthBot v2.6 Revision 3", "") MsgBox (0, "Text Added!", "A new line has been added" & @CRLF & $ctrltext) Sleep(2000) $string = StringSplit ($ctrltext, @LF, 1) MsgBox (0, "No. Lines", "The control has " & $string[0] & " lines." & @CRLF & "Last line: " & $string[$String[0]]) Sleep(30) EndIf WEnd Original code: AutoItSetOption("WinDetectHiddenText", 1) While 1 $ctrltext = WinGetText("O_O...", "") If $ctrltext <> WinGetText("O_O....", "") Then $ctrltext =WinGetText("O_O....", "") MsgBox (0, "Text Added!", "A new line has been added" &@CRLF &$ctrltext) $string = StringSplit ($ctrltext, @LF, 0) MsgBox (0, "No. Lines", "The control has " & $string[0] & " lines.") Sleep(30) EndIf WEnd Edited May 3, 2007 by lolp1
PsaltyDS Posted May 3, 2007 Posted May 3, 2007 With 208 posts, you should know better than to start a redundant topic... Answer will be posted to original topic. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
lolp1 Posted May 3, 2007 Author Posted May 3, 2007 With 208 posts, you should know better than to start a redundant topic... Answer will be posted to original topic. Ehh? The original topic was a different problem and not diretec correctly in the topic name, this is a proper topic with a proper title with the proper data.
PsaltyDS Posted May 3, 2007 Posted May 3, 2007 Ehh? The original topic was a different problem and not diretec correctly in the topic name, this is a proper topic with a proper title with the proper data.My apologies if I misunderstood. It looked the same to me, and I answered in the other topic. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
lolp1 Posted May 3, 2007 Author Posted May 3, 2007 (edited) My apologies if I misunderstood. It looked the same to me, and I answered in the other topic. It's ok , I think you may even be right and me wrong, but it's all said and done now . Anyways, I tried your suggestion like so: EDIT: It appears the StringStrip was missing a flag ! I just added the flag as 4 (as remove) to remove double spaces, seems to work ! AutoItSetOption("WinDetectHiddenText", 1) While 1 $ctrltext = WinGetText("O_O....", "") If $ctrltext <> $ctrltext = WinGetText("O_O....", "") Then $ctrltext = $ctrltext = WinGetText("O_O....", "") ; MsgBox (0, "Text Added!", "A new line has been added" & @CRLF & $ctrltext) ;Sleep(2000) ;Clipput($ctrltext) $string = StringSplit ($ctrltext, @LF, 1) For $n = $string[0] To 1 Step -1 If StringStripWS($string[$n]) <> "" Then MsgBox (0, "No. Lines", "The control has " & $string[0] & " lines." & @CRLF & "Last non-blank line: " & $string[$n]) ExitLoop EndIf Next EndIf WEnd When attempted to use, I get the error: Line 13 (File "C:/blah...") If StringStripWS($string[$n]) <> "" Then If ^ERROR Error: Incorrect number of parameters in this function call Did I implement it wrong? Also, thanks for all this help, really appreciate it . Edited May 3, 2007 by lolp1
PsaltyDS Posted May 3, 2007 Posted May 3, 2007 I did leave off a parameter. Meant it to be 8 (remove all whitespace): StringStripWS($string[$n], 8) :"> Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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