rendered paste body#Copyright (c) 2009 Pavel Chikulaev (pavel.chikulaev@gmail.com)
#Released to Public Domain
press_count = 0
sticky_hotkeys = false
MyAppsKeyHotkeys(enable)
{
if (enable = "Off")
{
global press_count
press_count = 0
}
HotKey, *i, MyUp, %enable%
HotKey, *k, MyDown, %enable%
HotKey, *j, MyLeft, %enable%
HotKey, *l, MyRight, %enable%
HotKey, *h, MyPgUp, %enable%
HotKey, *n, MyPgDn, %enable%
HotKey, *;, MyEnter, %enable%
HotKey, *p, MyBS, %enable%
HotKey, *[, MyDel, %enable%
HotKey, *u, MyHome, %enable%
HotKey, *o, MyEnd, %enable%
Hotkey, *m, MyApps, %enable%
Hotkey, *y, MyEsc, %enable%
Hotkey, *s, MySticky,%enable%
}
MyUp:
press_count += 1
Send {Blind}{Up}
Return
MyDown:
press_count += 1
Send {Blind}{Down}
Return
MyLeft:
press_count += 1
Send {Blind}{Left}
Return
MyRight:
press_count += 1
Send {Blind}{Right}
Return
MyPgUp:
press_count += 1
Send {Blind}{PgUp}
Return
MyPgDn:
press_count += 1
Send {Blind}{PgDn}
Return
MyEnter:
press_count += 1
Send {Blind}{Enter}
Return
MyBS:
press_count += 1
Send {Blind}{BS}
Return
MyDel:
press_count += 1
Send {Blind}{Del}
Return
MyHome:
press_count += 1
Send {Blind}{Home}
Return
MyEnd:
press_count += 1
Send {Blind}{End}
Return
MyApps:
press_count += 1
Send {Blind}{AppsKey}
Return
MyEsc:
press_count += 1
Send {Esc}
Return
MyMinimize:
WinMinimize, A
Return
MyMaximize:
WinGet, state, MinMax, A
if state
WinRestore, A
else
WinMaximize, A
Return
MySticky:
HotkeyHook("Sticky")
press_count = 0
Return
CapsLock::
HotkeyHook("Down")
Return
CapsLock Up::
HotkeyHook("Up")
Return
HotkeyHook(Mode)
{
static sticky_hotkeys = 0
global press_count
if (Mode = "Down")
{
if (sticky_hotkeys = 1)
{
sticky_hotkeys = 0
}
else
{
MyAppsKeyHotkeys("On")
sticky_hotkeys = 1
}
}
else if (Mode = "Up")
{
if (press_count > 0 or sticky_hotkeys = 0)
{
sticky_hotkeys = 0
MyAppsKeyHotkeys("Off")
}
}
else if (Mode = "Sticky")
{
sticky_hotkeys = 1
}
}