Jump to content

Recommended Posts

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

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
×
×
  • Create New...