What's new

Any news on customizable pen buttons?

vxm

Active Member
Anyone has info/rumors to share when to expect any official resolution to that nuisance?

It's silly that 2 buttons are only useful in OneNote, third being made exclusively for it. I'm ok with this functionality, but let's be honest- OneNote is not my tool of trade or the most frequently used app. It's sad I can't configure those buttons for other software- sometimes one button works as eraser, but more often than not it only makes something silly happen and that's about it. For me it's the biggest issue with SP3, I accept heat, fan getting noisy, aggressive throttling or that palm rejection isn't perfect, but pen that has 2/3rd of it's buttons completely useless? Meh.

I know that there are solutions like radial menu to that, but honestly, I think you shouldn't depend on 3rd party solutions with device like this (pen itself isn't cheap, even comparing to Wacom styli + device itself is considered premium).

I searched, but other than MS buying N-Trig I haven't found anything related- buying n-trig might mean that developement of new features will get faster or it might actually slow it due to changes in company.
 

agt499

Member
I have read that people have successfully remapped some of the buttons on the pen using AutoHotKey. I have not messed with it though, might want to look into that.

Here is a result I found real quickly. http://www.lovemysurface.net/surface-pro-3-purple-button/

Yes, Autohotkey is a very reliable way to do this for the top/purple button.
I have mine mapped to the commands Send {Browser_Forward} and Send {Browser_Back}, which will run a powerpoint presentation forward with single-click and back with a double. It also works in a browser, which I've used for a (carefully pre-planned) client demo.
AHK is also powerful enough to make the button do different things in different programs.
(I'm a lefty with appalling handwriting and sketching, so this turns out to be a better use of my pen)
 
OP
vxm

vxm

Active Member
I know radial menu, I've been using it both on TPY and SP3. It doesn't change the fact that this is third party solution.
 

herrkjeldsen

New Member
I'd love to hear some new on this also :) I've also used radial menu to replace the side buttons, but while it is a fantastic effort, I have frequent release lags after a side button click. And as vxm points out, it is silly that it should be a third party solution.
 

Randy31416

New Member
See the link http://ahkscript.org/boards/viewtopic.php?f=6&t=7589 for an AutoHotkey script that allows the state of the two barrel buttons to be detected when the pen is tapped against the Surface. This allows the barrel buttons be programmed to suit, within limits. (Windows still, somewhere, traps a long press with the bottom button pressed and turns it into a right click.) Likely, though, only experienced AutoHotkey programmers should work with this script.
 

herrkjeldsen

New Member
Hi Randy! Thanks for the link :) Very tidy and helpful script sample!
I think you are right about the experienced programmers bit though. After having spent a few hours on trying to set it up correctly, I'm still unable to make it release the middle mouse button properly.

I got as far as this, but of course, I am a complete autohotkey newbie:
Code:
    #SingleInstance Force
    #UseHook
    SurfacePenBegin()
    Return


; trap pen taps with the bottom button pressed
  #If SurfacePenState = "tap down with bottom side button pressed (seen in AutoHotkey as LButton event)"
    ^!+LButton::
    ^!LButton::
    ^+LButton::
    !+LButton::
    ^LButton::
    !LButton::
    +LButton::
    LButton::
      SendLevel, 5
      Click, Middle
      SendLevel, 0
      Return
    #If
  #If (SurfacePenState = "tap up with bottom side button pressed (seen in AutoHotkey as LButton up event)")
    ^!+LButton::
    ^!LButton::
    ^+LButton::
    !+LButton::
    ^LButton::
    !LButton::
    +LButton::
    LButton::
      SendLevel, 5
      Click, Up Middle
      SendLevel, 0
      Return
    #If

; initialize to trap input messages
  SurfacePenBegin( )
  {
    Global SurfacePenState
    SurfacePenState := ""
    AHKHID_Register(1, 2, A_ScriptHwnd, RIDEV_INPUTSINK := 0x00000100)
    OnMessage(WM_INPUT := 0xFF, "SurfacePenEvent")
  }

; trap wm_input messages and analyze them
  SurfacePenEvent( wParam, lParam, msg, hwnd )
  {
    Global SurfacePenState
    Critical
    AnyType := AHKHID_GetInputInfo(lParam, II_DEVTYPE := 0)
    AnyFlag := AHKHID_GetInputInfo(lParam, II_MSE_FLAGS := (08 + A_PtrSize * 2) | 0x0100)
    AnyButt := AHKHID_GetInputInfo(lParam, II_MSE_BUTTONFLAGS := ((12 + A_PtrSize * 2) | 0x0100))
    AnyData := AHKHID_GetInputInfo(lParam, II_MSE_EXTRAINFO := 28 + A_PtrSize * 2)
    SurfacePenState := ""
    If (AnyType = 0 And AnyFlag <> 0 And AnyButt <> 0)
    {
      If (AnyButt = 1 And (AnyData & 3) = 3)
        SurfacePenState := "tap down with bottom side button pressed (seen in AutoHotkey as LButton event)"
      If (AnyButt = 2 And (AnyData & 3) = 3)
        SurfacePenState := "tap up with bottom side button pressed (seen in AutoHotkey as LButton up event)"
      OutputDebug, SurfacePenEvent [%SurfacePenState%]
    }
  }


#Include AHKHID.ahk

All I really need is a functioning middle mouse button on my pen, so I wish Microsoft would just implement this as part of the surface settings app.
 

Randy31416

New Member
In my use of the script sample, all of the hotkey definitions are placed early in the script (above any middle-button hotkeys) and all of hte middle-button actions I am actually doing also are triggered by hotkeys within this script. I don't know if in general this will drive other programs that use middle-button presses (I can't think of a program I have that natively uses the middle button so I can't check this out here).

I too crave native Microsoft support, and eagerly download firmware fixes that talk about the pen, but no support shows up . . . .
 

derpmcturd

New Member
Yes, Autohotkey is a very reliable way to do this for the top/purple button.
I have mine mapped to the commands Send {Browser_Forward} and Send {Browser_Back}, which will run a powerpoint presentation forward with single-click and back with a double. It also works in a browser, which I've used for a (carefully pre-planned) client demo.
AHK is also powerful enough to make the button do different things in different programs.
(I'm a lefty with appalling handwriting and sketching, so this turns out to be a better use of my pen)
OMG I want to do EXACTLY that but i have no idea how to use AHK. I've downloaded it and all the technical mumbojumbo scrambles my brain. Can you tell me how you did it? Changing the Pen's lower button to "Go Back" and the top to "Go Forward" would be absolutely PERFECT! Please help. Thank You
 
Top