Jump to content
Sign in to follow this  
L3G3NdKillEr

Ispressed..!

Recommended Posts

L3G3NdKillEr

hi..,

I need your help to know what should i use to limit key presses..

if "1" is pressed for five times then "1" will get blocked..


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites
LurchMan

everytime the key gets pressed have it write to an ini file, and when that key reaches 5 times, have it ignore it when it presses the key and do nothing

something to the effect of this:

#Include <Misc.au3>
$sFile = @ScriptDir & "\testing.ini"
$dll = DllOpen("user32.dll")
$cnt = 0
$read = IniRead ($sFile , "One Key" , "Pressed" , 0)
If $read = 5 Then
    
ElseIf _IsPressed(31 , $dll)
;~   extra code here
    $cnt = $cnt + 1
    IniWrite($sFile , "One Key" , "Pressed" , $cnt)
EndIf

Edit: I've used something to the effect of this to limit how many times u can attempt a password

Edited by LurchMan

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites
youknowwho4eva

I would use a variable that would reset when another key is pressed. you could use a loop to check all keys. store it in an array.


Giggity

Share this post


Link to post
Share on other sites
FireFox

I think he wants to block key after 5key press, not to do nothing :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
youknowwho4eva

that's what I'm saying, I would set it up so that any key would have to be hit 5 times in a row. then he could lock that key. I don't think he wants it to block I if he rights a sentence that contains 5 letter i's in it.


Giggity

Share this post


Link to post
Share on other sites
L3G3NdKillEr

I think he wants to block key after 5key press, not to do nothing :lmao:

Cheers, FireFox.

Hey Thanks for your fast replies.. :think:

FireFox Got my point.. exactly what i want to do.. :)


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites
FireFox

Hey Thanks for your fast replies.. :think:

FireFox Got my point.. exactly what i want to do.. :)

Look at LimitInput function udf; but dont worry, i will make an udf with some functions on it :lmao:

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
L3G3NdKillEr

Ohh really..!!

Thank you soo much Firefox(Don't Know your Name :))

And I'm Gonna take a look on limit input udf.. =)


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites
azure

Hey Thanks for your fast replies.. :lmao:

FireFox Got my point.. exactly what i want to do.. :)

#Include <Misc.au3>
$dll = DllOpen("user32.dll")

Dim $keys[10][3] = [[30,0,0],[31,0,1],[32,0,2],[33,0,3],[34,0,4],[35,0,5],[36,0,6],[37,0,7],[38,0,8],[39,0,9]]

While 1
    For $i = 0 To UBound($keys)-1
        If _IsPressed($keys[$i][0],$dll) Then
            If $keys[$i][1] >= 5 Then
                ;TrayTip("",$keys[$i][2] & " should disable here!",1)
                HotKeySet($keys[$i][2],"KeyDisabled")
            Else
                $keys[$i][1] = $keys[$i][1]+1
                TrayTip("",$keys[$i][2] & " is pressed " & $keys[$i][1] & " times!",1)
            EndIf
        Else
            ;TrayTip("","No key is pressed!",1)
        EndIf
    Next
    Sleep(100)
WEnd

Func KeyDisabled()
    TrayTip("","Sorry Bout Your Luck.. This Key's Disabled!",1)
EndFunc

Func OnAutoitExit()
    DLLClose($dll)
EndFunc

Try this. I'm guess you'll want to stick a timer in there.. maybe setup another entry in the array for the timer stat.. and after a certain amount of time reset the counter.

Share this post


Link to post
Share on other sites
L3G3NdKillEr

#Include <Misc.au3>
$dll = DllOpen("user32.dll")

Dim $keys[10][3] = [[30,0,0],[31,0,1],[32,0,2],[33,0,3],[34,0,4],[35,0,5],[36,0,6],[37,0,7],[38,0,8],[39,0,9]]

While 1
    For $i = 0 To UBound($keys)-1
        If _IsPressed($keys[$i][0],$dll) Then
            If $keys[$i][1] >= 5 Then
                ;TrayTip("",$keys[$i][2] & " should disable here!",1)
                HotKeySet($keys[$i][2],"KeyDisabled")
            Else
                $keys[$i][1] = $keys[$i][1]+1
                TrayTip("",$keys[$i][2] & " is pressed " & $keys[$i][1] & " times!",1)
            EndIf
        Else
            ;TrayTip("","No key is pressed!",1)
        EndIf
    Next
    Sleep(100)
WEnd

Func KeyDisabled()
    TrayTip("","Sorry Bout Your Luck.. This Key's Disabled!",1)
EndFunc

Func OnAutoitExit()
    DLLClose($dll)
EndFunc

Try this. I'm guess you'll want to stick a timer in there.. maybe setup another entry in the array for the timer stat.. and after a certain amount of time reset the counter.

Hey Buddy your solution is good enough for me..

Thank you soo much man..!!


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites
L3G3NdKillEr

Hey i still have some confusion. I just want to disabled "1" after 5 presses not all keys.. =)

I know i have to modify:

Dim $keys[10][3] = [[30,0,0],[31,0,1],[32,0,2],[33,0,3],[34,0,4],[35,0,5],[36,0,6],[37,0,7],[38,0,8],[39,0,9]]

But i don't know anything about arrays. =S


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Share this post


Link to post
Share on other sites
andybiochem

What is this obsession with IsPressed ???? :)

Here's a very simple way to do exactly what the OP wanted:

HotKeySet("{1}","KeyPressed")

$iHold = 0

While 1
    Sleep(100)
WEnd

Func KeyPressed()
    $iHold += 1
    If $iHold > 5 Then Return
    HotKeySet(@HotKeyPressed)
    Send(@HotKeyPressed)
    HotKeySet(@HotKeyPressed,"KeyPressed")
EndFunc

[EDIT] s --> i

Edited by andybiochem

- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

Share this post


Link to post
Share on other sites
azure

Hey i still have some confusion. I just want to disabled "1" after 5 presses not all keys.. =)

I know i have to modify:

Dim $keys[10][3] = [[30,0,0],[31,0,1],[32,0,2],[33,0,3],[34,0,4],[35,0,5],[36,0,6],[37,0,7],[38,0,8],[39,0,9]]

But i don't know anything about arrays. =S

Oh. Thought it was more than one key.

Dim $keys[1][3] = [[31,0,1]]

That'd prolly do it.. or use the hotkey method posted by andybiochem.

Share this post


Link to post
Share on other sites
L3G3NdKillEr

Hey that scripts work fine..

Thanks for your kind help.. :)


i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

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  

×