Jump to content

fileopen unicode encoding doesn't work


 Share

Recommended Posts

hi,

when using the following code I am having problems saving the file as unicode. the : $file=fileopen ("c:\2905_96xxdata.txt",128)

does not work for me. can someone help please???

#AutoIt3Wrapper_outfile=GUI.exe
#AutoIt3Wrapper_run_debug_mode=Y
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <File.au3>
GUICreate("My GUI") ; will create a dialog box that when displayed is centered

; Run the GUI until the dialog is closed
Opt("GUICoordMode",2)

$widthCell=70
GUICtrlCreateLabel ("IPphonevalues-change",20,20)
$change=GUICtrlCreateLabel ("first contact labe to change",  -50, 50,150)
$change3=GUICtrlCreateInput ("please insert new label",-10,-20)
$changeicon=GUICtrlCreateButton ("change",-150,30)
GUISetState ()
$msg = 0

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg=$changeicon
            $e=GUICtrlRead($change3)
            $file=fileopen ("c:\2905_96xxdata.txt",128)
            $filechange=_FileWriteToLine ("c:\2905_96xxdata.txt",1,"ABKNAME001="&$e,1)
            FileClose ($file)
            MsgBox (0,"done!","")
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
    fileopen ("c:\2905_96xxdata.txt",128)
    
Wend
Link to comment
Share on other sites

  • Developers

hi,

when using the following code I am having problems saving the file as unicode. the : $file=fileopen ("c:\2905_96xxdata.txt",128)

does not work for me. can someone help please???

#AutoIt3Wrapper_outfile=GUI.exe
#AutoIt3Wrapper_run_debug_mode=Y
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <File.au3>
GUICreate("My GUI"); will create a dialog box that when displayed is centered

; Run the GUI until the dialog is closed
Opt("GUICoordMode",2)

$widthCell=70
GUICtrlCreateLabel ("IPphonevalues-change",20,20)
$change=GUICtrlCreateLabel ("first contact labe to change",  -50, 50,150)
$change3=GUICtrlCreateInput ("please insert new label",-10,-20)
$changeicon=GUICtrlCreateButton ("change",-150,30)
GUISetState ()
$msg = 0

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg=$changeicon
            $e=GUICtrlRead($change3)
            $file=fileopen ("c:\2905_96xxdata.txt",128)
            $filechange=_FileWriteToLine ("c:\2905_96xxdata.txt",1,"ABKNAME001="&$e,1)
            FileClose ($file)
            MsgBox (0,"done!","")
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
    fileopen ("c:\2905_96xxdata.txt",128)
    
Wend
The _FileWriteToLine() UDF doesn;t use your FileOpen() handle and methode but opens the file itself.

You will have to copy the Udf into your own script and change it to what you want.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

The _FileWriteToLine() UDF doesn;t use your FileOpen() handle and methode but opens the file itself.

You will have to copy the Udf into your own script and change it to what you want.

Jos

hi I tried this also, and it does not work for some reason:

#include <File.au3>
$file=_FileCreate ("c:\erez1234.txt")
$file1=FileOpen ("c:\erez1234.txt",32)
_FileWriteToLine ($file1,1,"ereztest",1)
FileClose ($file1)
Link to comment
Share on other sites

  • Developers

hi I tried this also, and it does not work for some reason:

#include <File.au3>
$file=_FileCreate ("c:\erez1234.txt")
$file1=FileOpen ("c:\erez1234.txt",32)
_FileWriteToLine ($file1,1,"ereztest",1)
FileClose ($file1)
I know and as stated: The UDF does not use a filehandle thus it will never work using the current version of _FileWriteToLine().

You will have to created you own function to be able to write to the first record....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I know and as stated: The UDF does not use a filehandle thus it will never work using the current version of _FileWriteToLine().

You will have to created you own function to be able to write to the first record....

can someone help with an example of what can be done? where to look at in order to start?

Link to comment
Share on other sites

hi I tried this also, and it does not work for some reason:

#include <File.au3>
$file=_FileCreate ("c:\erez1234.txt")
$file1=FileOpen ("c:\erez1234.txt",32)
_FileWriteToLine ($file1,1,"ereztest",1)
FileClose ($file1)
Fix your modes. FileOpen() with just 32 means 0 + 32, which is read mode. You want 1 + 32 = 33 for append, or 2 + 32 = 34 for overwrite.

Next, as Jos said (TWICE!) you can't presently use a file handle for the _FileWriteToLine() function. You would have to open the File.au3 UDF, and dig into that function for changes to make it do what you want.

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Fix your modes. FileOpen() with just 32 means 0 + 32, which is read mode. You want 1 + 32 = 33 for append, or 2 + 32 = 34 for overwrite.

Next, as Jos said (TWICE!) you can't presently use a file handle for the _FileWriteToLine() function. You would have to open the File.au3 UDF, and dig into that function for changes to make it do what you want.

:)

first thanks for your answers:

I'v decided to choose an external ANSI2INI converter using controlsend funtions to transform the file to UNICODE.

Link to comment
Share on other sites

first thanks for your answers:

I'v decided to choose an external ANSI2INI converter using controlsend funtions to transform the file to UNICODE.

So... you found this too hard?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...