Jump to content

FileRead strange behaviour


raca
 Share

Recommended Posts

First the code

$ad_file = @UserProfileDir & "\Application Data\Microsoft\Internet Explorer\Desktop.htt" ; ad_file = active desktop file
If Not FileExists($ad_file) Then
    MsgBox(16,"Error","Active desktop file doesn't exist")
EndIf
$ad_file_handler = FileOpen($ad_file,0)
If $ad_file_handler = -1 Then
    MsgBox(16, "Error", "Unable to open active desktop file.")
EndIf
dim $eof_flag = False
Do
    $line = FileReadLine($ad_file_handler)
    ;$line = FileRead($ad_backup_file_handler, 10)
    if @error = -1 Then
        $eof_flag = True
    Else
        MsgBox(0,"Readed",$line)
    EndIf
Until Not $eof_flag

Expected behaviour:

to show the file contents in a msgbox, the same text like i see them when i open the file with wordpad

Real behabiour:

It's just show's this: "ÿþ<" (with no quotes)

The same happen with FileRead and FileReadLine

Link to comment
Share on other sites

Sorry... i knocked my head so much with this.. i thought it was an error

I see the problem now, only know i when to check the encodding on the file, normal editors don't even show that detail.

Anyway, autoit only reads text files. Isn't a way of read the file contents with autoit?

Edited by raca
Link to comment
Share on other sites

Sorry... i knocked my head so much with this.. i thought it was an error

I see the problem now, only know i when to check the encodding on the file, normal editors don't even show that detail.

Anyway, autoit only reads text files. Isn't a way of read the file contents with autoit?

In Fact if you use FileRead you will get the entire file if you want (see doc) but in your case the problem is to extract from this file/string the text info which are specific of the .htt file ;)
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...