Jump to content

Input censor(Solved)


 Share

Recommended Posts

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]
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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