Sign in to follow this  
Followers 0
LucasSilva

Help with FileReadLine

4 posts in this topic

Hello everybody, first of all i just want to thank this forum because im learning alot with it. But what i really need at the moment is some help with the function "FileReadLine", what i got to do in my script is get line 1 and "associate" or make it the $variable one.

What i need is something like this:

$var1 = ""
$var2 = ""
$var3 = ""

Local $file = FileOpen("test.txt", 0)
sleep(1000)
$var1 = FileReadLine("line one")
sleep(1000)
$var2 = FileReadLine("line two")
sleep(1000)
$var3 = FileReadLine("line three")
sleep(1000)

I know this code would not work, but its just a demonstration of what i need, i hope you guys can understand. Thank You.

Share this post


Link to post
Share on other sites



Hi, LucasSilva. I would suggest reading the file to an array. Then you can use the array as your variable. Something like this:

#include <Array.au3>
#include <File.au3>
;line 1 is Test
;line 2 is Test2
;line 3 is Test3
;line 4 is Test4
;line 5 is Test5

Local $aArray
 _FileReadToArray(@DesktopDir & "1.txt", $aArray)
MsgBox(0, "", $aArray[1])
MsgBox(0, "", $aArray[3])
MsgBox(0, "", $aArray[5])

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Thank you JLogan3o13 for the reply. I will try and give feedback! Thank you once more.

Share this post


Link to post
Share on other sites

Thank you JLogan3o13, just what i needed! Can i say i love you? hahaha Thanks once more!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0