Jump to content

Need some help


AlmarM
 Share

Recommended Posts

Hey,

I have:

#include <GUIConstants.au3>

$GUI = GUICreate("Example", 200, 90, -1, -1)
$Example_Input = GUICtrlCreateInput("", 10, 60, 180, 20)
$Example_Button = GUICtrlCreateButton("Example", 10, 30, 180, 25)
$Example_Label = GUICtrlCreateLabel("Example Label", 10, 10, 70, 20)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
        Exit
    Case $nMsg = $Example_Button
        ;Read whats typed in the Input
        ;Search for some letters for example: s
        ;If s is found replace it with $
        ;GUICtrlSetData() the Example label with the replaced letters
    EndSelect
WEnd

And what I want to know is:

If the button is pressed. The script reads whats writed into the input.

If the script have read it and finds for example the: s

If s is found replace it with $

Then GUICtrlSetData the replaced letters.

Example:

User typed:

AutoIT

Script need to show:

4ut0!t

in the label

I did look into the Help File and found StringReplace() but I dont realy know what I sould do to Replace the s with $

-AlmarM-

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

#include <GUIConstants.au3>

$GUI = GUICreate("Example", 200, 90, -1, -1)
$Example_Input = GUICtrlCreateInput("", 10, 60, 180, 20)
$Example_Button = GUICtrlCreateButton("Example", 10, 30, 180, 25)
$Example_Label = GUICtrlCreateLabel("Example Label", 10, 10, 70, 20)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
        Exit
    Case $nMsg = $Example_Button
        ;Read whats typed in the Input
        ;Search for some letters for example: s
        ;If s is found replace it with $
        ;GUICtrlSetData() the Example label with the replaced letters
        GUICtrlSetData($Example_Label, StringReplace(GUICtrlRead($Example_Input), "s", "$"))
    EndSelect
WEnd

Link to comment
Share on other sites

#include <GUIConstants.au3>

$GUI = GUICreate("Example", 200, 90, -1, -1)
$Example_Input = GUICtrlCreateInput("", 10, 60, 180, 20)
$Example_Button = GUICtrlCreateButton("Example", 10, 30, 180, 25)
$Example_Label = GUICtrlCreateLabel("Example Label", 10, 10, 70, 20)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
        Exit
    Case $nMsg = $Example_Button
        ;Read whats typed in the Input
        ;Search for some letters for example: s
        ;If s is found replace it with $
        ;GUICtrlSetData() the Example label with the replaced letters
        $string=GUICtrlRead($Example_Input)
        $string=StringReplace($string,"s","$")
        $string=StringReplace($string,"A","4")
        $string=StringReplace($string,"o","0")
        $string=StringReplace($string,"i","!")
        GUICtrlSetData($Example_Label, $string)
    EndSelect
WEnd

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...