Sign in to follow this  
Followers 0
youkielkanish

Wierd Error Msg In File Opening Program

6 posts in this topic

#1 ·  Posted (edited)

here is the code :

$file = FileOpen("c:\jeux\sony\everquest II\logs\test.txt", 0)

$file2 = FileOpen("c:\jeux\sony\everquest II\logs\test2.txt", 1)

If $file = -1 Then

MsgBox(0, "Erreur", "impossible d'ouvrir le fichier.")

Exit

EndIf

While 1

$line = FileReadLine($file)

$text = StringReplace($line, "bonjour", "hello")

If @extended = 1 Then

MsgBox(0, "resultat :", $file & $text & @extended)

FileWriteLine($file2, $text)

Else

$text = StringReplace($line, "au revoir", "good bye")

If @extended = 1 Then

MsgBox(0, "resultat :", $file & $text & @extended)

FileWriteLine($file2, $text)

EndIf

EndIf

If @error = -1 Then ExitLoop

Wend

FileClose($file)

FileClose($file2)

so this was working very well, till i decided to take off the MsgBox that i didn t need anymore, the code then looked like :

$file = FileOpen("c:\jeux\sony\everquest II\logs\test.txt", 0)

$file2 = FileOpen("c:\jeux\sony\everquest II\logs\test2.txt", 1)

If $file = -1 Then

MsgBox(0, "Erreur", "impossible d'ouvrir le fichier.")

Exit

EndIf

While 1

$line = FileReadLine($file)

$text = StringReplace($line, "bonjour", "hello")

If @extended = 1 Then

FileWriteLine($file2, $text)

Else

$text = StringReplace($line, "au revoir", "god bye")

If @extended = 1 Then

FileWriteLine($file2, $text)

EndIf

EndIf

If @error = -1 Then ExitLoop

Wend

FileClose($file)

FileClose($file2)

and since then i get this error msg:

Posted Image

Edited by youkielkanish

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Maybe your script is in Unicode, UTF or sometnig like? Autoit scripts should be plain ANSI.

actualy i m using notepad to edit my .au3 files and copying some text from a wordpad file, so i m coding in Unicode, but what can i use to change that :)

Edited by youkielkanish

Share this post


Link to post
Share on other sites

well i did edit my .au3 file with wordpad and it seems to clear the error, i ll try it a bit more since i m note sur it s evaluating it in ANSI, thx for all :)

Share this post


Link to post
Share on other sites

Not sure exactly, but it can. At least this looks like you try to run unicode file. Try to "Save As" you script and look what Encoding is.

Good editors are lot, and this just matter of preference, but if you don't used before any, try Scite for Autoit3:

http://www.autoitscript.com/autoit3/scite/downloads.php

Share this post


Link to post
Share on other sites

Not sure exactly, but it can. At least this looks like you try to run unicode file. Try to "Save As" you script and look what Encoding is.

Good editors are lot, and this just matter of preference, but if you don't used before any, try Scite for Autoit3:

http://www.autoitscript.com/autoit3/scite/downloads.php

oki thx a lot, i ll try this one :)

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