Surface Pro 3 Pen Button Customisation

Thursday , 11, September 2014 23 Comments

The Surface Pro 3 comes with a pen which can launch OneNote with a click of its purple button – it can even bring the device out of standby. This is awesome, because the series of events you take to write a note becomes the exact same as when picking up a pad of paper and a pen.

en-INTL-L-Surface-Pen-3UY-00001-mnco

 

Pick up pad, pick up pen, click pen to extend nib, start writing immediately.

Pick up Surface, pick up pen, click pen to launch OneNote, start writing immediately.

 

It’s very natural and phenomenally useful, but simultaneously it’s a bit limiting. What if I want to use the button click to do something else? Beyond double clicking to take a screenshot, there’s no way built into Windows to do anything other than launch OneNote.

Right now I want it to be able to advance PowerPoint slides with a pen button click, but I want it to function normally and launch OneNote at all other times. I don’t want  to have to do any config to achieve this each time I launch PowerPoint, I want it to be seamless.

Luckily this is Windows, and with Windows there’s always a way to achieve your desired results.

AutoHotKey (http://www.autohotkey.com/) is a powerful tool for scripting macros and hotkeys, and even better it’s totally free.

Using an AutoHotKey script which watches for PowerPoint being full screen, I can achieve my desired results in a totally seamless way. The Surface Pro 3 pen click is F20, so intercepting that when PowerPoint is full screen and simulating a spacebar press instead of launching OneNote advances the slide – hurrah!

If you want to try it yourself, install AutoHotKey and add the following lines to the default script.

 

#IfWinExist, ahk_class screenClass

#F20:: Send {Space}

 

Easy peasy – this’ll look great during presentations 🙂

23 thoughts on “ : Surface Pro 3 Pen Button Customisation”
  • Alexandre says:

    Awesome tip. Thank you.
    Do you know how to find the two other pen button function codes?

    • Kenny says:

      Hello! I’m afraid I don’t think the other buttons have similar function codes, the button on top is like a keyboard button and the other two are like mouse buttons.

  • Ofelia says:

    How do I add the 2 lines to the default script, please?

    Thjank you

  • AGT says:

    Excellent Kenny!
    I’ve added Double-Click of the pen button (F19) to go back, and some checks to make sure that the powerpoint window is active….

    ; Use Surface Pen Button as Powerpoint Control
    ; Kudos for first clues at http://superuser.com/questions/777199/is-it-possible-to-change-the-application-opened-by-the-surface-pro-3s-pen-butto
    ; and http://www.kennylowe.org/2014/09/11/surface-pro-3-pen-button-customisation/
    ; Only try if in presentation mode (screenClass)
    ; -so pen launches Onenote as normal at all other times
    #IfWinExist, ahk_class screenClass
    ; F20 is SINGLE click of pen button
    #F20::
    ; check that a powerpoint window is focussed
    if (WinActive(“ahk_class PPTFrameClass”)) or (WinActive(“ahk_class screenClass”))
    ; send Page Down to advance slide
    Send {PgDn}
    ; F19 is DOUBLE click of pen button
    #F19::
    ; check that a powerpoint window is focussed
    if (WinActive(“ahk_class PPTFrameClass”)) or (WinActive(“ahk_class screenClass”))
    ; send Page Down to advance slide
    Send {PgUp}
    return

    • Valerio says:

      Can you help me please? I hope that I can change slides with my surface pen

    • Milania says:

      Thank you very much for the script!

      It works, but I had to add an additional return statement after Send {PgDn} to get it working. Otherwise PgDn and PgUp commands were send together neutralising each another.

  • Sander says:

    Thank you all, I really enjoy it now I got it to work.
    I needed to replace #F20 by

    LWin & F20::
    KeyWait LWin
    KeyWait F20

    for it to work on my Surface Pro 3.

  • Valerio says:

    How i can do it? The software doesn’t create the folder.

    • AGT says:

      Hi Valerio.
      Below are some some instructions I created elsewhere which are hopefully straightforward!

      Depending on what you want to do, change the bold text -this sample launched desktop onenote and snipping tool.
      Post back here if you need more help!

      1. Download and install Autohotkey
      Installer from http://www.autohotkey.com/
      Choose “Express Installation”, and once it’s done Choose “Exit”
      2. Create your script
      In File Explorer, go to your Documents folder, Right-click and select “New AutoHotkey Script”.
      Right-click on this file to edit it in Notepad, then add these four lines to the bottom :

      #F20:: run, onenote.exe
      return
      #F19:: run, SnippingTool.exe
      return

      3. Save the file, then double-click it in Explorer to run.
      It should now launch desktop Onenote on single-click of the purple pen button, and Snipping Tool on double-click.
      4. If it’s working how you want, the only thing left is to add it to your startup:
      Right-click the file in Explorer, and select “Create Shortcut”
      Right-click the windows button on your taskbar and select “Run” (near the bottom), then type “shell:startup” and press OK -this should open your startup folder.
      Drag the shortcut you created above into your startup folder.

      • Valerio says:

        Hy if it is possible I would like to change powerpoint slides in the same way of the first post 😀

        • AGT says:

          Hi Valerio.
          If you follow my instructions above, but in step 2 use this for the bold text:

          #F20:: Send {PgDn}
          Return
          #F19:: Send {PgUp}
          Return

          This will send Page Down/Up, which should move your slides forward on Click of the pen button, and back on Double-Click

          • Valerio says:

            wooooww!!!! That’s great!! The last question, in this way it doesn’t open one note when powerpoint is closed. What should I write to do this?
            Page Down/Up, which should move your slides forward on Click of the pen button, and back on Double-Click, but when power point is closed i wold like to use it for one note. Thanks so much

  • AGT says:

    To keep launching Onenote at other times, just combine this with the line that started the post – the first line more or less says ‘only apply this if a powerpoint slideshow is running’. So using the lines below instead, you should find teh normal behaviour of OneNote on single click, and Screenshot to OneNote on double click.

    This should do it:

    #IfWinExist, ahk_class screenClass
    #F20::
    Send {PgDn}
    Return
    #F19::
    Send {PgUp}
    Return

  • Izzy says:

    This works good for PowerPoint, but any thoughts on how to get it to work with a Prezi presentation (through an internet browser)?
    Thanks!

    • Agt says:

      If Prezy in the browser supports any keyboard shortcuts for next /previous slide you should be able to use those. You would just nine to find out what they are.
      You might need a check on the window /page title if you don’t want the keystrokes sent when you’re not in Prezy.
      Happy to help if you post details back here?

  • Mohammad says:

    Thanks for the codes .They are working on my surface pro 3 to open onenote 2013 and page up and down power point slides.
    But they do not wake up surface from lock screen . is there any code to check lock screen first and set surface waked up?

  • Over the previous yr, we’ve developed a lot of helpful hack tools for numerous video games, which benefited plenty of hardcore players around the
    world.

  • Leave a Reply

    %d bloggers like this: