It just came to my attention that I neglected to actually post my finished script (see
my previous post).
I also have a
PDF of the keyboard layout, and summary of the special keys, for clarity.
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; half-qwerty-LJC mod.ahk
;;
;; This version by Lionel J. Camara
;; Last updated: 7/25/06
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Description:
;;
;; Uses a modifier key to "mirror" the keyboard layout to allow
;; one-handed (left-handed) typing.
;;
;; The modifier key is also used as "Esc" in AutoCAD,
;; "Up A Level" in many file dialogs, and browser back.
;;
;; ScrollLock is used as the modifier key and should be assigned
;; to your mouse's thumb button.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Setup:
;;
;; Use the control panel for your mouse to map the thumb button
;; to ScrollLock. (FYI, I use a Logitech Mx500)
;;
;; Add this script to your Startup folder.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;
; Thumb button is an Esc in AutoCAD or Browser Back in most else.
; Thumb button is also the modifier access the right-side keys.
;
; Note: currently only flips one way (use left hand on keyboard)
;
; Sometimes the ScrollLock gets "stuck" on when locking/unlocking the workstation.
; To fix: Ctrl-ScrollLock toggles
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Based on a script posted by "jonny" on Nov 16, 2004
;; (which used the space bar as the modifier), see:
;;
;; Autohotkey.com forum:
;; http://autohotkey.com/forum/viewtopic.php?t=1326
;; or http://www.autohotkey.com/forum/topic1326.html
;;
;; jonny: Many thanks to Chris for helping me out with this script.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SetStoreCapslockMode Off ; Allows Capslock to be ON to send remapped keys in uppercase.
; number row (change)
mirror_1 = 0
mirror_2 = 9
mirror_3 = 8
mirror_4 = 7
;mirror_5 = 6
mirror_5 = -
;mirror_6 = = ;is there a way to do this? I tried '= and {=}
; top row
;mirror_Tab = \ ;this doesn't work
mirror_q = p
mirror_w = o
mirror_e = i
mirror_r = u
;mirror_t = y
mirror_t = [
mirror_y = ]
; home row
mirror_a = `;
mirror_s = l
mirror_d = k
mirror_f = j
mirror_g = h
; need others
; bottom row
mirror_z = /
mirror_x = .
mirror_c = ,
mirror_v = m
mirror_b = n
; right-hand side - for completeness (no need)
;mirror_6 = 5
;mirror_7 = 4
;mirror_8 = 3
;mirror_9 = 2
;mirror_0 = 1
;mirror_y = t
;mirror_u = r
;mirror_i = e
;mirror_o = w
;mirror_p = q
;mirror_h = g
;mirror_j = f
;mirror_k = d
;mirror_l = s
;mirror_n = b
;mirror_m = v
return
; This key may help, as the space-on-up may get annoying, especially if you type fast.
;Control & NumpadLeft::Suspend
; These keys are optional, but they may help if you are typing on the left-hand side.
;CapsLock::Send, {BackSpace}
;Space & CapsLock::Send, {Enter}
; If spacebar didn't modify anything, send a real space keystroke upon release.
;NumpadLeft::
;Send {NumpadLeft}
;return
; For if you forget modifier (and makes quicker/easier to use):
Shift & CapsLock::Send, {"}
ScrollLock & `::Send, {BackSpace}
ScrollLock & RButton::Send, {Return}
;ScrollLock & CapsLock::Send, {'} ;DOESN'T HANDLE " (WITH SHIFT)
;THIS HANDLES SHIFT (AND OTHER MODIFIERS):
ScrollLock & CapsLock::
MirrorKey = '
Modifiers =
GetKeyState, state1, LWin
GetKeyState, state2, RWin
state = %state1%%state2%
if state <> UU ; At least one Windows key is down.
Modifiers = %Modifiers%#
GetKeyState, state1, Control
if state1 = D
Modifiers = %Modifiers%^
GetKeyState, state1, Alt
if state1 = D
Modifiers = %Modifiers%!
GetKeyState, state1, Shift
if state1 = D
Modifiers = %Modifiers%+
Send %Modifiers%{%MirrorKey%}
return
;Couln't figure out how to set a varable to the "=" key, so use this instead:
ScrollLock & 6::
Modifiers =
GetKeyState, state1, LWin
GetKeyState, state2, RWin
state = %state1%%state2%
if state <> UU ; At least one Windows key is down.
Modifiers = %Modifiers%#
GetKeyState, state1, Control
if state1 = D
Modifiers = %Modifiers%^
GetKeyState, state1, Alt
if state1 = D
Modifiers = %Modifiers%!
GetKeyState, state1, Shift
if state1 = D
Modifiers = %Modifiers%+
Send %Modifiers%{=}
return
ScrollLock & Tab::
Modifiers =
GetKeyState, state1, LWin
GetKeyState, state2, RWin
state = %state1%%state2%
if state <> UU ; At least one Windows key is down.
Modifiers = %Modifiers%#
GetKeyState, state1, Control
if state1 = D
Modifiers = %Modifiers%^
GetKeyState, state1, Alt
if state1 = D
Modifiers = %Modifiers%!
GetKeyState, state1, Shift
if state1 = D
Modifiers = %Modifiers%+
Send %Modifiers%{\}
return
;ScrollLock::
;IfWinNotActive, AutoCAD
;{
;Send, !{NumpadLeft}
; return
;}
;Send, {esc}
; return
;
; "Up One Level":
; Save Drawing As (AutoCAD; !1 is "Back")
; Save Web Page (Internet Explorer)
; Save As (Excel)
; Save a file (?)
;
ScrollLock::
IfWinActive, AutoCAD
{
Send, {esc}
return
}
IfWinActive, Microsoft Excel
{
Send, {esc}
return
}
IfWinActive, Save Drawing As
{
Send, !2
return
}
IfWinActive, Save Web Page
{
Send, {backspace}
return
}
IfWinActive, Save As
{
Send, {backspace}
return
}
IfWinActive, Save a file
{
Send, {backspace}
return
}
Send, !{NumpadLeft}
return
; number row
ScrollLock & 1::
ScrollLock & 2::
ScrollLock & 3::
ScrollLock & 4::
ScrollLock & 5::
; top row
;ScrollLock & Tab::
ScrollLock & q::
ScrollLock & w::
ScrollLock & e::
ScrollLock & r::
ScrollLock & t::
ScrollLock & y::
; home row
;ScrollLock & CapsLock::
ScrollLock & a::
ScrollLock & s::
ScrollLock & d::
ScrollLock & f::
ScrollLock & g::
; bottom row
ScrollLock & z::
ScrollLock & x::
ScrollLock & c::
ScrollLock & v::
ScrollLock & b::
; right side
;ScrollLock & `;::
;ScrollLock & ,::
;ScrollLock & .::
;ScrollLock & /::
;ScrollLock & 6::
;ScrollLock & 7::
;ScrollLock & 8::
;ScrollLock & 9::
;ScrollLock & 0::
;ScrollLock & y::
;ScrollLock & u::
;ScrollLock & i::
;ScrollLock & o::
;ScrollLock & p::
;ScrollLock & h::
;ScrollLock & j::
;ScrollLock & k::
;ScrollLock & l::
;ScrollLock & n::
;ScrollLock & m::
; Determine the mirror key, if there is one:
;if A_ThisHotkey = space & `;
; MirrorKey = a
;else if A_ThisHotkey = space & ,
; MirrorKey = c
;else if A_ThisHotkey = space & .
; MirrorKey = x
;else if A_ThisHotkey = space & /
; MirrorKey = z
;if A_ThisHotkey = space & CapsLock
; MirrorKey = '
;else ; To avoid runtime errors due to invalid var names, do this part last.
{
StringRight, ThisKey, A_ThisHotkey, 1
StringTrimRight, MirrorKey, mirror_%ThisKey%, 0 ; Retrieve "array" element.
if MirrorKey = ; No mirror, script probably needs adjustment.
return
}
Modifiers =
GetKeyState, state1, LWin
GetKeyState, state2, RWin
state = %state1%%state2%
if state <> UU ; At least one Windows key is down.
Modifiers = %Modifiers%#
GetKeyState, state1, Control
if state1 = D
Modifiers = %Modifiers%^
GetKeyState, state1, Alt
if state1 = D
Modifiers = %Modifiers%!
GetKeyState, state1, Shift
if state1 = D
Modifiers = %Modifiers%+
Send %Modifiers%{%MirrorKey%}
return