mentosan Posted January 9, 2009 Posted January 9, 2009 Hi I want to read the second line from a txt file and then to use it in a script. Please help
saywell Posted January 9, 2009 Posted January 9, 2009 Hi I want to read the second line from a txt file and then to use it in a script. Please help At last i can repay some debt by answering a question instead of asking! And i won't get sarky and say RTFM! FileReadLine ( filehandle or "filename" [, line] ) is the function you need. William
Andreik Posted January 9, 2009 Posted January 9, 2009 Hi I want to read the second line from a txt file and then to use it in a script. Please help Or like in this example: #Include <File.au3> $PATH = FileOpenDialog("SELECT",@ScriptDir,"All (*.*)",1) Dim $LINE _FileReadToArray($PATH,$LINE) If IsArray($LINE) And $LINE[0] >= 2 Then MsgBox(0,"LINE 2",$LINE[2])
crazyjts Posted March 2, 2009 Posted March 2, 2009 How do I read the second to last line of a file with an unknown number of lines? FileReadLine will read the last line with a line number = -1 but I can't figure out how to read the line previous to that.
AdmiralAlkex Posted March 2, 2009 Posted March 2, 2009 You could use _FileCountLines() to check how many lines there are and reduce that number by 1 and FileReadLine() it, or use UBound() if using Andreik's example .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
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