Jump to content

Keypad "000" as a hotkey in V3


Kulanb
 Share

Recommended Posts

---------------EDIT-------------

Sorry guys, wrong forum, I meant to put this in V3 NOT V2, my apologies!

:">

---------------/EDIT--------------

Hi folks,

I'm partly a noob, but I'm learning fast. I have written a script to bind my entire external keypad to hotkeys. Problem is, the keypad has a special "000" key. The problem I'm encountering is the Keypad000 is really just a built-in circuit that pulses the "0" key three times. I've tried using a counter and a timer to capure three 0's within a specified time frame to detect a numpad000 'else' pass on just a single numpad0 but I'm still having trouble with it. It's proven to be a challenge. Has anyone out there got a better solution? I'm embarassed to say I've spent a day and a half on this with mixed results. I've seen someone's solution here but with a beta or something, the code is not compatible with V3. I'm also having a hard time translating it into V3 code. Any help would be met with cheers and mug of the finest ale if we ever meet. I live in Toronto, Ontario, Canada BTW.

Here is what I have so far, I just put focus in a TXT file while running it to capture the results. I think I need to find better solution for the timestamping...

HotKeySet("{numpad0}", "num0")
$num0=0
$time=TimerInit()

while 1
    $num0=0 
wend

func num0()
    $time=TimerInit()
    $num0=$num0+1
    if $num0=3 then
        send("n000 is pressed{enter}");XXXXX NUMPAD 000 FUNCTION HERE XXXXX
        $num0=0
    elseif $num0<3 then
        send("n0 is pressed{enter}");XXXXX NUMPAD 0 FUNCTION HERE XXXXX
        
    endif
endfunc
Edited by Kulanb
Link to comment
Share on other sites

If the following doesn't work, try increasing the tolerance. One note: You have to fully press down and press up the 000 key for the event to fire. That is, if you hold down on 000, it will not repeat.....

HotKeySet("{NumPad0}", "trap000button")

Global $tolerance = 100;milliseconds
Global $numpad0Count = 0
Global $timer

While 1
    sleep(10)
WEnd

Func trap000button()
    If $numpad0Count = 0 Then $timer = TimerInit()
        
    $numpad0Count = $numpad0Count + 1
    
    If $numPad0Count = 3 Then
        $numPad0Count = 0
; Let's send the equals sign when the 000 button is pressed
        Send("=")
    EndIf
    
    If TimerDiff($timer) > $tolerance Then $numpad0Count = 0
EndFunc

Edit: Well, the individual NumPad zero key won't work either with my code. I need to think about this.

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...