Tuesday, December 18, 2012

Tablet PC Input Panel and AutoHotkey

As someone who does a lot of drawing, I like to use pen input.  I've used Wacom tablets and, recently, a Samsung Slate Tablet PC.

Like a mouse, a pen input device usually takes up one hand with the other hand on the keyboard for triggering shortcut keys.  This works really well until you have to enter text.  As Allen Newell showed in The Psychology of Human Computer Interaction, moving your hand back and forth from the keyboard to mouse (or pen) can be really disruptive.

The interesting thing about a pen as an input device is that, unlike the mouse, it is very natural to enter text with a pen and Microsoft has very good handwriting recognition built into the Windows operating system starting with Windows XP.  There is a little panel, called the Tablet PC Input Panel (TIP) that can be configured to pop up, accept handwriting, and then output text as if you had typed it.

In general, I've found it to be very useful when I'm drawing some UI design and I want to input little bits of text (labels, buttons, menus, etc.) in the drawing.  One main drawback is that I could never get the TIP to show up exactly when and where I wanted it.

Luckily, with a little tinkering in AutoHotkey, I was able to get exactly what I want -- to have the TIP appear right below my cursor.  The TIP window is a bit odd and can't me moved with the normal AutoHotkey WinMove function so I wrote a script that uses the mouse to drag it into place.  I'm posting the script below to save the next guy the trouble.

----

; Triggered by Win+Z (windows key and Z)
#z::
IfWinNotExist, ahk_class IPTip_Main_Window
   Run, TabTip.exe
Else
   WinShow, ahk_class IPTip_Main_Window


WinGetPos, tipX, tipY, , , ahk_class IPTip_Main_Window
CoordMode, Mouse, Screen
MouseGetPos, mouseX, mouseY
MouseClickDrag, Left, tipX+200, tipY+20, mouseX+100, mouseY-50
MouseMove, mouseX, mouseY


Return


No comments:

Post a Comment