Jump to content

Recommended Posts

Posted

Hi all,

is it possible to do this with AutoIt (my preferred language :-)? In autohotkey I could do this:

#UseHook
#6::; windows key + the '6' key toggles the fake numlock
SetNumLockState, % (NumToggle := !NumToggle) ? "on" : "off"
Gui, 99:+ToolWindow
IfEqual, NumToggle, 0, Gui, 99:Destroy
Else Gui, 99: Show, +NoActivate x-1 y-1, Dummy Fake Numpad
SoundBeep, % 6+NumToggle "00", 25; audio cue for numlock
return
#IfWinExist, Dummy Fake Numpad
; note that for remaps like this, modifiers (ctrl, alt, shift) are
; taken into account automagically
m::Numpad0
7::Numpad7
8::Numpad8
9::Numpad9
u::Numpad4
i::Numpad5
o::Numpad6
j::Numpad1
k::Numpad2
l::Numpad3
#IfWinExist,

AutoIt doesn't have the '::' command, so I thought about Hotkeyset. But it seems to require a lot of code and in addition it seems that I need to specify all combination of modifier keys as well.

Is there an easier way to do this? Is there anybody that tried this already?

Many thanks for your help in advance!

Peter

Posted

Hi all,

is it possible to do this with AutoIt (my preferred language :-)? In autohotkey I could do this:

#UseHook
#6::; windows key + the '6' key toggles the fake numlock
SetNumLockState, % (NumToggle := !NumToggle) ? "on" : "off"
Gui, 99:+ToolWindow
IfEqual, NumToggle, 0, Gui, 99:Destroy
Else Gui, 99: Show, +NoActivate x-1 y-1, Dummy Fake Numpad
SoundBeep, % 6+NumToggle "00", 25; audio cue for numlock
return
#IfWinExist, Dummy Fake Numpad
; note that for remaps like this, modifiers (ctrl, alt, shift) are
; taken into account automagically
m::Numpad0
7::Numpad7
8::Numpad8
9::Numpad9
u::Numpad4
i::Numpad5
o::Numpad6
j::Numpad1
k::Numpad2
l::Numpad3
#IfWinExist,

AutoIt doesn't have the '::' command, so I thought about Hotkeyset. But it seems to require a lot of code and in addition it seems that I need to specify all combination of modifier keys as well.

Is there an easier way to do this? Is there anybody that tried this already?

Many thanks for your help in advance!

Peter

HotKeySet("{ESC}","Quit")
HotKeySet("m","Num")
HotKeySet("7","Num")
HotKeySet("8","Num")
HotKeySet("9","Num")
HotKeySet("u","Num")
HotKeySet("i","Num")
HotKeySet("o","Num")
HotKeySet("j","Num")
HotKeySet("k","Num")
HotKeySet("l","Num")

Func Num()
    If @HotKeyPressed = "m" Then
        Send("0")
    ElseIf @HotKeyPressed = "7" Then
        Send("7")
    ElseIf @HotKeyPressed = "8" Then
        Send("8")
    ElseIf @HotKeyPressed = "9" Then
        Send("9")
    ElseIf @HotKeyPressed = "u" Then
        Send("4")
    ElseIf @HotKeyPressed = "i" Then
        Send("5")
    ElseIf @HotKeyPressed = "o" Then
        Send("6")
    ElseIf @HotKeyPressed = "j" Then
        Send("1")
    ElseIf @HotKeyPressed = "k" Then
        Send("2")
    ElseIf @HotKeyPressed = "l" Then
        Send("3")
    EndIf
EndFunc

Func Quit()
    Exit
EndFunc

While 1
    Sleep(20)
WEnd
Posted

Thanks for the example. The problem with this is, that the modifiers are not taken into account. For example pressing u results into 4. But shift-u into U. There are many combinations of modifiers and keys. Any ideas how to solve this elegantly?

Thanks,

Peter

Posted

Thanks for the example. The problem with this is, that the modifiers are not taken into account. For example pressing u results into 4. But shift-u into U. There are many combinations of modifiers and keys. Any ideas how to solve this elegantly?

Thanks,

Peter

Maybe if use GetKeyState, to check if CTRL, ALT or SHIFT is pressed.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...