rich2323 Posted March 21, 2005 Posted March 21, 2005 (edited) I am tring to get a filereadline into seperate variables for each "section" Here is my script: ;**************************************** RunWait(@ComSpec & " /c " & "ndir I: /spa > C:\space.txt","C:\",@SW_HIDE) $file = FileOpen("C:\space.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $line = FileReadLine(($file),13) ;**************************************** The $line has a value of = USERS\Rich (there are many spaces here) 467,136 (SPACES here) 466,352 (MORE SPACES) 784,352 (SPACES) 784 I would like to put each section into a variable. Each of these fields can change. What would be the easiest way to get each field into a variable. The only thing seperating each field is spaces. Any suggestions? Rich2323 Edited March 21, 2005 by rich2323
automagician Posted March 21, 2005 Posted March 21, 2005 I am not quite sure what you mean by "sections", if you mean commas or spaces?! but either way it sounds like you should look at the StringSplit() function.
rich2323 Posted March 21, 2005 Author Posted March 21, 2005 (edited) I am not quite sure what you mean by "sections", if you mean commas or spaces?! but either way it sounds like you should look at the StringSplit() function.<{POST_SNAPBACK}>Yes, I do mean each section seperated by the spaces. When I looked at the StringSplit command, it puts each SPACE in as part of the Array, can I get rid of that? Otherwise these number could change and so could the array they are in. Edited March 21, 2005 by rich2323
Developers Jos Posted March 21, 2005 Developers Posted March 21, 2005 $rec = "USERS\Rich 467,136 466,352 784,352 784" $rec = StringStripWS($rec, 4) $SEC = StringSplit($rec, " ") SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
rich2323 Posted March 21, 2005 Author Posted March 21, 2005 $rec = "USERS\Rich 467,136 466,352 784,352 784" $rec = StringStripWS($rec, 4) $SEC = StringSplit($rec, " ")<{POST_SNAPBACK}>That worked, thank you very much!!!Rich2323
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