erezlevi Posted January 10, 2008 Share Posted January 10, 2008 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 More sharing options...
Developers Jos Posted January 10, 2008 Developers Share Posted January 10, 2008 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) WendThe _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 More sharing options...
erezlevi Posted January 10, 2008 Author Share Posted January 10, 2008 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 More sharing options...
Developers Jos Posted January 10, 2008 Developers Share Posted January 10, 2008 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 More sharing options...
erezlevi Posted January 10, 2008 Author Share Posted January 10, 2008 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 More sharing options...
PsaltyDS Posted January 10, 2008 Share Posted January 10, 2008 (edited) 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 January 10, 2008 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 More sharing options...
erezlevi Posted January 10, 2008 Author Share Posted January 10, 2008 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 More sharing options...
PsaltyDS Posted January 10, 2008 Share Posted January 10, 2008 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 More sharing options...
erezlevi Posted January 10, 2008 Author Share Posted January 10, 2008 So... you found this too hard? you guys are KINGS!!!!!!!!!!!!! it works now. I didn't understand to write it 2 + 32 i thought it is 2+32=34. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now