Sign in to follow this  
Followers 0
raca

FileRead strange behaviour

4 posts in this topic

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

Share this post


Link to post
Share on other sites



.htt file is not a plain text file so you need to extraxt the text befor building the text rhat you can use in the MsgBox

NOBUG

PS You should have post first in the "Help & Support" Forum ;)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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 ;)

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