Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

NumPad typing


  • Please log in to reply
7 replies to this topic
Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
This keypad remapper is for users, who type with one hand of limited mobility. Only the numerical keypad of the standard US keyboards is used. It grew out of the discussion in another thread. This is a very short script considering its functionality.

- NumLock activates the cursor keys or the remapped keypad keys (standard).
- NumpadDiv Alt/Ctrl/Shift/Win sticky keys in cyclic order. More than a second delay starts a cycle entering a further modifier. It activates cmd mode, where commands, like Ctrl-Alt-C or Win-R are edited (shown in a TrayTip) and executed by NumpadEnter.
- NumpadMult Tab
- NumpadSub BackSpace. In command mode deletes char then last modifier
- NumpadAdd select CapsLock mode: Capital letters or Small letters
- Other NumPad keys send characters chosen cyclically from assigned lists, when they are pressed repeatedly within one second. A longer delay or different key terminates the character entry cycle and starts a new one. In cmd mode (activated by NumpadDiv) characters are not sent to the foreground window, but the command gets updated before execution (by NumpadEnter).

If you need more symbols, the lists of the character cycles can be extended, or the NumpadAdd key could have a third mode: Symbols, where a second set of character-cycles gets activated.
#SingleInstance force
Mods = ^!+#

Numpad1::KeyBD("()[]1")
Numpad2::KeyBD("ABC2@")
Numpad3::KeyBD("DEF3#")
Numpad4::KeyBD("GHI4$")
Numpad5::KeyBD("JKL5%")
Numpad6::KeyBD("MNO6^")
Numpad7::KeyBD("PQRS7&")
Numpad8::KeyBD("TUV8~")
Numpad9::KeyBD("WXYZ9'")
Numpad0::KeyBD("+-*/\0")
NumpadDot::KeyBD(",.:;!?")
NumpadDiv::          ; Cmd mode with Ctrl/Alt/Shift/Win sticky keys
   If (A_ThisHotKey = A_PriorHotKey and A_TimeSincePriorHotkey < 1000)
   {
      StringTrimRight Mod, Mod, 1
      ModI++         ; index of next modifier, wrapped around
      IfGreater ModI,4, SetEnv ModI,1
   }
   Else ModI = 1     ; first modifier from list
   StringMid m, Mods, ModI, 1
   Mod = %Mod%%m%
   c =               ; clear char
   ModTip(Mod,c)
Return
NumpadMult::         ; TAB (multi letter key name, no cycle)
   IfEqual Mod,, Send {Tab}
   Else {
      c = {TAB}
      ModTip(Mod,c)
   }
Return
NumpadSub::          ; BackSpace
   IfEqual Mod,, Send {BackSpace}
   Else {
      IfEqual c,, StringTrimRight Mod, Mod, 1
      Else c =
      ModTip(Mod,c)
   }
Return
NumpadAdd::          ; ~CapsLock
   Caps:=!Caps
   TrayTip,,Caps = %Caps%
Return
$NumpadEnter::       ; Enter /  Execute commnad
   IfEqual Mod,, Send {Enter}
   Else {
      Send %Mod%%c%
      Mod =          ; Exit cmd mode
      TrayTip
   }
Return

KeyBD(list)
{
   Static i          ; index of the character in the list, to be sent
   Global Caps, Mod, c
   If (A_ThisHotKey = A_PriorHotKey and A_TimeSincePriorHotkey < 1000)
   {
      IfEqual Mod,,Send {BS} ; erase the char this key has inserted
      i++            ; index of next char, wrapped around
      IfGreater i,% StrLen(list), SetEnv i,1
   }
   Else i = 1        ; at new key send first char from list
   StringMid c, list, i, 1
   IfEqual Mod,, {
      IfEqual Caps,1, StringUpper c,c
      Else            StringLower c,c
      SendRaw %c%    ; send selected
   }
   Else {
      StringLower c,c
      ModTip(Mod,c)
   }
}

ModTip(s,c)
{
   StringReplace s, s, ^, Ctrl-, All
   StringReplace s, s, !, Alt-,  All
   StringReplace s, s, +, Shift-,All
   StringReplace s, s, #, Win-,  All
   TrayTip,,Cmd = %s%%c%
}
See changes HotKeyIt proposed for better cell phone cmpatibility and easier use.

Edit 20050806: Added support for multiple modifiers, like Alt-Shift-Tab
Edit 20071023: Changed title
Edit 20090114: Added link to HotKeyIt's post

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Thanks for all the enhancements and for sharing it.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Edit 2005.08.06: Added support for multiple modifiers, like Alt-Shift-Tab

qleblat
  • Guests
  • Last active:
  • Joined: --
Love the script, dislike the name. Something along the lines of numpad typing would sound a bit more smooth. As of now it sounds like the keyboard is handicapped for starters, and a bit boring for us who have experienced a disability.

Anyway, I'm gonna try to work this using my bluetooth phone. Writing stuff with it's 'numpad' to people from across the room sounds awesome.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005

dislike the name.

changed

ManaUser
  • Members
  • 1121 posts
  • Last active: Dec 07 2016 04:24 PM
  • Joined: 24 May 2007
Oh, I see this is an old thread. But it's a nifty little script. I noticed one oddity though, you can enter more than one of the same modifier, like Ctrl+Ctrl+X, etc.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
It could be useful, don’t you think?

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Hi Laszo, thanks for the great script.

Is is possible to get hotstrings to work with your script?
That would be really great.