Eviltim Posted August 17, 2005 Posted August 17, 2005 I was looking for a way to get a certain part of a line from a text file. i tried using StringTrimLeft and Right but when the result is put in the message box, it shows nothing at all. i think it has something to do with certain null charatcers. i cant just alter the text file becuase it generated from another program. the outputs of this generated file can be more or less than just the first 7 lines So i came up with a way to read just the first few letters of the line and not the rest of the characters. is there any way to simplify all of this? dim $var, $a, $b, $c, $d, $e, $f, $g $a = FileReadLine("list.txt", 2) $b = FileReadLine("list.txt", 3) $c = FileReadLine("list.txt", 4) $d = FileReadLine("list.txt", 5) $e = FileReadLine("list.txt", 6) $f = FileReadLine("list.txt", 7) $g = FileReadLine("list.txt", 8) $a = StringLeft($a, 10) $b = StringLeft($b, 10) $c = StringLeft($c, 10) $d = StringLeft($d, 10) $e = StringLeft($e, 10) $f = StringLeft($f, 10) $g = StringLeft($g, 10) $a = StringStripWS($a, 8) $b = StringStripWS($b, 8) $c = StringStripWS($c, 8) $d = StringStripWS($d, 8) $e = StringStripWS($e, 8) $f = StringStripWS($f, 8) $g = StringStripWS($g, 8) MsgBox(64, "The Output:" , $a & $b & $c & $d & $e & $f & $g)
GaryFrost Posted August 17, 2005 Posted August 17, 2005 Would help if you supplied a sample file to work with. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
LxP Posted August 17, 2005 Posted August 17, 2005 local $temp, $i local $output = "" for $i = 2 to 8 $temp = fileReadLine("list.txt", $i) $temp = stringLeft($temp, 10) $temp = stringStripWS($temp, 8) $output = $output & $temp next msgBox(0x40, "The output" , $output)
Eviltim Posted August 17, 2005 Author Posted August 17, 2005 (edited) This is the file. Its a .sol file genrated from a flash file.I had to break it down to 10 characters each just so the info will start on the next line without all of the null characters in front of it.local $temp, $i local $output = "" for $i = 2 to 8 $temp = fileReadLine("list.txt", $i) $temp = stringLeft($temp, 10) $temp = stringStripWS($temp, 8) $output = $output & $temp next msgBox(0x40, "The output" , $output)<{POST_SNAPBACK}>I will try this out and see how it goes. Thanks LxPEDIT: Yep, that will definetly work, thanks again! Edited August 17, 2005 by Eviltim
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