Gillboss Posted May 12, 2008 Share Posted May 12, 2008 i want make a program that write oppsit the words. for example: "hello how are you?" ==> "?uoy era woh olleh" so i think i have to do for function. but i have to know the string length. how i do that? and how can i know the place of any char..? any know? thanks Link to comment Share on other sites More sharing options...
monoceres Posted May 12, 2008 Share Posted May 12, 2008 i want make a program that write oppsit the words. for example: "hello how are you?" ==> "?uoy era woh olleh" so i think i have to do for function. but i have to know the string length. how i do that? and how can i know the place of any char..? any know? thanks #include <string.au3> MsgBox(0,"",_Stringreverse("!taerg si elif pleh ehT")) Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
monoceres Posted May 12, 2008 Share Posted May 12, 2008 Here's a version with the for loop you talked about: Dim $in="hello there!", $out For $i=StringLen($in) To 1 Step -1 $out&=StringMid($in,$i,1) Next MsgBox(0,"",$out) Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Gillboss Posted May 13, 2008 Author Share Posted May 13, 2008 (edited) why its write the number 3? #include <GUIConstants.au3> GUICreate("Transformer By Gil Hanan", 390, 420, 100, 100) $Data = GuiCtrlCreateEdit("", 10, 10, 370, 300) GuiSetState() $ButtonT = GuiCtrlCreateButton("Transform", 10, 330, 100, 30) While GuiGetMsg() <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() If $msg = $ButtonT Then $file = FileOpen(@DesktopDir & "\" & "Data.txt" , 1) If $file = -1 Then Exit EndIf Dim $in=$Data, $out For $i=StringLen($in) To 1 Step -1 $out&=StringMid($in,$i,1) Next FileWrite($file, $out) FileClose($file) EndIf Sleep(1) WEnd Edited May 13, 2008 by Gillboss Link to comment Share on other sites More sharing options...
monoceres Posted May 13, 2008 Share Posted May 13, 2008 (edited) why its write the number 3?Because you assign $Data to $in, $Data is not the value of the edit box but the control id that multiple functions use to interact with the control.To get the data of the edit box use GUICtrlRead($Data) Edited May 13, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Gillboss Posted May 13, 2008 Author Share Posted May 13, 2008 but now the file not createn.. #include <GUIConstants.au3> GUICreate("Transformer By Gil Hanan", 390, 420, 100, 100) $Data = GuiCtrlCreateEdit("", 10, 10, 370, 300) GuiSetState() $ButtonT = GuiCtrlCreateButton("Transform", 10, 330, 100, 30) While GuiGetMsg() <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() If $msg = $ButtonT Then $file = FileOpen(@DesktopDir & "\" & "Data.txt" , 1) If $file = -1 Then Exit EndIf Dim $in=GUICtrlRead($Data), $out For $i=StringLen($in) To 1 Step -1 $out&=StringMid($in,$i,1) Next FileWrite($file, $out) FileClose($file) EndIf Sleep(1) WEnd Link to comment Share on other sites More sharing options...
xircon Posted May 13, 2008 Share Posted May 13, 2008 (edited) Fixed it for you. expandcollapse popup#include <GUIConstants.au3> GUICreate("Transformer By Gil Hanan", 390, 420, 100, 100) $Data = GuiCtrlCreateEdit("", 10, 10, 370, 300) $ButtonT = GuiCtrlCreateButton("Transform", 10, 330, 100, 30) GuiSetState() $out="" While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $ButtonT Then $file = FileOpen(@DesktopDir & "\" & "Data.txt" , 1) ;file open append If $file = -1 Then Exit EndIf ;Dim $in=$Data, $out $in=GUICtrlRead($data) For $i=StringLen($in) To 1 Step -1 $out&=StringMid($in,$i,1) Next FileWrite($file, $out) FileClose($file) EndIf WEnd Edited May 13, 2008 by xircon Link to comment Share on other sites More sharing options...
Gillboss Posted May 13, 2008 Author Share Posted May 13, 2008 work great, but the file not open (the system can not fine the file...) expandcollapse popup#include <GUIConstants.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() $out="" While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $ButtonT Then $sum = GUICtrlRead($Title) $file = FileOpen(@DesktopDir & "\" & $sum & ".txt" , 1) ;file open append If $file = -1 Then Exit EndIf $in=GUICtrlRead($data) For $i=StringLen($in) To 1 Step -1 $out&=StringMid($in,$i,1) Next FileWrite($file, $out) FileClose($file) MsgBox(0, "Message", "File has been save successfully in Document dir!") Run($file&".txt") EndIf WEnd Link to comment Share on other sites More sharing options...
weaponx Posted May 13, 2008 Share Posted May 13, 2008 Run($file&".txt") Should be ShellExecute($file&".txt") Link to comment Share on other sites More sharing options...
Gillboss Posted May 13, 2008 Author Share Posted May 13, 2008 (edited) i changed but: "canot fin the file XXX.txt", (when XXX = the title..) expandcollapse popup#include <GUIConstants.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() $out="" While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $ButtonT Then $sum = GUICtrlRead($Title) $file = FileOpen(@DesktopDir & "\" & $sum & ".txt" , 1) ;file open append If $file = -1 Then Exit EndIf $in=GUICtrlRead($data) For $i=StringLen($in) To 1 Step -1 $out&=StringMid($in,$i,1) Next FileWrite($file, $out) FileClose($file) MsgBox(0, "Message", "File has been save successfully in Desktop!") ShellExecute($sum&".txt") EndIf WEnd Edited May 13, 2008 by Gillboss Link to comment Share on other sites More sharing options...
ProgAndy Posted May 13, 2008 Share Posted May 13, 2008 You have to put the DesktopDir in front of your variable ..... ShellExecute(@DesktopDir & "\" & $sum & ".txt") *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Gillboss Posted May 13, 2008 Author Share Posted May 13, 2008 you are smart but there more problem.. when there is space line the program will write only the first line and not the other line.. why? thanks Link to comment Share on other sites More sharing options...
Gillboss Posted May 14, 2008 Author Share Posted May 14, 2008 any? Link to comment Share on other sites More sharing options...
Gillboss Posted May 16, 2008 Author Share Posted May 16, 2008 so any know slove it? Link to comment Share on other sites More sharing options...
d2addict4 Posted May 16, 2008 Share Posted May 16, 2008 @CRLF will write a new line Simple AutoIt Point Of Sale Link to comment Share on other sites More sharing options...
Gillboss Posted May 16, 2008 Author Share Posted May 16, 2008 what do u mean? 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