Remapping the eraser on a Wacom tablet pen

Discussion in 'Software' started by lblb, Jan 5, 2013.

Thread Status:
Not open for further replies.
  1. lblb

    lblb Scribbler - Standard Member Senior Member

    Likes Received:
    Trophy Points:
    Hi all,

    There doesn't seem to be a direct way through the Wacom ISD or through the Tablet Settings to remap the eraser on a Wacom pen but I found a straightforward way to do it. I haven't found any info concerning this anywhere else and thought I'd share what I found so that maybe it could be useful to tablet users who don't use the eraser (are there any tablet users like that???)

    Through this method, I have been able to remap the eraser to almost any keyboard shortcut (but not to mouse clicks). Note that I only tried on my EP121 running Windows 7 64 bits with driver 7.0.2-21 but I think it should work on any tablet with a Wacom pen/driver.

    When a correct Wacom driver is installed on a tablet, in the Windows Control Panel there should be something like a “Pen Tablet Properties” icon that opens the ISD program. All the parameters that are set through the ISD are saved in the following file (or something similar):


    This file can be opened in a text editor. At the top of the file, there is all kinds of info that is of no interest here. At the bottom of the file is where all the settings are saved for the different pen buttons. For example, you can search the file for the following “TransducerEraserSetting”. In the case of my EP121, it leads to the following section that defines the function of the eraser:

    <TransducerEraserSettings type="map">
    [INDENT]<ButtonFunction type="integer">14</ButtonFunction>
    <ButtonName type="string">eraser</ButtonName>
    <LowerPressureThreshold type="integer">18</LowerPressureThreshold>
    <PressureCurve type="integer">4</PressureCurve>
    <PressureCurveControlPoint type="string">20 0 127 127 254 254</PressureCurveControlPoint>
    <PressureResolution type="integer">254</PressureResolution>
    <PressureSafteyMargin type="integer">2</PressureSafteyMargin>
    <UpperPressureThreshold type="integer">20</UpperPressureThreshold>[/INDENT]
    You can manually modify this part to change the function of the eraser. Note that in that section of the file you&#8217;ll also find the settings for the other pen buttons under TransducerTipButtonSettings, TransducerLowerButtonSettings, TransducerUpperButtonSettings.

    Here are the steps to follow to remap the eraser to a keyboard shortcut:

    1) While it is easy to go back to the default setting for the eraser (see below), you may want to make a backup copy of the file above before you start modifying it.
    2) Change the text between the first and last lines in the eraser setting to this:

    <TransducerEraserSettings type="map">
    [INDENT]<ButtonFunction type="integer">8</ButtonFunction>
    <ButtonName type="string">eraser</ButtonName>
    <Keystroke type="kestring"><![CDATA[p]]></Keystroke>[/INDENT]
    - The first and last lines define the section for the eraser settings.
    - The second line says through the number 8 that the function will now be a keyboard shortcut. (By comparison, the eraser function is 14, left click is 1, right click is 3, etc.)
    - The third line is the name of the button (leave it to eraser)
    - The fourth line is the keypress that is sent when you click with the eraser. In this case, this will send the letter p.
    - Other examples:
    1) The following will send &#8220;Undo&#8221; through Ctrl+z
    <Keystroke type="kestring"><![CDATA[&control;z]]></Keystroke>
    2) The following will send Ctrl+Shift
    <Keystroke type="kestring"><![CDATA[&control;&shift;]]></Keystroke>
    3) The following will send Ctrl+Shift+v
    <Keystroke type="kestring"><![CDATA[&control;&shift;v]]></Keystroke>
    4) The following will send &#8220;Select all&#8221; then &#8220;Copy&#8221; through Ctrl+A then Ctrl+C:
    <Keystroke type="kestring"><![CDATA[&control;a&control;c]]></Keystroke>​
    3) Save the file.
    4) You now need to restart the Tablet ISD Windows Service. To do this:
    - Open the Windows Task Manager.
    - At the bottom right of the &#8220;Services&#8221; tab, click &#8220;Services...&#8221;
    - Scroll down in the list of services that will appear and find TabletServiceISD.
    - Select this service, and click &#8220;Restart the service&#8221; on the left tab.​
    5) Once the service is restarted, the eraser should be remapped to whatever shortcut you assigned.

    Note 1: I&#8217;ve used for a few weeks without any problem. However, note that the text in the eraser remap section will be modified whenever you launch the ISD or restart the tablet. In my case, this doesn&#8217;t affect the remap.

    To restore the default setting for the eraser:

    - Note that if you just click on &#8220;Default&#8221; in the ISD, the eraser remap section will be modified but this probably won&#8217;t affect the remap.
    - To get back to the default eraser settings either use the backup copy of the file you created in the first step or:
    1) Erase the text between the first and last line of the eraser section so that you&#8217;re left with something like:

    <TransducerEraserSettings type="map">
    2) Restart the ISD service by following the instructions in 4 above.
    3) Once the service has been restarted, launch the ISD and click &#8220;Default&#8221;.
    Last edited: Jan 5, 2013
  2. hunter99

    hunter99 To Old Now

    Likes Received:
    Trophy Points:
    Hi lblb,
    Happy New Year. I see you and Steve are real busy with your AR and SAI scripts.
    Remapping the eraser is a real pig, been fooling around with the pen buttons and eraser since Nov.
    trying to use a script. Came up with one for the buttons, but very eradic with the eraser.
    Will look at it again. Script use autohotkey and the tf library. Here is one I just updated the comments on.
    I use it to zoom in & out in PSCS6. Suggestions aways welcome.

    All the best, George

    ;PenButtonZoom_In-OutPhotoshop.ahk Updated comments Jan.7, 2013
    ;Script to change Wacom pen buttons for PC Tablets by hunter99 Nov 2012.Tested on EP121 & S7S.
    ;Uses AutoHotkey_L (looks like in latest version they don't use the _L in properties)
    ;Also uses TF: Textfile & String Library for AutoHotkey - maintained by HugoV
    ;Used Photoshop CS6 zoom in and zoom out for testing
    ;Download AutoHotkey_L  (Last update: December 24, 2012 - v1.1.09.02 )  Link is here  - 
    ;Installer puts it here (default location)     C:\Program Files\AutoHotkey\AutoHotkey.exe
    ;Main site for TF.ahk is here-
    ;The tf library is here- page is the file, save the page and name it TF.ahk
    ;Make Lib folder and put in TF.ahk library so path is like this     C:\Program Files\AutoHotkey\Lib\TF.ahk
    ;Make Scripts folder here-C:\Program Files\AutoHotkey\Scripts-put all scripts in there.
    ;Link for Notepad-plus-plus for easy work with scripts-   
    #Persistent       ;keep script running until ExitApp
    ;APPDATA is a environment variable, to see list type "set" a command prompt
    f := "!" APPDATA "\WTablet\ISD_Tablet.dat"
    ;f := APPDATA "\WTablet\ISD_Tablet.dat"  ;comment the above & uncomment this to write to ISD_Tabletcopy.dat
    ;The "8"in 3rd line below means its a keycode
    ;Next line "Zoom In" is the description as would appear in Wacom panel.Could type anything.
    ;Next line "barrel" is Wacoms name for lower button, "barrel2" is the upper.
    ;Next line "&control;&kp+;" is the keycode, this you would change as needed.
          `n`t`t<ButtonFunction type="integer">8</ButtonFunction>
                <ButtonKeystrokeShortcutName type="string">Zoom In</ButtonKeystrokeShortcutName>
                <ButtonName type="string">barrel</ButtonName>
                <Keystroke type="kestring"><![CDATA[&control;&kp+;]]></Keystroke>`n`t`t
    TF_RangeReplace(f, "<TransducerLowerButtonSettings type=""map"">", "</TransducerLowerButtonSettings>", PSLower, "False", 1, 1)
    Sleep 200  ;ensures dat file is rewritten before next rangereplace
          `n`t`t<ButtonFunction type="integer">8</ButtonFunction>
                <ButtonKeystrokeShortcutName type="string">Zoom Out</ButtonKeystrokeShortcutName>
                <ButtonName type="string">barrel2</ButtonName>
                <Keystroke type="kestring"><![CDATA[&control;&kp-;]]></Keystroke>`n`t`t
    TF_RangeReplace(f, "<TransducerUpperButtonSettings type=""map"">", "</TransducerUpperButtonSettings>", PSUpper, "False", 1, 1)
    Sleep 200   ;ensures dat file is rewritten before ISD service restarts
    ;If a app like PS which uses pen pressure is running before this script is run you will
    ;lose pressure until you restart the program. The buttons will still work correctly.
    ;RunWait ensures the ISD change is done, hide hides the ugly black command box.
    RunWait, %comspec% /c "Net stop TabletServiceISD && Net start TabletServiceISD",,hide
    ;Run, C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Photoshop.exe  ;put your program here.
  3. lblb

    lblb Scribbler - Standard Member Senior Member

    Likes Received:
    Trophy Points:
    A very Happy New Year to you too hunter99!

    I'm glad to see this stuff about editing the ISD_Tablet.dat file can be useful to others! That EP121 thread and the related one here really came about as Steve and I had ideas/questions about remapping the pen buttons on the fly. As your very nice example above shows, the two side buttons can indeed be remapped quite easily. It is true that the eraser is "a real pig" but as I mention in the first post above, even if some garbage gets rewritten automatically, as long as the "integer" stays at 8, it doesn't seem to affect the remap. At least for me I was able to use my remapped eraser with no problems for a few weeks.

    When I was looking at this back in November, I came up with a small Gui to test a few ideas (see attached; just put the image in the same folder as the script). Amazingly enough, it is very very similar to what you posted. It uses the tf.ahk library (I guess the fact that we both need to use this very useful library means that we both still have a lot to learn about native AHK text manipulation commands!)

    I didn't know about the APPDATA shortcut so thanks a lot for that!

    Developing that Gui, I had in mind that I needed to include a few safeties if I were to include such remappings in our toolbars. To that effect, my attempt differs from yours in the following (just launch the Gui and open the .dat file to see):

    - Before doing anything, you can use the first button on the Gui to make a copy of the original file. Doing so allows the inclusion of a first safety: if the file doesn't exist in its usual location, the user has the opportunity to go and select the file manually. (If you want to test this, just put your .dat file say on your desktop then launch my little tester app and press the first button.)
    - Once I've tested the three middle buttons (simple remaps of the top side button to CTRL+X, spacebar and F1), the last button resets the original parameters by retrieving the original copy.
    - Originally I used comspec like you do to restart the service. However, I was annoyed because the time it takes to restart the service varied quite a bit so I decided to look for a visual way to confirm that the service was restarted. That's how I ended up using the function in the file that can return the state (stopped, running, etc.) of the service. So I just added a splashimage "Waiting..." that disappears when the service is restarted (i.e. when the function returns Service_State("TabletServiceISD") = 4).

    That being said, your function seems to work great. Nice job! On the other hand, for our toolbars I've preferred just keeping the pen buttons to right- and middle-click and instead remapping the clicks with AHK, This way, it's easier to use things like "if the active window is Photoshop, remap to XX but if the active window is something else, keep it as normal clicks". For us, the main interest was that this strategy works well in all programs except for Paint Tool Sai, which has some bugs with pen button functions. It is our hope that we'll be able to go around these bugs by using the kind of remap that you showed.

    I'll be curious to see if you can successfully remap your eraser! Good luck!

    Attached Files:

  4. Juanra Young

    Juanra Young Pen Pal - Newbie

    Likes Received:
    Trophy Points:
    I've been looking at this and trying it a lot. Is there a way to make the eraser panscroll?
    Or is there a way to be able to assign the top barrel button?
    I'm on a Fujistu Lifebook T900.
    The default driver allow me to use the top barrel button on the stylus, but... they are so buggy and they crashed a lot, so I switched over to the ISD drivers.
    They are much stabler, but I can't use panscroll unless i over-write right-click. Which I do not want to do.
Thread Status:
Not open for further replies.

Share This Page