Hey, glad I could help! Autohotkey is pretty great, and it can do pretty much anything, but luckily button programming/key replacement is one of the easiest things to do.
There are basically 2 steps, first you need to change your tablet buttons to fire regular keyboard keys. I choose to use Function keys F1-F8 since I never really use them, especially while in Zbrush, and because they are numbered it's easy to remember which buttons do what. For me it goes Left=F1 Right=F2 Up=F3 Down=F4 Middle=F5 Esc Button=F6 Tools Button=F7 and Pen Button=F8. The directional buttons change by orientation, so for example the "Up Button" relative to a landscape orientation becomes the "Left Button" when you switch to primary portrait mode:
[attach=230460]TabletButtons.jpg[/attach]
Then, assuming you know how to get Autohotkey running, and how to edit the script, you just need a few lines of code:
;Zbrush
#IfWinActive ahk_class ZBrush
F1:small_orange_diamond:^z
F2:small_orange_diamond:Space
F3:small_orange_diamond:Control
F4:small_orange_diamond:Tab
F5:small_orange_diamond:Shift
F6:small_orange_diamond:^+z
F7:small_orange_diamond:^z
F8:small_orange_diamond:Alt
Basically the "IfWinActive" line recognizes whatever program is running in the foreground, and remaps those buttons only when it's in focus, the rest of the time they will fire the Function keys you set up originally. With this method you can make the buttons do different things for every program you use. For example, here are a few of mine:
;SketchBook Pro
#IfWinActive ahk_class com.alias.TpWin32SketchWindow
F1:small_orange_diamond:^z
F2:small_orange_diamond:^y
F3:small_orange_diamond:s
F4:small_orange_diamond:Space
F5:small_orange_diamond:Tab
F6:small_orange_diamond:x
F7:small_orange_diamond:y
F8:small_orange_diamond:s
;Firefox
#IfWinActive ahk_class MozillaUIWindowClass
F1:small_orange_diamond:Backspace
F2:small_orange_diamond:+Backspace
F3:small_orange_diamond:Send, {Up 5}
F4:small_orange_diamond:Send, {Down 5}
F5:small_orange_diamond:#a
F6:small_orange_diamond:F11
F7:small_orange_diamond:^+t
F8:small_orange_diamond:Click right
;Picasa viewer
#IfWinActive ahk_class ytWindow
F1:small_orange_diamond:Left
F2:small_orange_diamond:Right
F3:small_orange_diamond:Up
F4:small_orange_diamond:Down
F5:small_orange_diamond:Enter
F6:small_orange_diamond:Escape
F7:small_orange_diamond:
F8:small_orange_diamond:Alt
;Photoshop
#IfWinActive ahk_class Photoshop
F1:small_orange_diamond:^!z
F2:small_orange_diamond:^+z
F3:small_orange_diamond:^NumPadAdd
F4:small_orange_diamond:^NumPadSub
F5:small_orange_diamond:Space
F6:small_orange_diamond:Tab
F7:small_orange_diamond:Escape
F8:small_orange_diamond:Alt
To get the crucial ahk_class attribute, you need to open the autohotkey "window spy" tool by right-clicking the autohotkey icon in the system tray. It will figure out the class of any window in focus, then you just type that into your code for each program's key remapping.
[attach=230467]WindowSpy.jpg[/attach]
Then at the very bottom of your script file you should probably add this line:
#MaxHotkeysPerInterval 200
I think that solves an issue with too many commands being sent for windows to interpret when you hold buttons for long intervals. Anyway. I hope that's helpful. If you have any other questions, just fire away.
Attachments

