Jump to content
Sign in to follow this  
ExElNeT

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

Recommended Posts

ExElNeT

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

Share this post


Link to post
Share on other sites
Paulie

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

Share this post


Link to post
Share on other sites
ExElNeT

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

Share this post


Link to post
Share on other sites
ExElNeT

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.