Jump to content

HotKeySet advanced, numbers, ^s1 (Control-s-1)


ExElNeT
 Share

Recommended Posts

Hi!

Is it possible to make a set of keys pressed a hotkey? (emacs style)

Im trying something like this:

HotKeySet("#s1", Func1)

HotKeySet("#s2", Func2)

HotKeySet("#s3", Func3)

The Hotkeys should be WindowsKey+s+1 or 2 or 3.

Any idea on that?

Edited by ExElNeT
Link to comment
Share on other sites

Hi!

Is it possible to make a set of keys pressed a hotkey? (emacs style)

Im trying something like this:

HotKeySet("#s1", Func1)

HotKeySet("#s2", Func2)

HotKeySet("#s3", Func3)

The Hotkeys should be WindowsKey+s+1 or 2 or 3.

Any idea on that?

You can chain up to keys together, but i believe you can only have 1 non-modifier key

HotKeySet("#^1", "Func1"); Windows + Ctrl + 1
HotKeySet("#^2", "Func2"); Windows + Ctrl + 2
HotKeySet("#^3", "Func3"); Windows + Ctrl + 3

While 1
    Sleep(100)
WEnd

Func Func1()
    MsgBox(0,"1","Hello From Function 1!")
EndFunc

Func Func2()
    MsgBox(0,"2","Hello From Function 2!")
EndFunc

Func Func3()
    MsgBox(0,"3","Hello From Function 3!")
EndFunc
Link to comment
Share on other sites

You can chain up to keys together, but i believe you can only have 1 non-modifier key

HotKeySet("#^1", "Func1"); Windows + Ctrl + 1
HotKeySet("#^2", "Func2"); Windows + Ctrl + 2
HotKeySet("#^3", "Func3"); Windows + Ctrl + 3

While 1
    Sleep(100)
WEnd

Func Func1()
    MsgBox(0,"1","Hello From Function 1!")
EndFunc

Func Func2()
    MsgBox(0,"2","Hello From Function 2!")
EndFunc

Func Func3()
    MsgBox(0,"3","Hello From Function 3!")
EndFunc

thats what i need .... a second or third modifier key... currently im trying with is_Pressed ...

Link to comment
Share on other sites

I found a workaround, this waits up to 2 seconds for the next key, which should be a numpad key.

Func hotKeyPressed()
    $key = getPressedKey()  
    Switch @HotKeyPressed
        Case ...
            func($key)
        Case ...
            func($key)  
    EndSwitch   
EndFunc

Func getPressedKey()
    For $i = 0 to 2000 Step 1
        Sleep(1)
        For $i = 0 to 9 Step 1      
            If _IsPressed($i+60) Then
                Return $i
            EndIf
        Next
    Next
    Return -1
EndFunc
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...