ioliver Posted March 9, 2004 Posted March 9, 2004 Does anyone know if I can read text from a text file into my script as variables? Ex. In VBScript I can do a readline, then use an array to seperate the text on the line. Thanks for your help. Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
Developers Jos Posted March 9, 2004 Developers Posted March 9, 2004 There is an included UDF called _FileReadToArray( $sFilePath, ByRef $aArray ) It's listed in the Helpfile under "Library Function Reference" script example:#include <file.au3> Dim $iRecs _FileReadToArray( "test1.txt", $iRecs ) If @error=0 Then For $x = 1 to $iRecs[0] -1 MsgBox(0,'record:' & $x,$iRecs[$x]) Next Else ; error EndIfYou need to update the file.au3 in the include directory on the following line because it has an error currently:record 203 should read: $aArray = StringSplit( FileRead( $hFile, FileGetSize( $sFilePath ) ), @LF ) 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.
ioliver Posted March 9, 2004 Author Posted March 9, 2004 (edited) Thanks, that seems to work ok. But, after reading another post on the forum, I think INIREAD may be the way for me to go. Thanks again, Ian Edited March 9, 2004 by ioliver "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
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