Friday, December 21, 2012

AutoHotkey Script for a Left Hand Menu

Recently, I've started posting AutoHotkey scripts.  AutoHotkey provides a pretty easy way to automate just about anything in Microsoft Windows without having to become a Windows programmer.  If you'd like to learn more, LifeHacker has a pretty nice introduction to AutoHotkey.

In my last couple of posts, I've been talking about tools and techniques to make it easier to keep your right hand on on your pen when you're drawing using a Wacom tablet, for example.  This script also works pretty well for keeping your right hand on a mouse.

Basically, when you run this script the Win+A key will bring up a window and while the window is open the ASDF keys can be mapped to execute ANY command.  Currently, I'm just popping up test messages, but as a next step I'll be adapting this basic framework to to cover my most common actions while working in Adobe Illustrator, for example.

---


; Left Hand Menu

#a::
Hotkey, a, Test, On
Hotkey, s, Test, On
Hotkey, d, Test, On
Hotkey, f, Test, On

Gui, Font, s10, Verdana  ; Set 10-point Verdana.
Gui, Add, Text, ym, (A) Test 
Gui, Add, Text, ym, (S) Test 
Gui, Add, Text, ym, (D) Test 
Gui, Add, Text, ym, (F) Test 
Gui, Show, w500 h100, Left Hand Menu
Return

GuiClose:
Hotkey, a, Off
Hotkey, s, Off
Hotkey, d, Off
Hotkey, f, Off
Gui Destroy
Return

Test:
MsgBox You pressed %A_ThisHotkey%.
return

Ergonomics of Working with a Graphics Tablet

David Revoy has one of the best articles I've seen about the Ergonomics of Graphics Tablets.  He has experimented with a variety of tablets and desk layouts and, best of all, created these very clear diagrams (such as the one below) to illustrate his article.



As Revoy shows and explains, "Most of CG artists use shortcuts on the keyboard to speed up their work-flow."  In this setup, the right hand is for drawing and the left hand is for shortcut keys (critical for switching between drawing tools, copy & paste, etc.).  The right hand moves back and forth for typing.

I'm writing this post as background for some UI research that I've started doing to improve the usability of software for artists and other pen-heavy users.  The first example is the script I wrote in AutoHotkey to set the location of the Tablet PC Input Panel.

Up next, I'll be looking at the Quill gesture design tool for pen-based user interfaces.  I think some interesting things could be done with simple gestures (like Graffiti unistrokes) in a vector drawing tool that haven't really been explored yet.  I'd like to explore rough drawing text, shapes, etc. and having the computer recognize it and convert it to a desired format in place.  Done right, I think it could lead to a more natural drawing experience while still maintaining the precision of vector drawing tools.

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