Gillboss Posted July 11, 2008 Share Posted July 11, 2008 i built this script (now its work with lines muttley nvm.. huh) expandcollapse popup#include <GUIConstants.au3> #include <File.au3> GUICreate("Transformer By Gil Hanan", 390, 420, 100, 100) GUICtrlCreateLabel("Title:" , 10, 10, 70, 20) $Title = GUICtrlCreateInput("", 50, 10, 300, 20) GUICtrlCreateLabel("Data:" , 10, 50, 300, 20) $Data = GuiCtrlCreateEdit("", 10, 70, 340, 300) $ButtonT = GuiCtrlCreateButton("Transform", 140, 380, 100, 30) GuiSetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $ButtonT Then If FileExists(@TempDir & "\temp.txt") Then FileDelete(@TempDir & "\temp.txt" ) EndIf $file1 = FileOpen(@TempDir & "\temp.txt" , 1) ;file open append If $file1 = -1 Then Exit EndIf $in=GUICtrlRead($data) FileWrite($file1, $in) FileClose($file1) $count = _FileCountLines(@TempDir & "\temp.txt") $sum = GUICtrlRead($Title) $z = 2 While FileExists(@DesktopDir & "\" & $sum & ".txt") $sum = GUICtrlRead($Title)&" ("&String($z)&")" $z = $z + 1 WEnd $file2 = FileOpen(@DesktopDir & "\" & $sum & ".txt" , 1) ;file open append If $file2 = -1 Then Exit EndIf For $i=1 To $count Step 1 $out="" $in= FileReadLine(@TempDir & "\temp.txt", $i) For $t=StringLen($in) To 1 Step -1 $out&=StringMid($in,$t,1) Next _FileWriteToLine(@DesktopDir & "\" & $sum & ".txt", $i, $out&@CRLF) Next FileClose($file2) MsgBox(0, "Message", "File has been save successfully in Desktop!") ShellExecute(@DesktopDir & "\" & $sum & ".txt") EndIf WEnd well u can try, inset "asd" to title and: "hello how are you? ?uoy era woh olleh" to data, u receive: "?uoy era woh olleh hello how are you?" so its work fine, but if insert this: "שלום מה נשמע" - Hebrew sentence. u receive: "???? ?? ????" how fix it? Link to comment Share on other sites More sharing options...
James Posted July 11, 2008 Share Posted July 11, 2008 Save as ANSI. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Gillboss Posted July 11, 2008 Author Share Posted July 11, 2008 how? i dont see nothing about save as ANSI at help files.. can u give example? thanks Link to comment Share on other sites More sharing options...
monoceres Posted July 11, 2008 Share Posted July 11, 2008 I think James got ANSI and unicode mixed up. You will need to save the file in unicode mode. Check the help file for the different flags for FileOpen. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
James Posted July 11, 2008 Share Posted July 11, 2008 I think James got ANSI and unicode mixed up. You will need to save the file in unicode mode. Check the help file for the different flags for FileOpen.Woops muttley Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Gillboss Posted July 11, 2008 Author Share Posted July 11, 2008 which one? Mode (read or write) to open the file in. Can be a combination of the following: 0 = Read mode 1 = Write mode (append to end of file) 2 = Write mode (erase previous contents) 4 = Read raw mode 8 = Create directory structure if it doesn't exist (See Remarks). 16 = Force binary(byte) reading and writing mode with FileRead and FileWrite 32 = Use Unicode UTF16 Little Endian mode when writing text with FileWrite and FileWriteLine (default is ANSI) 64 = Use Unicode UTF16 Big Endian mode when writing text with FileWrite and FileWriteLine (default is ANSI) 128 = Use Unicode UTF8 when writing text with FileWrite and FileWriteLine (default is ANSI) Both write modes will create the file if it does not already exist. The folder path must already exist (except using mode '8' - See Remarks). Link to comment Share on other sites More sharing options...
Gillboss Posted July 11, 2008 Author Share Posted July 11, 2008 ok, its save good: but i check value of $count and there is error, i get wrong value. expandcollapse popup#include <GUIConstants.au3> #include <File.au3> GUICreate("Transformer By Gil Hanan", 390, 420, 100, 100) GUICtrlCreateLabel("Title:" , 10, 10, 70, 20) $Title = GUICtrlCreateInput("", 50, 10, 300, 20) GUICtrlCreateLabel("Data:" , 10, 50, 300, 20) $Data = GuiCtrlCreateEdit("", 10, 70, 340, 300) $ButtonT = GuiCtrlCreateButton("Transform", 140, 380, 100, 30) GuiSetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $ButtonT Then If FileExists(@TempDir & "\temp.txt") Then FileDelete(@TempDir & "\temp.txt" ) EndIf $file1 = FileOpen(@TempDir & "\temp.txt" , 32+2) ;file open append If $file1 = -1 Then Exit EndIf $in=GUICtrlRead($data) FileWrite($file1, $in) FileClose($file1) ShellExecute(@TempDir & "\temp.txt") $count = _FileCountLines(@TempDir & "\temp.txt") $sum = GUICtrlRead($Title) $z = 2 While FileExists(@DesktopDir & "\" & $sum & ".txt") $sum = GUICtrlRead($Title)&" ("&String($z)&")" $z = $z + 1 WEnd $file2 = FileOpen(@DesktopDir & "\" & $sum & ".txt" , 1) ;file open append If $file2 = -1 Then Exit EndIf MsgBox(0, "" , FileReadLine(@TempDir & "\temp.txt", 1)&" "&$count) For $i=1 To $count Step 1 $out="" $in= FileReadLine(@TempDir & "\temp.txt", $i) For $t=StringLen($in) To 1 Step -1 $out&=StringMid($in,$t,1) Next _FileWriteToLine(@DesktopDir & "\" & $sum & ".txt", $i, $out&@CRLF) Next FileClose($file2) If FileExists(@TempDir & "\temp.txt") Then ; FileDelete(@TempDir & "\temp.txt" ) EndIf MsgBox(0, "Message", "File has been save successfully in Desktop!") ShellExecute(@DesktopDir & "\" & $sum & ".txt") EndIf WEnd Link to comment Share on other sites More sharing options...
Gillboss Posted July 12, 2008 Author Share Posted July 12, 2008 ? Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 13, 2008 Share Posted July 13, 2008 but i check value of $count and there is error, i get wrong value.There is a problem with _FileContLines(), i use StringReplace() with @CRLF and check the @extended. And also you have conflict in your writing method, you open the file to write, but you writes using _FileWriteToLine while it's opened, this function open the file as well... you should not do that muttley expandcollapse popup#include <GUIConstants.au3> #include <File.au3> GUICreate("Transformer By Gil Hanan", 390, 420, 100, 100) GUICtrlCreateLabel("Title:" , 10, 10, 70, 20) $Title = GUICtrlCreateInput("", 50, 10, 300, 20) GUICtrlCreateLabel("Data:" , 10, 50, 300, 20) $Data = GuiCtrlCreateEdit("", 10, 70, 340, 300) $ButtonT = GuiCtrlCreateButton("Transform", 140, 380, 100, 30) GuiSetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonT If FileExists(@TempDir & "\temp.txt") Then FileDelete(@TempDir & "\temp.txt") $file1 = FileOpen(@TempDir & "\temp.txt", 32+2) ;file open append If $file1 = -1 Then Exit $in = GUICtrlRead($data) FileWrite($file1, $in) FileClose($file1) ShellExecute(@TempDir & "\temp.txt") StringReplace(FileRead(@TempDir & "\temp.txt"), @CRLF, "") $count = @extended+1 ;_FileCountLines(@TempDir & "\temp.txt") $sum = GUICtrlRead($Title) $z = 2 While FileExists(@DesktopDir & "\" & $sum & ".txt") $sum = GUICtrlRead($Title) & " (" & $z & ")" $z += 1 WEnd ;Just to create the file and check if it's writable $file2 = FileOpen(@DesktopDir & "\" & $sum & ".txt", 1) ;file open append If $file2 = -1 Then Exit FileClose($file2) MsgBox(0, "" , FileReadLine(@TempDir & "\temp.txt", 1) & " " & $count) For $i = 1 To $count $out = "" $in = FileReadLine(@TempDir & "\temp.txt", $i) For $t = StringLen($in) To 1 Step -1 $out &= StringMid($in, $t, 1) Next _FileWriteToLine(@DesktopDir & "\" & $sum & ".txt", $i, $out & @CRLF) Next If FileExists(@TempDir & "\temp.txt") Then FileDelete(@TempDir & "\temp.txt" ) MsgBox(0, "Message", "File has been save successfully in Desktop!") ShellExecute(@DesktopDir & "\" & $sum & ".txt") EndSwitch WEnd Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Gillboss Posted July 13, 2008 Author Share Posted July 13, 2008 (edited) so use filewrite()? it work for english, but bot for hebrew: expandcollapse popup#include <GUIConstants.au3> #include <File.au3> GUICreate("Transformer By Gil Hanan", 390, 420, 100, 100) GUICtrlCreateLabel("Title:" , 10, 10, 70, 20) $Title = GUICtrlCreateInput("", 50, 10, 300, 20) GUICtrlCreateLabel("Data:" , 10, 50, 300, 20) $Data = GuiCtrlCreateEdit("", 10, 70, 340, 300) $ButtonT = GuiCtrlCreateButton("Transform", 140, 380, 100, 30) GuiSetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonT If FileExists(@TempDir & "\temp.txt") Then FileDelete(@TempDir & "\temp.txt") $file1 = FileOpen(@TempDir & "\temp.txt", 32+2) ;file open append If $file1 = -1 Then Exit $in = GUICtrlRead($data) FileWrite($file1, $in) FileClose($file1) StringReplace(FileRead(@TempDir & "\temp.txt"), @CRLF, "") $count = @extended+1 ;_FileCountLines(@TempDir & "\temp.txt") $sum = GUICtrlRead($Title) $z = 2 While FileExists(@DesktopDir & "\" & $sum & ".txt") $sum = GUICtrlRead($Title) & " (" & $z & ")" $z += 1 WEnd ;Just to create the file and check if it's writable $file2 = FileOpen(@DesktopDir & "\" & $sum & ".txt", 1) ;file open append If $file2 = -1 Then Exit FileClose($file2) For $i = 1 To $count $out = "" $in = FileReadLine(@TempDir & "\temp.txt", $i) For $t = StringLen($in) To 1 Step -1 $out &= StringMid($in, $t, 1) Next FileWriteLine(@DesktopDir & "\" & $sum & ".txt", $out) Next If FileExists(@TempDir & "\temp.txt") Then FileDelete(@TempDir & "\temp.txt" ) MsgBox(0, "Message", "File has been save successfully in Desktop!") ShellExecute(@DesktopDir & "\" & $sum & ".txt") EndSwitch WEnd Edited July 13, 2008 by Gillboss Link to comment Share on other sites More sharing options...
Gillboss Posted July 13, 2008 Author Share Posted July 13, 2008 oh, and look that: $out get the hebrew sentence, but its not write good: expandcollapse popup#include <GUIConstants.au3> #include <File.au3> GUICreate("Transformer By Gil Hanan", 390, 420, 100, 100) GUICtrlCreateLabel("Title:" , 10, 10, 70, 20) $Title = GUICtrlCreateInput("", 50, 10, 300, 20) GUICtrlCreateLabel("Data:" , 10, 50, 300, 20) $Data = GuiCtrlCreateEdit("", 10, 70, 340, 300) $ButtonT = GuiCtrlCreateButton("Transform", 140, 380, 100, 30) GuiSetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonT If FileExists(@TempDir & "\temp.txt") Then FileDelete(@TempDir & "\temp.txt") $file1 = FileOpen(@TempDir & "\temp.txt", 32+2) ;file open append If $file1 = -1 Then Exit $in = GUICtrlRead($data) FileWrite($file1, $in) FileClose($file1) StringReplace(FileRead(@TempDir & "\temp.txt"), @CRLF, "") $count = @extended+1 ;_FileCountLines(@TempDir & "\temp.txt") $sum = GUICtrlRead($Title) $z = 2 While FileExists(@DesktopDir & "\" & $sum & ".txt") $sum = GUICtrlRead($Title) & " (" & $z & ")" $z += 1 WEnd ;Just to create the file and check if it's writable $file2 = FileOpen(@DesktopDir & "\" & $sum & ".txt", 1) ;file open append If $file2 = -1 Then Exit For $i = 1 To $count $out = "" $in = FileReadLine(@TempDir & "\temp.txt", $i) For $t = StringLen($in) To 1 Step -1 $out &= StringMid($in, $t, 1) Next $out &= @CRLF MsgBox(0, "", $out) FileWrite($file2, String($out)) Next FileClose($file2) If FileExists(@TempDir & "\temp.txt") Then FileDelete(@TempDir & "\temp.txt" ) MsgBox(0, "Message", "File has been save successfully in Desktop!") ShellExecute(@DesktopDir & "\" & $sum & ".txt") EndSwitch WEnd Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 13, 2008 Share Posted July 13, 2008 $out get the hebrew sentence, but its not write good:Just add 32 to the second FileOpen... expandcollapse popup#include <GUIConstants.au3> #include <File.au3> GUICreate("Transformer By Gil Hanan", 390, 420, 100, 100) GUICtrlCreateLabel("Title:" , 10, 10, 70, 20) $Title = GUICtrlCreateInput("", 50, 10, 300, 20) GUICtrlCreateLabel("Data:" , 10, 50, 300, 20) $Data = GuiCtrlCreateEdit("", 10, 70, 340, 300) $ButtonT = GuiCtrlCreateButton("Transform", 140, 380, 100, 30) GuiSetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonT If FileExists(@TempDir & "\temp.txt") Then FileDelete(@TempDir & "\temp.txt") $file1 = FileOpen(@TempDir & "\temp.txt", 32+2) ;file open rewrite If $file1 = -1 Then Exit $in = GUICtrlRead($data) FileWrite($file1, $in) FileClose($file1) StringReplace(FileRead(@TempDir & "\temp.txt"), @CRLF, "") $count = @extended+1 ;_FileCountLines(@TempDir & "\temp.txt") $sum = GUICtrlRead($Title) $z = 2 While FileExists(@DesktopDir & "\" & $sum & ".txt") $sum = GUICtrlRead($Title) & " (" & $z & ")" $z += 1 WEnd $file2 = FileOpen(@DesktopDir & "\" & $sum & ".txt", 32+1) ;file open append If $file2 = -1 Then Exit For $i = 1 To $count $out = "" $in = FileReadLine(@TempDir & "\temp.txt", $i) For $t = StringLen($in) To 1 Step -1 $out &= StringMid($in, $t, 1) Next MsgBox(0, "", $out) FileWriteLine($file2, $out) Next FileClose($file2) If FileExists(@TempDir & "\temp.txt") Then FileDelete(@TempDir & "\temp.txt") MsgBox(0, "Message", "File has been save successfully in Desktop!") ShellExecute(@DesktopDir & "\" & $sum & ".txt") EndSwitch WEnd Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Gillboss Posted July 14, 2008 Author Share Posted July 14, 2008 Thanks!! Sloved muttley 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