Remove this ad
avatar

ericn

superstar

Posts: 284

Lead

Apr 23 10 6:50 PM

Tags : :

Posted by EricN on March 31, 2010 at 9:00pm


When I first started using my Modbook, I found that my upper stylus button worked inconsistently when the eraser was activated. Sometimes it wouldn't work, and then, a moment later, it would. Since then, as a policy, I’d turn my eraser off unless I needed it, even making an AppleScript to toggle it on and off. This may have been a mistake as it prevented me from discovering that the upper pen button is intended to provide access to both its own function and the eraser.


In particular, if the upper stylus button (button 3) is pressed when the stylus is near the tablet, the button’s normal function is activated; on the other hand, if the button is pressed when the stylus is away from the tablet surface, and the stylus is then brought to the tablet, the eraser is activated. Thus, artists in a hurry can make use of the eraser more efficiently.




It gets more interesting however. The pen tablet driver can be AppleScripted allowing one to do many interesting things among them altering each button’s function, eraser button included. The following AppleScript reveals the typical button functions for my pen:




[Note that ‘transducer’ is just a fancy name for the pen.]


This script replaces the eraser button’s normal function with the pop-up menu:




Why is this so special? Because now using the eraser brings up the pop-up menu which will let me run AppleScripts to change the other two buttons to any functions I like. This is my pop-up menu:




As noted above, typically I set the lower and upper buttons set to the modifier keys control and command respectively. Using the eraser’s new pop-up menu, I can, as shown, choose from a variety of other options represented in the menu by [ 2 (lower) | 3 (upper) | 4 (eraser) ].


The AppleScripts for these assorted options follow:

Control | Command | PopUp


tell application "TabletDriver"

set button function of button 2 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 2 of transducer 1 of tablet 1 to 2

set button function of button 3 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 3 of transducer 1 of tablet 1 to 16

set button function of button 4 of transducer 1 of tablet 1 to screen macro

end tell



Control | PopUp | Erase

tell application "TabletDriver"

set button function of button 2 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 2 of transducer 1 of tablet 1 to 2

set button function of button 3 of transducer 1 of tablet 1 to screen macro

set button function of button 4 of transducer 1 of tablet 1 to auto erase

end tell


Control | Command

tell application "TabletDriver"

set button function of button 2 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 2 of transducer 1 of tablet 1 to 2

set button function of button 3 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 3 of transducer 1 of tablet 1 to 16

end tell


Control | Option

tell application "TabletDriver"

set button function of button 2 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 2 of transducer 1 of tablet 1 to 2

set button function of button 3 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 3 of transducer 1 of tablet 1 to 8

end tell


Shift | Command

tell application "TabletDriver"

set button function of button 2 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 2 of transducer 1 of tablet 1 to 4

set button function of button 3 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 3 of transducer 1 of tablet 1 to 16

end tell


Control | Pan

tell application "TabletDriver"

set button function of button 2 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 2 of transducer 1 of tablet 1 to 2

set button function of button 3 of transducer 1 of tablet 1 to pan

end tell


Control | Desktop

tell application "TabletDriver"

set button function of button 2 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 2 of transducer 1 of tablet 1 to 2

set button function of button 3 of transducer 1 of tablet 1 to show desktop

end tell


Control | Ink Toggle

tell application "TabletDriver"

set button function of button 2 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 2 of transducer 1 of tablet 1 to 2

set button function of button 3 of transducer 1 of tablet 1 to ink toggle

end tell


Control | Mode Toggle

tell application "TabletDriver"

set button function of button 2 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 2 of transducer 1 of tablet 1 to 2

set button function of button 3 of transducer 1 of tablet 1 to mode toggle

end tell


Control | Command | Eraser

tell application "TabletDriver"

set button function of button 2 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 2 of transducer 1 of tablet 1 to 2

set button function of button 3 of transducer 1 of tablet 1 to press modifiers

set button modifiers of button 3 of transducer 1 of tablet 1 to 16

set button function of button 4 of transducer 1 of tablet 1 to auto erase

end tell


Reset Eraser

tell application "TabletDriver"

set button function of button 4 of transducer 1 of tablet 1 to auto erase 

end tell


In order to use these scripts in the pen's pop-up menu, save them as applications (a Save As option in AppleScript Editor).


For more info on AppleScripting the Tablet Driver, check out the Wacom developer page.

Have Fun.

Quote    Reply   
Remove this ad
Remove this ad
avatar

ericn

superstar

Posts: 284

#1 [url]

Apr 23 10 7:00 PM

Original Comment by ajax xu on April 2, 2010 at 7:58am


Comment that's cool !

do u hv a list of function and its codename?

i would like to transfer my eraser key to mouse 3. what's the codename for mouse button 3?



Comment by EricN on April 2, 2010 at 10:51am

Delete Comment All I know about this is from the AppleScript download on the Wacom developer page, and a bit of guess and check. So I have no list.


I'm a bit puzzled by your second question. Do you really mean mouse button? If you meant pen button 3, then note from the blog post's second paragraph that, by default, the eraser is available from pen button 3, even if erase is not assigned to pen button 3. If you want to assign erase to pen button 3, that is easy



tell application "TabletDriver"

set button function of button 3 of transducer 1 of tablet 1 to erase

end tell



If, however, you want to assign "erase" to the middle button of a mouse that you have on the side, I have no idea how to do that or even if it can be done.

Quote    Reply   
Add Reply

Quick Reply

bbcode help