AlmarM Posted November 21, 2007 Share Posted November 21, 2007 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 More sharing options...
Nahuel Posted November 21, 2007 Share Posted November 21, 2007 GuiCtrlRead() StringReplace() Link to comment Share on other sites More sharing options...
weaponx Posted November 21, 2007 Share Posted November 21, 2007 #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 More sharing options...
AlmarM Posted November 21, 2007 Author Share Posted November 21, 2007 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. Link to comment Share on other sites More sharing options...
Nahuel Posted November 21, 2007 Share Posted November 21, 2007 #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 More sharing options...
GoStar Posted November 21, 2007 Share Posted November 21, 2007 GuiCtrlRead()StringReplace()you can refere these two functions as wellStringRegExp()StringRegExpReplace() 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