Jump to content

Way to detect a string


 Share

Recommended Posts

Hi everyone I am a complete nood. I can't even type noob right. Anyway, does anyone know how I can see if certain words are typed, and if they are, give a warning to quit typing the certain words?

I've read some on hotkeys and ispressed, but I am trying to write something that will detect whole words from a list.

Thank you in advance for any help.

P.S. can such a program be written to run hidden so as not to be turned off.

Edited by ikkyu
Link to comment
Share on other sites

Depends... do you mean in an autoit made gui? If so, it's as easy as...

#include <GUIConstants.au3>

GUICreate('', 120, 40)
$input = GUICtrlCreateInput('', 10, 10, 100, 20)

Dim $filter[5] = ['red', 'blue', 'green', 'purple', 'yellow']

GUISetState()

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
    For $item In $filter
        $read = GUICtrlRead($input)
        If StringInStr($read, $item) Then GUICtrlSetData($input, StringReplace($read, $item, ''))
    Next
WEnd

Otherwise, it sounds like you're looking for a keylogger?

Link to comment
Share on other sites

Depends... do you mean in an autoit made gui? If so, it's as easy as...

#include <GUIConstants.au3>

GUICreate('', 120, 40)
$input = GUICtrlCreateInput('', 10, 10, 100, 20)

Dim $filter[5] = ['red', 'blue', 'green', 'purple', 'yellow']

GUISetState()

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
    For $item In $filter
        $read = GUICtrlRead($input)
        If StringInStr($read, $item) Then GUICtrlSetData($input, StringReplace($read, $item, ''))
    Next
WEnd

Otherwise, it sounds like you're looking for a keylogger?

Thanks xcal, that's close to what I need. I'm not really looking for a logger. One of my kids was on a chat site the other day, one of his friend's parents is a friend of mine. The parent advised me that my kid was using the f-word in the chat area. I was just going to make an annoying pop-up window when certain words were typed in. I might just have to put a password on the computer and restrict usage to when I am home. I just hate to be a total d***.

Thanks

Edited by ikkyu
Link to comment
Share on other sites

Ok, take this for a spin...

HotKeySet('{esc}', 'quit')

Run('notepad.exe')
WinWait('Untitled - Notepad')
If Not WinActive('Untitled - Notepad') Then WinActivate('Untitled - Notepad')

Dim $filter[5] = ['red', 'blue', 'green', 'purple', 'yellow']

While 1
    For $item In $filter
        $text = ControlGetText('Untitled - Notepad', '', 'Edit1')
        If StringInStr($text, $item) Then
            ControlSetText('Untitled - Notepad', $text, 'Edit1', StringReplace($text, $item, ''))
            Send('{END}')
        EndIf
    Next
    Sleep(100)
WEnd

Func quit()
    Exit
EndFunc

edit - removed a redundant function and fixed a bracket

edit2 - syntax error >< it should work as intended now

Edited by xcal
Link to comment
Share on other sites

Ok, take this for a spin...

HotKeySet('{esc}', 'quit')

Run('notepad.exe')
WinWait('Untitled - Notepad')
If Not WinActive('Untitled - Notepad') Then WinActivate('Untitled - Notepad')

Dim $filter[5] = ['red', 'blue', 'green', 'purple', 'yellow']

While 1
    For $item In $filter
        $text = ControlGetText('Untitled - Notepad', '', 'Edit1')
        If StringInStr($text, $item) Then
            ControlSetText('Untitled - Notepad', $text, 'Edit1', StringReplace($text, $item, ''))
            Send('{END}')
        EndIf
    Next
    Sleep(100)
WEnd

Func quit()
    Exit
EndFunc

edit - removed a redundant function and fixed a bracket

edit2 - syntax error >< it should work as intended now

Thank you xcal, I appreciate your time and effort. I couldn't get your script to do what I want, but it might lead me in the right direction. I've been looking some more stuff up. I'm almost thinking that the only way to do exactly what I want, is to use keyhooks, and I really don't want to get into that. I'm noobier than anyone in the forum. I've just set a password on the computer for right now, but I'm not giving up. Thanks again for your help.

Link to comment
Share on other sites

Ok, take this for a spin...

HotKeySet('{esc}', 'quit')

Run('notepad.exe')
WinWait('Untitled - Notepad')
If Not WinActive('Untitled - Notepad') Then WinActivate('Untitled - Notepad')

Dim $filter[5] = ['red', 'blue', 'green', 'purple', 'yellow']

While 1
    For $item In $filter
        $text = ControlGetText('Untitled - Notepad', '', 'Edit1')
        If StringInStr($text, $item) Then
            ControlSetText('Untitled - Notepad', $text, 'Edit1', StringReplace($text, $item, ''))
            Send('{END}')
        EndIf
    Next
    Sleep(100)
WEnd

Func quit()
    Exit
EndFunc

edit - removed a redundant function and fixed a bracket

edit2 - syntax error >< it should work as intended now

Your last edit is probably what I need. I'm just going to try to send a message box to cover the computer screen when the words are typed in. I'll have to work on it tomorrow though, I need to get to bed. Have to get up early for work. Thank you very much xcal.

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