 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
mbirth
Joined: 03 Oct 2005 Posts: 40 Location: DE, Berlin
|
Posted: Sat May 05, 2007 10:19 am Post subject: |
|
|
Here is a much more flexible version. I almost recoded everything in a more compact manner. I also solved the CapsLock-thingy where the CapsLock-LED doesn't light up and pressing SPACE while CapsLock is on, a space appears before the first character. Also I made it work with German, English and French keyboard layout. (Getting the keyboard locale from Registry is important, b/c if you have an English system with German keyboard, A_Locale will return 0409 (=English).
For my keyboard locale, all numeric keys return the shifted punctuation signs when CapsLock is on.
Download the whole stuff incl. nice TrayIcon and Help-Image here. The image is this:
And the icon.
Here comes the code:
| Code: | #SingleInstance
; HalfKeyboard invented by Matias Corporation between 1992 and 1996
; Originally coded in AutoHotkey by jonny in 2004
; Many thanks to Chris for helping him out with this script.
; Capslock hacks and `~ remap to '" by Watcher
; This implementation was done by mbirth in 2007
Menu Tray, Icon, HalfKeyboard.ico
Menu Tray, Tip, HalfKeyboard emulator
Menu Tray, Add, E&xit, MenuExit
Menu Tray, NoStandard
FileInstall HK_dn.gif, HalfKeyboard_help.gif
RegRead KLang, HKEY_CURRENT_USER, Keyboard Layout\Preload, 1
StringRight KLang, KLang, 4
If (!KLang)
KLang := A_Language
If (KLang = "0407") {
; 0407 DE_de QWERTZ mirror set
original := "^12345qwertasdfgyxcvb"
mirrored := "ß09876poiuzölkjh-.,mn"
} Else If (KLang = "040c" || KLang = "040C") {
; 040c FR_fr AZERTY mirror set
original := "²&é" . """" . "'(azertqsdfgwxcvb" ; split up string for better
mirrored := ")àç" . "_" . "è-poiuymlkjh!:;,n" ; human readability
} Else {
; 0409 US_us QWERTY mirror set
original := "``" . "12345qwertasdfgzxcvb" ; split up string for better
mirrored := "'" . "09876poiuy;lkjh/.,mn" ; human readability
}
; Now define all hotkeys
Loop % StrLen(original)
{
c1 := SubStr(original, A_Index, 1)
c2 := SubStr(mirrored, A_Index, 1)
Hotkey Space & %c1%, DoHotkey
Hotkey Space & %c2%, DoHotkey
}
return
; This key may help, as the space-on-up may get annoying, especially if you type fast.
Control & Space::Suspend
; Not exactly mirror but as close as we can get, Capslock enter, Tab backspace.
Space & CapsLock::Send {Enter}
Space & Tab::Send {Backspace}
; If spacebar didn't modify anything, send a real space keystroke upon release.
+Space::Send {Space}
Space::Send {Space}
; Define special key combos here (took them from RG's mod):
^1::Send {Home}
^2::Send {End}
^3::Send {Del}
; General purpose
DoHotkey:
StringRight ThisKey, A_ThisHotkey, 1
i1 := InStr(original, ThisKey)
i2 := InStr(mirrored, ThisKey)
If (i1+i2 = 0) {
MirrorKey := ThisKey
} Else If (i1 > 0) {
MirrorKey := SubStr(mirrored, i1, 1)
} Else {
MirrorKey := SubStr(original, i2, 1)
}
Modifiers := ""
If (GetKeyState("LWin") || GetKeyState("RWin")) {
Modifiers .= "#"
}
If (GetKeyState("Control")) {
Modifiers .= "^"
}
If (GetKeyState("Alt")) {
Modifiers .= "!"
}
If (GetKeyState("Shift") + GetKeyState("CapsLock", "T") = 1) {
; only add if Shift is held OR CapsLock is on (XOR) (both held down would result in value of 2)
Modifiers .= "+"
}
Send %Modifiers%{%MirrorKey%}
return
Space & F1::
; Help-screen using SplashImage
CoordMode Caret, Screen
y := A_CaretY + 20
If (y > A_ScreenHeight-100)
y := A_CaretY - 20 - 100
SplashImage HalfKeyboard_help.gif, B X%A_CaretX% Y%y%
Sleep 5000
SplashImage OFF
return
MenuExit:
ExitApp
return |
Cheers,
-mARKUS |
|
| Back to top |
|
 |
lcamara
Joined: 20 Jul 2005 Posts: 6 Location: Kaneohe & Honolulu, HI
|
Posted: Wed May 09, 2007 1:13 am Post subject: updated version |
|
|
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 |
_________________ Lionel Camara
KAI Hawaii, Inc. (Structural & Forensic Engineers)
Programmer, IT Guy, & Detailer |
|
| Back to top |
|
 |
rubo77
Joined: 02 Jun 2007 Posts: 10
|
Posted: Sat Jun 02, 2007 10:08 pm Post subject: |
|
|
i tried to type with this system, and came to the point, that i would never get really fast with it. the space key is slowing down too much.
so i invented a new layout, ENTI-Key++ :
www.entikey.z11.de
you can get really fast with it, cause it has the keys remapped to optimal positions.
is it possible to create an autohotkey-script for that layout? |
|
| Back to top |
|
 |
lcamara
Joined: 20 Jul 2005 Posts: 6 Location: Kaneohe & Honolulu, HI
|
Posted: Mon Jun 04, 2007 7:16 pm Post subject: possible, but... |
|
|
It's true that the space key slows you down significantly, especially when typing two-handed (which is why I use my mouse's thumb-button as the modifier).
Your layout looks interesting, but I'm not sure how much speed you would really gain... unless you've been typing with it a long time? When I was first researching one-handed typing, I came across some kind of study that said that while there were speed increases using different layouts, it wasn't very significant (what was more significant to speed was how long the layout had been used - experience).
That's one of the main reasons why I went with a half-QWERTY layout for my one-hand (quick to learn, and similar to standard QWERTY). Also, typing with a layout that's significantly different from the "standard" layout reduces your ability to function on another computer (that doesn't have your custom layout software). Using something like a Frogpad would require learning a new layout, as well as transporting special hardware wherever you go.
That said, I'm sure it wouldn't be too hard to write a script for your layout, except that I'm wondering what key you use to access the "green" characters? I also don't see the bottom row (ctrl-alt-space) in your diagram. _________________ Lionel Camara
KAI Hawaii, Inc. (Structural & Forensic Engineers)
Programmer, IT Guy, & Detailer |
|
| Back to top |
|
 |
Ruben Guest
|
Posted: Tue Jun 05, 2007 6:52 am Post subject: Re: possible, but... |
|
|
| lcamara wrote: | | It's true that the space key slows you down significantly, especially when typing two-handed (which is why I use my mouse's thumb-button as the modifier). | yes, the keys N, I, komma, dot, minus and O are too frequent
| Quote: | | Your layout looks interesting, but I'm not sure how much speed you would really gain... unless you've been typing with it a long time? When I was first researching one-handed typing, I came across some kind of study that said that while there were speed increases using different layouts, it wasn't very significant (what was more significant to speed was how long the layout had been used - experience). | sure, experience will be the main factor, but with my layout i will be faster than i can ever get with QWERTY
| Quote: | | ...reduces your ability to function on another computer (that doesn't have your custom layout software). |
i don't 'forget' my QWERTY-skill
| Quote: | | That said, I'm sure it wouldn't be too hard to write a script for your layout, except that I'm wondering what key you use to access the "green" characters? I also don't see the bottom row (ctrl-alt-space) in your diagram. | the green buttons are Shift+AltGr |
|
| Back to top |
|
 |
Conquer
Joined: 27 Jun 2006 Posts: 384 Location: Canada
|
Posted: Sun Jun 10, 2007 8:40 pm Post subject: |
|
|
Sweeeeet! I love you.. in a non-weird way, of course.
Though it kind of gets in the way if i go back to normal typing, it limits the speed of the space key, but there is a hotkey to Suspend, so all is well
Well done!
Ps. It might take a while to get used to this... But thanks, I always wanted something like this! _________________
 |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Jul 21, 2007 3:01 pm Post subject: |
|
|
| cr33p wrote: | Xlnt! I've been looking for a one-handed keyboard for some time - gotta prep the one-handed typing for when our next son arrives in January, so's I can still chat and hold the baby at the same time, heh.
Awesome to see this accomplished in AHK :] Now, where to turn for tutorials and drills on how to actually learn how to type faster than two words a minute ...
Incidentally, how difficult would it be to remap this setup to use only the number pad, as seen here: http://www.fourtytwo.de/one-hand/one-hand.html - cause that's just pretty sexy. |
URL outdated
http://goron.de/~johns/one-hand/
Since it looks like Autohotkey can support this mapping, perhaps I try making a script.
Johns |
|
| Back to top |
|
 |
rubo77
Joined: 02 Jun 2007 Posts: 10
|
Posted: Mon Jul 23, 2007 10:25 am Post subject: |
|
|
| cr33p wrote: | Xlnt! I've been looking for a one-handed keyboard for some time - gotta prep the one-handed typing for when our next son arrives in January, so's I can still chat and hold the baby at the same time, heh.
Awesome to see this accomplished in AHK :] Now, where to turn for tutorials and drills on how to actually learn how to type faster than two words a minute ...
http://goron.de/~johns/one-hand/
|
this is a great idea.
using only the numberpad:
 |
|
| Back to top |
|
 |
. kr dc.p9l y'39.py8 Guest
|
Posted: Sun Aug 12, 2007 5:34 am Post subject: Dvorak. |
|
|
Could somebody possibly reformat this script for Dvorak? I've been using it for the past 6-7 years because of my CT. My wrists are deformed, so I can't use ergonomic keyboards, and I can't use qwerty anymore or my hands cramp up very quickly.
Thank you very much. |
|
| Back to top |
|
 |
aoesuhtade Guest
|
Posted: Sun Aug 12, 2007 9:14 am Post subject: NVMLOLZ |
|
|
| Code: | ; Left Hand Keyboard for Touch Typists.
; Date: 02-08-2006
; To make Shift/Ctrl/Alt keys "sticky" Thanks Titan!
Loop, % 255 - 165
end := end . ",{" . Chr(A_Index + 32) . "}"
Shift::
Input, key, B L1 *, %end%
StringReplace, key, ErrorLevel, EndKey:
Send {Shift Down}{%key%}{Shift Up}
Return
Ctrl::
Input, key, B L1 *, %end%
StringReplace, key, ErrorLevel, EndKey:
Send {Ctrl Down}{%key%}{Ctrl Up}
Return
Alt::
Input, key, B L1 *, %end%
StringReplace, key, ErrorLevel, EndKey:
Send {Alt Down}{%key%}{Alt Up}
Return
; Without this capslock would shift only letters.
+CapsLock:: ; Must catch capslock and Shift capslock to make this work.
CapsLock::
if CapsState = D
{
CapsState = U
Send {LShift Up}
}
else
{
CapsState = D
Send {LShift Down}
}
return
;Consider the following example, which makes Space into a prefix key.
Space & '::Send,{l}
Space & ,::Send,{r}
Space & .::Send,{c}
Space & p::Send,{g}
Space & y::Send,{f}
Space & a::Send,{s}
Space & o::Send,{n}
Space & e::Send,{t}
Space & u::Send,{h}
Space & i::Send,{d}
Space & `;::Send,{z}
Space & q::Send,{v}
Space & j::Send,{w}
Space & k::Send,{m}
Space & x::Send,{b}
Space & `::send,{/}
Space & 1::Send,{0}
Space & 2::Send,{9}
Space & 3::Send,{8}
Space & 4::Send,{7}
Space & 5::Send,{6}
Space & Tab::Send,{BS}
Space & CapsLock::Send,{Enter}
;To make the Space bar send a real "Space" keystroke whenever it isn't used to launch a hotkey.
$Space::
Send, {Space down}
Sleep 250
Send {Space up}
Return
;The $ prefix is needed to prevent a warning dialog about an infinite loop (since the hotkey
;"sends itself").In addition, the above action occurs at the time the key is released.
|
I fixed it for Dvorak. How do I get rid of that annoying delay after I press the spacebar, though? It wont register fast enough when I want to type with two hands. |
|
| Back to top |
|
 |
rubo77
Joined: 02 Jun 2007 Posts: 10
|
Posted: Mon Aug 13, 2007 9:39 am Post subject: Re: Dvorak. |
|
|
| . kr dc.p9l y'39.py8 wrote: | Could somebody possibly reformat this script for Dvorak? I've been using it for the past 6-7 years because of my CT. My wrists are deformed, so I can't use ergonomic keyboards, and I can't use qwerty anymore or my hands cramp up very quickly.
Thank you very much. |
maybe www.entikey.z11.de is something for you then. |
|
| Back to top |
|
 |
mooklepticon Guest
|
Posted: Tue Aug 14, 2007 8:13 pm Post subject: Re: NVMLOLZ |
|
|
| aoesuhtade wrote: |
I fixed it for Dvorak. How do I get rid of that annoying delay after I press the spacebar, though? It wont register fast enough when I want to type with two hands. |
I reduced the sleep to 1 and it seems to function well, but i still can't type too fast. I can press the space bar and then a key fast enough so that it will interpret it as a mirrored keypress. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 7698 Location: Germany (but I only speak English)
|
Posted: Tue Aug 14, 2007 8:31 pm Post subject: |
|
|
sleep with values below 10-16 actually sleep for 10 to 16 ms. if you want to sleep for less time, you must remove the sleep command. _________________
Unless noted, all code is UNTESTED.
Answers Here: 1.(Loops, Viruses, etc.) 2.Search 3.RTFM 4.Ask for Help.
PMs will be ignored unless you are hiring me. |
|
| Back to top |
|
 |
Gizzmo Guest
|
Posted: Mon Oct 01, 2007 8:48 am Post subject: Holding down the space key. |
|
|
I'd like to be able to hold down the space key and continue to type mirrored letters. Is there a reason why this hasn't been implemented into the program?
I notice that when I type consecutive mirrored letters quickly that this does seem to work in the way that I'm describing. Was it programmed that way specifically? Because I can only seem to get it to work that way with two consecutive mirrored letters.
However this is an AWESOME idea! |
|
| Back to top |
|
 |
Gizzmo Guest
|
Posted: Tue Oct 02, 2007 6:10 am Post subject: Oddly Enough... |
|
|
It doesn't seem to do it when I'm typing on my computer at home though...
With my computer at work it seems to want to release the ''space'' command after the length of time dictated by the script. However when I use the same script at home with the same script. I can just hold down the space key and type indefinitely. Any thoughts as to why one would work and the other wouldn't??? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|