Sign in to follow this  
Followers 0
Gillboss

Helo Strings

16 posts in this topic

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

Share this post


Link to post
Share on other sites



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!

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Gillboss

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Fixed it for you.

#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 by xircon

Share this post


Link to post
Share on other sites

work great, but the file not open (the system can not fine the file...)

#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

Share this post


Link to post
Share on other sites

Run($file&".txt")

Should be

ShellExecute($file&".txt")

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

i changed but: "canot fin the file XXX.txt", (when XXX = the title..)

#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 by Gillboss

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

any?

Share this post


Link to post
Share on other sites

so any know slove it?

Share this post


Link to post
Share on other sites

what do u mean?

Share this post


Link to post
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
Sign in to follow this  
Followers 0