 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
hugov
Joined: 27 May 2007 Posts: 2456
|
|
| Back to top |
|
 |
TchnclFl
Joined: 29 Jul 2009 Posts: 48
|
|
| Back to top |
|
 |
CovenStine
Joined: 24 Jul 2009 Posts: 5 Location: New England, USA
|
Posted: Wed Aug 05, 2009 12:28 pm Post subject: hmm, sounds interesting... |
|
|
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 |
|
| Back to top |
|
 |
Jurras Guest
|
Posted: Mon Sep 14, 2009 11:04 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
fro01
Joined: 29 Apr 2009 Posts: 45
|
Posted: Tue Sep 15, 2009 3:29 am Post subject: |
|
|
thank you, this is EXACTLY what im after for online games and such, excellent work _________________ frosty the snowman
Ex-AutoIt user
class: intermediate |
|
| Back to top |
|
 |
adrienneltravis Guest
|
Posted: Tue Sep 29, 2009 5:58 pm Post subject: Shift-space modifier |
|
|
CovenStine,
Using Edit 3A, find the following lines:
| Code: |
; 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:
| Code: |
; 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. |
|
| Back to top |
|
 |
SketchySolid Guest
|
Posted: Wed Nov 04, 2009 10:13 pm Post subject: Changes to the Half-Qwerty Script |
|
|
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:
| 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] |
|
| Back to top |
|
 |
DreymaR
Joined: 24 May 2009 Posts: 60 Location: Bćrum, Norway
|
Posted: Thu Nov 05, 2009 8:49 am Post subject: |
|
|
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. _________________ Better burden you cannot carry than man-wisdom much -- Hávamál |
|
| Back to top |
|
 |
seederoff
Joined: 17 Dec 2009 Posts: 1
|
Posted: Thu Dec 17, 2009 12:28 pm Post subject: Changes to the Half-Qwerty Script |
|
|
Hi. Let me present my current version of the script:
| Code: |
; 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 |
|
| Back to top |
|
 |
DreymaR
Joined: 24 May 2009 Posts: 60 Location: Bćrum, Norway
|
Posted: Mon Dec 28, 2009 11:32 am Post subject: |
|
|
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. _________________ Better burden you cannot carry than man-wisdom much -- Hávamál |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 489
|
Posted: Tue Dec 29, 2009 5:05 pm Post subject: |
|
|
| Chris wrote: | Looks great. Might be especially useful for players of flight sims who want to type messages without crashing the plane  | 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.
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. |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Jan 12, 2010 9:23 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
hugov
Joined: 27 May 2007 Posts: 2456
|
Posted: Tue Jan 12, 2010 9:55 pm Post subject: |
|
|
| Anonymous wrote: | | 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
http://www.autohotkey.com/forum/post-228783.html#228783
| Code: | 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=
Return | Untested but I think it should work
Edit: update removed the + so it doesn't send UPPERCASE anymore _________________ Tut 4 Newbies
TF : Text file & string lib, TF Forum
Last edited by hugov on Wed Jan 13, 2010 9:00 am; edited 1 time in total |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Jan 12, 2010 11:48 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
hugov
Joined: 27 May 2007 Posts: 2456
|
|
| 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
|