Jump to content

Wierd Error Msg In File Opening Program


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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

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...