Jump to content

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

[BETA] Thumbscript AHK


  • Please log in to reply
8 replies to this topic
Conquer
  • Members
  • 385 posts
  • Last active: Jan 10 2013 02:14 AM
  • Joined: 27 Jun 2006
Hey, here's my BETA script on thumbscript.

Heres the design:
<!-- m -->http://thumbscript.com/howitworks.html<!-- m -->

The script allows you type only using the number pad, with only 2 number presses for every letter.

Posted Image

The script:
; Thumbscript By Conquer
; www.autohotkey.com

#SingleInstance,Force
SendMode,Input
SetKeyDelay,-1

gosub BuildList  ; Assign all the letters to variables for later

keys=0
Caps = false

CapsTip = True  ; Show traytip when toggling caps state
TipDelay = 1000 ; Milliseconds to show traytip for

Numpad1::NumCom(1)
Numpad2::NumCom(2)
Numpad3::NumCom(3)
Numpad4::NumCom(4)
Numpad5::NumCom(5)
Numpad6::NumCom(6)
Numpad7::NumCom(7)
Numpad8::NumCom(8)
Numpad9::NumCom(9)
NumPad0::Space
NumPadSub::Backspace

NumpadAdd::
disp := Caps("Toggle")
If CapsTip = True
{
  Traytip,Thumbscript,%Disp%,10,1
  SetTimer,TrayTipClear,%TipDelay%
}
return

TrayTipClear:
SetTimer,TrayTipClear,Off
TrayTip
return

Caps(state)  
; Caps(On/True)|Caps(Off/False)|Caps(Toggle)
{
  global
  if state = toggle
  {
    if caps = true
    {
      caps = false
      return "caps"
    }
    if caps = false
    {
      caps = true
      return "CAPS"
    }
  }
  if state = on
    state = true
  if state = off
    state = false
  Caps = %State%
  If Caps = True
    return "CAPS"
  Else If Caps = False
  return "caps"
}

NumCom(key)
{
  global
  ;Msgbox %Keys%/%Key%`n%Keeptrack%`n%Char%
  keys += 1
  IfLess,Keys,3
    keeptrack=%keeptrack%%key%
  If Keys > 1
    gosub SetKey
  return
}

SetKey:
;Tooltip Com: %Keeptrack%`n`nChar: %Char%
;sleep 1000
;ToolTip

Char := Char%KeepTrack%

If ( Char = "{Enter}" or Char = "." )
  CapsSet = 1   ; (For Mode 3) Time to use a new capital
WinGetActiveTitle,CurrentWin
If CurrentWin <> %OldWin%
{
  CapsSet = 1   ; (For Mode 3) New window is active, so use a capital
  OldWin := CurrentWin
}

If Caps = True
  StringUpper,Char, Char
If Caps = 3
{
  Char := Char%KeepTrack%
  If ( CapsSet = "True" or CapsSet = "3" )
    StringUpper, Char, Char
  If CapsSet = 1  ; Capital for beginning of sentence
    Capset = 0
}
;return

Send:
If Char =  ; Invalid combo, clean up the com
  goto Cleanup
Send %Char%
;goto Cleanup
;return
Cleanup:
NumPadDiv::
keeptrack=
keys=0
Char =
return

BuildList:
; Letters, all on the outer 9 pad target
; Vowels all cross the middle in an unbent line
Char13 = a
Char83 = b
Char93 = c
Char81 = d
Char91 = e
Char92 = f
Char96 = g
Char43 = h
Char82 = i
Char84 = j
Char89 = k
Char86 = l
Char12 = m
Char42 = n
Char46 = o
Char74 = p
Char76 = q
Char23 = r
Char63 = s
Char62 = t
Char73 = u
Char78 = v
Char79 = w
Char71 = x
Char72 = y
Char41 = z

; Commands: 
; Single Tap (Planned feature) or Double tap to use
Char1 = ,
Char11 = ,
Char3 = .
Char33 = .
Char4 = {Tab}
Char44 = {Tab}
Char9 = {BackSpace}
Char99 = {BackSpace}
Char6 = {Enter}
Char66 = {Enter}  ; Note that Numpad Enter also works.

; Numbers:
; Start by pressing 5 then press 
; the number you want to type
; Note that this is different then the normal Thumpad's method.
Char50 = 0
Char51 = 1
Char52 = 2
Char53 = 3
Char54 = 4
Char55 = 5
Char56 = 6
Char57 = 7
Char58 = 8
Char59 = 9
Char64 = 0 
; Backwards combo of O (letter) produces 0 if you hate using the 0 button

; Symbols:
Char39 = (
Char18 = ?
Char19 = /
Char29 = `{
Char69 = <
Char28 = |
Char48 = =
Char98 = '
Char68 = `+
Char21 = ~
Char24 = ]
Char47 = >
Char67 = {ESC}
Char32 = _
Char36 = :
Char26 = [
Char37 = \
Char87 = `
Char97 = "
Char17 = )
Char27 = `}
Char14 = `;
return

And the learning program I'm working on: (Not done yet)

#SingleInstance, Force
#Persistent
SendMode,Input
SetKeyDelay,-1
SetWinDelay,-1
SetControlDelay,-1
SetMouseDelay,-1
gosub VarInit

Gui,+AlwaysOnTop +ToolWindow
Gui,Add,Text,x7,Tutorial Mode:
Gui,Add,Text,vModeWp yp x+15, %Mode%
Gui,Add,Text,x7 y+15,Current Character:
Gui,Add,Picture,vPicWp x+5 h105 w83
Gui,Add,Edit,x7 w175 vInWp +Default
Gui,Show,,Thumbscript
If IsLabel(Mode)
  goto %Mode%
return

VarInit:
Gui2Width = 100
Gui2Height = 100
T_ScreenWidth := A_ScreenWidth - Gui2Width
T_ScreenHeight = 0
CurrentC = Red  ; Colour of the current letter in the gui.
Warmup = abcdefghijklmnopqrstuvwxyz
Ex1 = The quick brown fox jumps over the lazy brown dog.
Mode = StartWarmup
Nextletter = false
Char =
Loop,Parse,Warmup
  Hotkey,%A_LoopField%,NextLetter,Off UseErrorLevel
return

GuiClose:
ExitApp
return

StartWarmup:
StringReplace,Ex1,Ex1,%A_Space%,,A
PriorList =
Loop,Parse,warmup
{
  If A_Loopfield =
    continue
  Char := A_LoopField
  If Char
  {
    ;IfInString,Piror,%Char%
      Hotkey,%Char%,On
      /*
    IfNotInString,Prior,%Char%
    {
      Prior .= Char
      Hotkey,%Char%,NextLetter,On UseErrorLevel
    }
    */
    GuiControl,,PicWp,%A_LoopField%.jpg 
    gosub WaitForLetter
  }
}
Gui,Hide ; Hide the GUI, its AlwaysOnTop and will block the msgbox.
Msgbox Warmup Complete.
ExitApp
return

Random:
Char := RandomLetter()
If Char =
  goto Random ; Re-randomize
if Char = %OldChar%
  goto Random ; Re-randomize
GuiControl,,Curent,%Char%
gosub ShowLetter
Nextletter = false
If Char
{
  IfInString,Piror,%Char%
    Hotkey,%Char%,On,UseErrorLevel
  IfNotInString,Prior,%Char%
  {
    Prior .= Char
    Hotkey,%Char%,NextLetter,On UseErrorLevel
  }
}
If ErrorLevel
  goto Random ; Re-randomize
gosub WaitForLetter
;goto Random
return

WaitForLetter:
Loop  ; Wait for next key to be pressed
{
  If NextLetter = True
  {
    NextLetter = false
    break
  }
  sleep 10
}
return

NextLetter:
Send %Char%
OldChar := Char
If Char ; If there was a previous character
  Hotkey,%Char%,Off ; Remove prior hotkeys
NextLetter = true
;If islabel(Mode)
;  goto %Mode%
return

ShowLetter:
If Char =
  return
If Char = %OldChar%
  return
GuiControl,,PicWp,%Char%.jpg 
return

RandomLetter()
{
    global
    Random,Generated,1,26
    If Generated = 1
      return "a"
    If Generated = 2
      return "b"
    If Generated = 3
      return "c"
    If Generated = 4
      return "d"
    If Generated = 5
      return "e"
    If Generated = 6
      return "f"
    If Generated = 7
      return "g"
    If Generated = 8
      return "h"
    If Generated = 9
      return "i"
    If Generated = 10
      return "j"
    If Generated = 11
      return "k"
    If Generated = 12
      return "l"
    If Generated = 13
      return "m"
    If Generated = 14
      return "n"
    If Generated = 15
      return "o"
    If Generated = 16
      return "p"
    If Generated = 17
      return "q"
    If Generated = 18
      return "r"
    If Generated = 19
      return "s"
    If Generated = 20
      return "t"
    If Generated = 21
      return "u"
    If Generated = 22
      return "v"
    If Generated = 23
      return "w"
    If Generated = 24
      return "x"
    If Generated = 25
      return "y"
    If Generated = 26
      return "z"
    return
}

NumpadMult::Reload

Required Picture files for the Learner Script:
<!-- m -->http://rapidshare.co... ... s.zip.html<!-- m -->


Special thanks to HugoV for the startup post here
<!-- m -->http://www.autohotke...538.html#184538<!-- m -->

Maddog!
  • Guests
  • Last active:
  • Joined: --
Very cool!

Now in thumbscript:
very cool

BoBo¨
  • Guests
  • Last active:
  • Joined: --
Special thanks to me for the startup post [here] :wink::lol: 8)

BoBo¨
  • Guests
  • Last active:
  • Joined: --
A btw, thx for sharing it :D

Conquer
  • Members
  • 385 posts
  • Last active: Jan 10 2013 02:14 AM
  • Joined: 27 Jun 2006
Actually Bobo, I got the idea from here:
5th post down, by a guest (maybe you?)
<!-- m -->http://www.autohotke... ... halfqwerty<!-- m -->

:lol:
But your topic is appreciated too. :)

In thumbscript:
Im actually getting decent at it, too, :)

BoBo¨
  • Guests
  • Last active:
  • Joined: --
Holy moly, looks like the price goes to "Guuuuuuuuest" ! *fanfare* :D

Scrooge
  • Guests
  • Last active:
  • Joined: --
You forgot to support the numbers.

PS: Thumbscript forgot about the exclamation mark!!!!

Scrooge
  • Guests
  • Last active:
  • Joined: --
Nevermind, you just got the numbers backwards, fixed it on my version. Thanks.

randallf
  • Members
  • 711 posts
  • Last active: Jan 07 2014 11:45 PM
  • Joined: 06 Jul 2009
You should port this to windows mobile or w/e format so you can use it on cell phones without keypads.