Jump to content

FileReadLine Bug ?


jslegers
 Share

Recommended Posts

Hi,

I have the following code :

$var1 = String ( '"' & @ScriptDir & "\new_1.log" & '"' )
$var2 = FileReadLine ( $var1, 2 )
MsgBox ( 4096,"Test",$var2 )

It looks like that FileReadLine can't read filenames with a path between quotes.

Files are placed for test : c:\Documents and Settings\JSL\My Documents\Autoit Scripts\Log file\var.au3

Is this a limitation of FileReadLine ?

Link to comment
Share on other sites

Try with this instead:

$file = FileOpen(@ScriptDir & "\new_1.log", 0)
$var2 = FileReadLine ($file,2)
MsgBox (4096,"Test",$var2 )

Edit: did not see that you had used string there.

Edited by jokke
UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

Why do you need to qoute the string ? As you are only using it to inn the FileReadLine()?

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

Hi,

I have the following code :

$var1 = String ( '"' & @ScriptDir & "\new_1.log" & '"' )
$var2 = FileReadLine ( $var1, 2 )
MsgBox ( 4096,"Test",$var2 )

It looks like that FileReadLine can't read filenames with a path between quotes.

Files are placed for test : c:\Documents and Settings\JSL\My Documents\Autoit Scripts\Log file\var.au3

Is this a limitation of FileReadLine ?

Don't save the quotes as part of the file path, and only add the quotes where you have to:
$var1 = String (@ScriptDir & "\new_1.log")
$var2 = FileReadLine ( $var1, 2 ); no quotes
Run('notepad.exe "' & $var1 & '"'); added quotes

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...