Jump to content
Sign in to follow this  
lordicast

Input censor(Solved)

Recommended Posts

lordicast

hey guys is there anyway of banning a word like a censor from a specific Input

$txt = GUICtrlCreateInput("", 64, 232, 185, 21)

if GUICtrlRead($txt) = 'hello' Then

suit()

Else

Msgbox(0,'title,''$txt'')

EndIf

I get it to work for just saying "hello" however function wont work with sentences like "hello my name is" or "oh hello by the way"

thanks

Edited by lordicast

[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites
MerkurAlex

hey guys is there anyway of banning a word like a censor from a specific Input

$txt = GUICtrlCreateInput("", 64, 232, 185, 21)

if GUICtrlRead($txt) = 'hello' Then

suit()

Else

Msgbox(0,'title,''$txt'')

EndIf

I get it to work for just saying "hello" however function wont work with sentences like "hello my name is" or "oh hello by the way"

thanks

Look at stringreplace in the help file.

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites
JustinReno

I learned something new. :P

Anyways, look of this example I made:

$GUI = GUICreate("GUI", 123, 22, 193, 115)
$Input = GUICtrlCreateInput("", 0, 0, 121, 21)
GUISetState(@SW_SHOW)

While 1
    $Read = GUICtrlRead($Input)
    $StringReplace = StringReplace($Read, "boob", "breast")
    GuiCtrlSetData($Input, $StringReplace)
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
Achilles

If you want a more efficient (and more complicated) way then Justin's then use GuiRegisterMsg(). This would allow you to be notified every time the text is changed. However, if this is just a small script I would recommend staying with the simple solution.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
lordicast

that may be what I need piano im trying to call a function when any part of that string hits. thanks justin and eagle both suggestions work for different instances solved 2 problems


[Cheeky]Comment[/Cheeky]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.