@CovenStine: Just to be sure you know, have you tried "edit 3":
<!-- m -->http://www.autohotke... ... 783#228783<!-- m -->
if you hold down a key for one second it will be converted to a CAPITAL
letter, saves you the trouble of holding down shift. Of course you might
not like it...
Half-QWERTY: One-handed Typing
Started by
jonny
, Nov 16 2004 03:13 AM
175 replies to this topic
Thanks for the script! I broke my finger so this will help a lot! I'm actually using it right now so double thanks!
#107
-
Posted 05 August 2009 - 02:43 AM
That's an interesting idea, holding down the button to skip the shift...
I guess I was trying to emulate -as close as possible- the behavior of my M-corp half-qwerty keyboard... I have just the one hand, and use the M- kbd on my desktop, and use this script on my laptop.
Down the road, I'd love to use an ergo keyboard on my desktop and switch to scripted work there, too.
In the meantime, I'm simply trying to make this script behave like my keyboard at home behaves, the only exception being the hardware-based stickyKeys, which suck.
Thanks though!
~C
I guess I was trying to emulate -as close as possible- the behavior of my M-corp half-qwerty keyboard... I have just the one hand, and use the M- kbd on my desktop, and use this script on my laptop.
Down the road, I'd love to use an ergo keyboard on my desktop and switch to scripted work there, too.
In the meantime, I'm simply trying to make this script behave like my keyboard at home behaves, the only exception being the hardware-based stickyKeys, which suck.
Thanks though!
~C
#108
-
Posted 05 August 2009 - 11:28 AM
Did not have a use for ' mapping to ` when using the modifier, so I just set the script so that space together with ' make an actual space. Works great and increases my typing speed.
#109
-
Posted 14 September 2009 - 10:04 PM
thank you, this is EXACTLY what im after for online games and such, excellent work
#110
-
Posted 15 September 2009 - 02:29 AM
frosty the snowman
Ex-AutoIt user
class: intermediate
Ex-AutoIt user
class: intermediate
CovenStine,
Using Edit 3A, find the following lines:
Comment out the first of those two lines as follows:
That passes SHIFT-SPACE through properly.
Using Edit 3A, find the following lines:
; If spacebar didn't modify anything, send a real space keystroke upon release. +Space::Send {Space} Space::Send {Space}
Comment out the first of those two lines as follows:
; If spacebar didn't modify anything, send a real space keystroke upon release. ;+Space::Send {Space} Space::Send {Space}
That passes SHIFT-SPACE through properly.
#111
-
Posted 29 September 2009 - 04:58 PM
I want to start by saying I like what you guys have been doing so far. Like one of the posters on one of the first few pages, I also am a user of AutoCAD, and so I also frequently have to use the Capslock button for lots of capital letters. Since the script as presented doesn't actually work very well for users who make use of Capslock, I decided to rewrite the script.
Since this is my first real foray into AutoHotkey scripting, I decided to rewrite most of it so that I understand what's going on. I have removed parts of the script that I felt unnecessary (such as the part that disabled the normal right-click menu on the script and the german and french keyboard options). If you want or need them, feel free to copy those parts over from the current version (Edit 3, I believe) of the script.
So without further ado, I present my code:
A few ways in which it differs from edit 3:
- Caps Lock works as normal. It toggles the capitalization of letters that are typed, but does not interfere with other symbols.
- Like edit 3, it does shift characters when they are held down for a while (200ms is the default in this script; it is easily changed on line 3). However, it does not send the regular character, then a backspace, and then the shifted character as edit 3 does. It instead sends only the desired character. I find this advantageous, because backspace characters can screw some things up (like going to a previous page in old Internet Explorers and causing breaks in undo history).
- When you press and hold a character to capitalize it, you need to let go after it capitalizes, but before the key starts repeating. I am unable to find a reasonable solution to this problem. If anyone has knowledge of key auto-repeating, this script could use your expertise.
- It does not support keyboards other than standard US keyboards. This should be extensible by doing something similar to what is done in edit 3.[/code]
Since this is my first real foray into AutoHotkey scripting, I decided to rewrite most of it so that I understand what's going on. I have removed parts of the script that I felt unnecessary (such as the part that disabled the normal right-click menu on the script and the german and french keyboard options). If you want or need them, feel free to copy those parts over from the current version (Edit 3, I believe) of the script.
So without further ado, I present my code:
#SingleInstance ShiftDelay = 200 ShiftDelay *= -1 StringCaseSense, on leftside := "``" . "12345qwertasdfgzxcvb" rightside := "'" . "09876poiuy;lkjh/.,mn" other := "-=[]\" shiftleftside := "~" . "!@#$%QWERTASDFGZXCVB" shiftrightside := """" . ")(*&^POIUY:LKJH?><MN" shiftother := "_+{}|" Loop % StrLen(leftside) { l := SubStr(leftside, A_Index, 1) r := SubStr(rightside, A_Index, 1) Hotkey Space & %l%, DoHotKey Hotkey Space & %r%, DoHotKey Hotkey Space & %l% UP, KeyUp Hotkey Space & %r% UP, KeyUp Hotkey %l%, NormalKeyDown Hotkey %r%, NormalKeyDown Hotkey %l% UP, KeyUp Hotkey %r% UP, KeyUp } Loop % Strlen(other) { o := SubStr(other, A_Index, 1) Hotkey %o%, normalKeyDown Hotkey %o% UP, KeyUp } return Control & Space::Suspend Space & CapsLock::Send {Enter} Space & Tab:: Send {Backspace} +Space::Send {Space} Space::Send {Space} DoHotKey: StringRight ThisKey, A_ThisHotkey, 1 MirrorKey := mirror(ThisKey) Modifiers := "" If (GetKeyState("LWin") || GetKeyState("RWin")) Modifiers .= "#" If (GetKeyState("Control")) Modifiers .= "^" If (GetKeyState("Alt")) Modifiers .= "!" If (GetKeyState("Shift")) MirrorKey := shift(MirrorKey) If (Modifiers <> "") send %Modifiers%{%MirrorKey%} Else { gosub, MaybePrintKey akey := Mirrorkey ;akey is a global variable used to pass around the key that we care about gosub, KeyDown } return NormalKeyDown: gosub, MaybePrintKey akey := SubStr(A_ThisHotKey, 0, 1) gosub, KeyDown return MaybePrintKey: if(keysuccess <> True) { gosub, PrintKey SetTimer, PrintShiftKey, off } return KeyDown: keysuccess := False SetTimer, PrintShiftKey, %ShiftDelay% return KeyUp: SetTimer, PrintShiftKey, off gosub, PrintKey return PrintKey: if(keysuccess <> True) { If (GetKeyState("CapsLock", "T")) akey := togglecase(akey) keysuccess := True send {%akey%} } return PrintShiftKey: if(keysuccess <> True) { If (GetKeyState("CapsLock", "T")) akey := togglecase(akey) shiftkey := shift(akey) send {%shiftkey%} send {%akey% up} keysuccess := True } return togglecase(char) { StringUpper, u, char StringLower, l, char If (u == char) char := l Else char := u return char } mirror(char) { global leftside global rightside l := InStr(leftside, char) r := InStr(rightside, char) If (l > 0) m := SubStr(rightside, l, 1) Else If (r > 0) m := SubStr(leftside, r, 1) Else m := char return m } shift(char) { global leftside global rightside global other global shiftleftside global shiftrightside global shiftother normal := leftside . rightside . other shifted := shiftleftside . shiftrightside . shiftother n := InStr(normal, char, True) s := InStr(shifted, char, True) If(n > 0) newchar := SubStr(shifted, n, 1) Else If(s > 0) newchar := SubStr(normal, s, 1) Else newchar := char return %newchar% }
A few ways in which it differs from edit 3:
- Caps Lock works as normal. It toggles the capitalization of letters that are typed, but does not interfere with other symbols.
- Like edit 3, it does shift characters when they are held down for a while (200ms is the default in this script; it is easily changed on line 3). However, it does not send the regular character, then a backspace, and then the shifted character as edit 3 does. It instead sends only the desired character. I find this advantageous, because backspace characters can screw some things up (like going to a previous page in old Internet Explorers and causing breaks in undo history).
- When you press and hold a character to capitalize it, you need to let go after it capitalizes, but before the key starts repeating. I am unable to find a reasonable solution to this problem. If anyone has knowledge of key auto-repeating, this script could use your expertise.
- It does not support keyboards other than standard US keyboards. This should be extensible by doing something similar to what is done in edit 3.[/code]
#112
-
Posted 04 November 2009 - 09:13 PM
You could implement half-keyboard typing in PKL, as an 'extend' mapping.
That way, it'd be by virtual scan code (i.e., keyboard and layout invariant), and would easily allow toggling of Caps state (personally I use CapsLock plus Esc to toggle but anything goes) while being practical in use as a keyboard mirroring implementation without annoying and error-prone delay tricks. And it'd be editable without recompiling since it'd reside in the pkl.ini file.
I'm going to do it myself, once I get the time (and get multiple 'extend' states in PKL like I've wished for). Not soon though, so if anyone's interested they should do it themselves.
That way, it'd be by virtual scan code (i.e., keyboard and layout invariant), and would easily allow toggling of Caps state (personally I use CapsLock plus Esc to toggle but anything goes) while being practical in use as a keyboard mirroring implementation without annoying and error-prone delay tricks. And it'd be editable without recompiling since it'd reside in the pkl.ini file.
I'm going to do it myself, once I get the time (and get multiple 'extend' states in PKL like I've wished for). Not soon though, so if anyone's interested they should do it themselves.
#113
-
Posted 05 November 2009 - 07:49 AM
Better burden you cannot carry than man-wisdom much -- Hávamál
Hi. Let me present my current version of the script:
It differs from edit 3:
1. It supports keyboards other than US standart. I need this because I often type in Russian.
2. The line of symmetry is between H and J. I do not understand how do you type []{} with line of symmetry between G and H.
3. It does not shift characters when they are held down for a while.
Sorry for my English
; LKey 1 2 3 4 5 6 q w e r t y a s d f g h z x c v b LScan := "02 03 04 05 06 07 10 11 12 13 14 15 1E 1F 20 21 22 23 2C 2D 2E 2F 30" ; RKey = - 0 9 8 7 ] [ p o i u \ ' ; l k j / . , m n RScan := "0D 0C 0B 0A 09 08 1B 1A 19 18 17 16 2B 28 27 26 25 24 35 34 33 32 31" ; Define HotKeys Scans = %LScan% %RScan% Loop, Parse, Scans, " " Hotkey Space & sc0%A_LoopField%, DoHotKey return Space::Send {Space} ; If spacebar didn't modify anything, +Space::Send {Space} ; send a space keystroke upon release ; Not exactly mirror but as close as we can get Space & Tab::Send {Backspace} ; Tab BackSpace Space & CapsLock::Send {Enter} ; Capslock Еnter ; General purpose DoHotKey: StringRight ThisKey, A_ThisHotkey, 2 i1 := InStr(LScan, ThisKey) i2 := InStr(RScan, ThisKey) If (i1 > 0) MirrorKey := SubStr(RScan, i1, 2) Else MirrorKey := SubStr(LScan, i2, 2) Modifiers := "" If (GetKeyState("LWin") || GetKeyState("RWin")) Modifiers .= "#" If (GetKeyState("Control")) Modifiers .= "^" If (GetKeyState("Alt")) Modifiers .= "!" If (GetKeyState("Shift") + GetKeyState("CapsLock", "T") = 1) Modifiers .= "+" ; only add if Shift is held OR CapsLock is on (XOR) ; (both held down would result in value of 2) Send %Modifiers%{sc0%MirrorKey%} return
It differs from edit 3:
1. It supports keyboards other than US standart. I need this because I often type in Russian.
2. The line of symmetry is between H and J. I do not understand how do you type []{} with line of symmetry between G and H.
3. It does not shift characters when they are held down for a while.
Sorry for my English
#114
-
Posted 17 December 2009 - 11:28 AM
Now that's what I was talking about!
I tried the PKL 'extend' remapping method but wasn't quite satisfied as in the current state of the program it'll remap your mirrored key to the system's installed layout unless you remap by character (so it's layout dependent again). Will work around that eventually.
Seederoff: I think I prefer the symmetry line between (QWERTY) G and H still. It's very important that you can keep your fingers in their normal two-handed positions so that the one hand does exactly what the other would've done most of the time.
However, I made myself two versions: The right-handed version is simple mirroring since it already reaches the [] '\ -= keys (I used the Enter key to mirror although I'd prefer a foot pedal; Enter+Space became the new Enter press). The left-handed version has the [] '\ -= keys moved towards the middle of the board to the (QWERTY) YU HJ NM keys. I think that worked well, although the apostrophe in particular may be so common that it deserves even better and might go on a remapped Tab press.
I tried the PKL 'extend' remapping method but wasn't quite satisfied as in the current state of the program it'll remap your mirrored key to the system's installed layout unless you remap by character (so it's layout dependent again). Will work around that eventually.
Seederoff: I think I prefer the symmetry line between (QWERTY) G and H still. It's very important that you can keep your fingers in their normal two-handed positions so that the one hand does exactly what the other would've done most of the time.
However, I made myself two versions: The right-handed version is simple mirroring since it already reaches the [] '\ -= keys (I used the Enter key to mirror although I'd prefer a foot pedal; Enter+Space became the new Enter press). The left-handed version has the [] '\ -= keys moved towards the middle of the board to the (QWERTY) YU HJ NM keys. I think that worked well, although the apostrophe in particular may be so common that it deserves even better and might go on a remapped Tab press.
#115
-
Posted 28 December 2009 - 10:32 AM
Better burden you cannot carry than man-wisdom much -- Hávamál
Or any other case where you want and have to keep one hand busy elsewhere, but still want to be able to type in any commands with the other hand.Looks great. Might be especially useful for players of flight sims who want to type messages without crashing the plane
Imagine following example: While using a normal pc mouse, we use it to move the cursor on the 2D screen and use one of the available buttons on it to trigger some kind of action. But why limiting to only those 3 or a few more buttons on the pc mouse if we have in front of us also the whole pc keyboard?
Thus right hand onto a mouse pen, like a wacom graphics tablet pen, for moving the cursor, and the left hand on the qwerty, for entering commands might be a nice idea. Actually even single press key entries on the qwerty keys would give us already many more possibilities than using a pc mouse alone. You would only need to fill them with interesting functionality using AHK.
#116
-
Posted 29 December 2009 - 04:05 PM
Hey I was wondering if it's possible to modify this script so that when you hold down the key instead of capitalizing the letter it gives you the mirrored letter. I've been trying to modify it but I can't seem to do it. Thanks for the help. It is a great script btw though.
#117
-
Posted 12 January 2010 - 08:23 PM
Hey I was wondering if it's possible to modify this script so that when you hold down the key instead of capitalizing the letter it gives you the mirrored letter. I've been trying to modify it but I can't seem to do it. Thanks for the help. It is a great script btw though.
Replace these in "edit3" from here
<!-- m -->http://www.autohotke...783.html#228783<!-- m -->
ReplaceWithUpper: SetKeyDelay, -1 _key:=Substr(mirrored, InStr(original, LastKey), 1) Send {Backspace}%_key% _key= Return ReplaceWithUpperMirror: SetKeyDelay, -1 _key:=Substr(original, InStr(mirrored, MirrorKey), 1) Send {Backspace}%_key% _key= ReturnUntested but I think it should work
Edit: update removed the + so it doesn't send UPPERCASE anymore
#118
-
Posted 12 January 2010 - 08:55 PM
Thanks for the quick response! It works but it produces the capitalized mirrored letter. I want the lowercase. I'm trying this method b/c I find using a space as a modifier is a bit cumbersome and slow, but maybe I just haven't gotten enough practice w/ it.
#119
-
Posted 12 January 2010 - 10:48 PM
I removed the + (shift) in the send above so either copy or remove the + in your code
#120
-
Posted 13 January 2010 - 08:01 AM