aslani Posted September 17, 2007 Posted September 17, 2007 Anybody can tell me what these (see image) are?And how to remove them?Thanks. [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
Valuater Posted September 17, 2007 Posted September 17, 2007 More info would help... but, just guessing I had a similar situation and it was due to carrage returns. ie.. @CRLF , @LF, or @CR you can use StringReplace() to replace the CR with nothing "" 8)
ofLight Posted September 17, 2007 Posted September 17, 2007 I believe those are Characters AutoIt cannot recognize, You need to find out what format the File you are getting your info from is Written in and have it translated before you read it with AutoIt. There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly
Moderators SmOke_N Posted September 17, 2007 Moderators Posted September 17, 2007 (edited) I believe those are Characters AutoIt cannot recognize, You need to find out what format the File you are getting your info from is Written in and have it translated before you read it with AutoIt.AutoIt "doesn't" recognize characters?I believe the only character that causes an issue is Char "0" in ansi mode.Edit:Valuater probably hit the nail on the head, but one way to know for sure is to loop through and find the actual Asc value and compare to what is the actual character. Edited September 17, 2007 by SmOke_N 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.
ofLight Posted September 17, 2007 Posted September 17, 2007 AutoIt "doesn't" recognize characters?If you are trying to read a file that has been created using character encoding. such as UTF-8, the result will be small Chunks of information that look normal and small chunks of unrecognizable characters, depending on the file. There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly
aslani Posted September 17, 2007 Author Posted September 17, 2007 More info would help... but, just guessingI had a similar situation and it was due to carrage returns. ie.. @CRLF , @LF, or @CR you can use StringReplace() to replace the CR with nothing ""8)I'm sorry for being vague.The data came from Excel. Basically, you highlight the area you want from the spreadsheet then my AutoIt Script will clean it up and put in an array as you see in that image. I'm not sure if those characters are extra tabs, but I ran StringReplace() using @TAB, @CR, @CRLF, and @LF but still, those character stays. I even ran StringStripWS() and StringStripCR() and they still remain. Is there a way to find out what that chracters are? [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
Moderators SmOke_N Posted September 17, 2007 Moderators Posted September 17, 2007 I'm sorry for being vague. The data came from Excel. Basically, you highlight the area you want from the spreadsheet then my AutoIt Script will clean it up and put in an array as you see in that image. I'm not sure if those characters are extra tabs, but I ran StringReplace() using @TAB, @CR, @CRLF, and @LF but still, those character stays. I even ran StringStripWS() and StringStripCR() and they still remain. Is there a way to find out what that chracters are?$sMid = "" For $i = 0 To UBound($avArray) - 1;Your array For $ii = 1 To StringLen($avArray[$i]);Separate the array into characters ;Run from SciTE $sMid = StringMid($avArray[$i], $ii, 1) ConsoleWrite("$avArray[" & $i & "] = " & "Char: " & $sMid & " | " & "ASC: " & Asc($sMid) & @CRLF) Next Next 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.
aslani Posted September 17, 2007 Author Posted September 17, 2007 $sMid = "" For $i = 0 To UBound($avArray) - 1;Your array For $ii = 1 To StringLen($avArray[$i]);Separate the array into characters ;Run from SciTE $sMid = StringMid($avArray[$i], $ii, 1) ConsoleWrite("$avArray[" & $i & "] = " & "Char: " & $sMid & " | " & "ASC: " & Asc($sMid) & @CRLF) Next Next and this is what I got. $avArray[18] = Char: | ASC: 0 So does this mean that the strange characters are Chr(0)? [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
Moderators SmOke_N Posted September 17, 2007 Moderators Posted September 17, 2007 It's a NULL character as I stated before that AutoIt basically determines as the end of the string. I'm not quite sure if you can do StringReplace($sString, Chr(0), "") or not though. 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.
aslani Posted September 17, 2007 Author Posted September 17, 2007 It's a NULL character as I stated before that AutoIt basically determines as the end of the string. I'm not quite sure if you can do StringReplace($sString, Chr(0), "") or not though.I tried to stringreplace() it....it didn't work [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
PsaltyDS Posted September 18, 2007 Posted September 18, 2007 It's a NULL character as I stated before that AutoIt basically determines as the end of the string. I'm not quite sure if you can do StringReplace($sString, Chr(0), "") or not though.The Asc($sMid) command won't do Unicode, so you might try that with AscW($sMid). 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
DjDeep00 Posted September 18, 2007 Posted September 18, 2007 I tried to stringreplace() it....it didn't workTry this...$New_String=StringReplace(StringReplace($Old_String,@LF,""),@CRLF,"")
Moderators SmOke_N Posted September 18, 2007 Moderators Posted September 18, 2007 Try this...$New_String=StringReplace(StringReplace($Old_String,@LF,""),@CRLF,"")That replaces @LF first, which makes the @CRLF a redundant call because there wouldn't be anymore line feeds for the call. 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.
aslani Posted September 18, 2007 Author Posted September 18, 2007 Try this...$New_String=StringReplace(StringReplace($Old_String,@LF,""),@CRLF,"") This is what I have; $splitdata = StringSplit(GUICtrlRead($ecorawdata), @TAB) For $x1 = Ubound($splitdata) - 1 To 1 Step -1 StringReplace($splitdata[$x1], @TAB, "") StringReplace($splitdata[$x1], @CR, "") StringReplace($splitdata[$x1], @LF, "") StringReplace($splitdata[$x1], @CRLF, "") StringStripCR($splitdata[$x1]) If StringStripWS($splitdata[$x1], 8) = "" Then _ArrayDelete($splitdata, $x1) Next $splitdata[0] = Ubound($splitdata) - 1 _ArrayDisplay( $splitdata, "View Array" ) I added those StringReplace() as filters and StringStripWS() should clean them out. But the _ArrayDisplay still shows those UnID's boxes. :/ [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
aslani Posted September 19, 2007 Author Posted September 19, 2007 OMG! I GOT IT!!!Thanks to _ArrayToString(), I managed to remove those strange characters.Here's what I did.$splitstring = StringSplit(GUICtrlRead($ecorawdata), @TAB) _ArrayDelete($splitstring, 0) $splitdata = StringSplit(StringStripWS(_ArrayToString($splitstring, ","), 8), ",") For $x1 = Ubound($splitdata) - 1 To 1 Step -1 If StringStripWS($splitdata[$x1], 8) = "" Then _ArrayDelete($splitdata, $x1) Next $splitdata[0] = Ubound($splitdata) - 1 _ArrayDisplay($splitdata, "View Array")Thank you all for pointing me to the right direction. [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
aslani Posted September 19, 2007 Author Posted September 19, 2007 (edited) Ok, I found a problem with my previous codes since if I have an element with spaces and commas, the intended spaces and commas were also removed. So to keep the intended spaces and commas, I did this instead, $splitstring = StringSplit(GUICtrlRead($ecorawdata), @TAB) _ArrayDelete($splitstring, 0) $splitdata = StringSplit(StringReplace(_ArrayToString($splitstring, "*"), @CRLF, "*"), "*") For $x1 = Ubound($splitdata) - 1 To 1 Step -1 If StringStripWS($splitdata[$x1], 8) = "" Then _ArrayDelete($splitdata, $x1) Next $splitdata[0] = Ubound($splitdata) - 1 _ArrayDisplay($splitdata, "View Array") Edited September 19, 2007 by aslani [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
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