Jump to content
Sign in to follow this  
AlmarM

Need some help

Recommended Posts

AlmarM

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.

Share this post


Link to post
Share on other sites
Nahuel

GuiCtrlRead()

StringReplace()

:P

Share this post


Link to post
Share on other sites
weaponx

#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

Share this post


Link to post
Share on other sites
AlmarM

K ty.

But, if I want more al only s... Sould I do: "s,a", "$, 4"

Or what ?


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.

Share this post


Link to post
Share on other sites
Nahuel

#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

Share this post


Link to post
Share on other sites
GoStar

GuiCtrlRead()

StringReplace()

:P

you can refere these two functions as well

StringRegExp()

StringRegExpReplace()

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  

×