Jump to content

Redirect only when a whole word is typed on the keyboard


Recommended Posts

Is it possible with _IsPressed to redirect or run a file when a group of words or a specific string is typed in succession, kind of like a realtime bad word filter? The redirect part is easy, but I'm not sure how to get it to recognize that an exact specific string was entered. Any ideas?

When "cat" is typed I want to MsgBox...not "tac" or "act"

CODE
#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1

Sleep ( 250 )

If _IsPressed("43", $dll) + _IsPressed("41", $dll) + _IsPressed("54", $dll) Then

MsgBox(0,"_IsPressed", "End Key Pressed")

ExitLoop

EndIf

WEnd

DllClose($dll)

Edited by DigitalLocksmith
Link to comment
Share on other sites

CODE
#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1

Sleep ( 250 )

If _IsPressed("43", $dll) + _IsPressed("41", $dll) + _IsPressed("54", $dll) Then

MsgBox(0,"_IsPressed", "End Key Pressed")

ExitLoop

EndIf

WEnd

DllClose($dll)

That would only detect if you hold ALL the buttons down..

You'd have to create some kind of function, that detects when one key was pushed, then check if the next expected key is pressed within some time(0.5 to 1 second), and the same again for the next key..

Link to comment
Share on other sites

works:)

btw you could use a timer because this prog records test even if letters are tiped after hours and hours and...

Edit: forgot code tags :rolleyes:

Edited by alexmadman

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

I once did this for 001 using Larry's mousehook. May be a bit difficult, but it definitely rocks.

http://www.autoitscript.com/forum/index.ph...st&p=247970

Edit: Get the DLL here: http://www.autoitscript.com/forum/index.php?showtopic=23173

Wow, that's really cool, but I have a question..

Looking over your script I understand everything, at the exception of this line(s):

If $WParam = 0x00000060 OR $WParam = 0x00000030 Then

I understand that 0x00000030 is equal to 0, but why include 0x00000060 in your If..EndIf statement? If I'm not mistaken I believe 0x00000060 is equal to = ? Why would you want that? The example script is very nice, I'm glad you shared it with the forum. This can help me at many occasions, time to play around with it :rolleyes:

Thanks,

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

What about something like this?

#include <misc.au3>

Global $Word = "CAT"
Global &#036ÕYÛÜH    ][ÝÉ][ÝÂÚ[JJBIÌÍØÚHÑÙ]ÚXÝÜÙY

BZYb33c¶6fÇC²fwC²ÓFVà b33cµGVEv÷&Bf׳Òb33c¶6 FööÅFbÀÌØíQåÁ]½É°À°À¤($%M±À ÄÀÀ¤(%¹%($(%¥¡MÑÉ¥¹%¹MÑÈ ÀÌØíQåÁ]½É $Word)) Then
        MsgBox(0, "", "You typed cat!"BBIÌÍÕYÛÜH   ][ÝÉ][ÝÂQ[[[ÈÑÙ]ÚXÝÜÙY

Bf÷"b33c¶ÒFò#SP bô5&W76VBWb33c¶Â"FVà &WGW&â6È ÀÌØí¤¤($%¹%(%9áÐ(%ÉÑÕɸ´Ä)¹Õ¹
Edited by chris95219
Link to comment
Share on other sites

Wow, that's really cool, but I have a question..

Looking over your script I understand everything, at the exception of this line(s):

If $WParam = 0x00000060 OR $WParam = 0x00000030 Then

I understand that 0x00000030 is equal to 0, but why include 0x00000060 in your If..EndIf statement? If I'm not mistaken I believe 0x00000060 is equal to = ? Why would you want that? The example script is very nice, I'm glad you shared it with the forum. This can help me at many occasions, time to play around with it :rolleyes:

Thanks,

Kurt

0x00000030, and 0x00000060 is hex values(all values starting with 0x is hex values), which is NOT equal to 0(actually, 0x00000030, can be written as 0x30, and is equal to decimal 48, same with 0x60, equals to decimal 96)
Link to comment
Share on other sites

Awesome...Both of these solutions are working. I do still have one question though. If one of the words is capitalized, the shift key sticks. I've tried to release it by Send("{SHIFTDOWN}{SHIFTUP}") and variants of up and down to no avail. How do you get around this? Also in chris95219's example, if you hold the key for more than a milisecond or so it registers multiple times and doesn't recognize the word. I think the send delay needs to be adjusted, but I haven't figured out how to make it work yet. Advice?

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