Friday 16 August 2019

Surface Pen and Screenshot

My Surface Pro 3's cheap OEM cover keyboard doesn't have functional Print Screen button which is a problem for my usage. I tried to use the Send Screenshot to OneNote which they said can direct save a screenshot on OneDrive folder. But the method doesn't work and I don't want to use OneNote. Most of my usage is offline mode and I don't have that huge bandwidth to do synchronize.

Now I found a workaround using some coding.
I need to install a software called Greenshot and set the new HotKey to screenshot full screen to Ctrl+D which a hotkey that I seldom use.

Then there is some scripting to do.

Open a notepad and type:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "^d"

Then save it as filename.vbs

After that we will create a batch file that run the scripts.
start "filename.vbs"

and save the file to filename.bat

Double click on the .bat file to test the code. If it work, then we will create an exe file using iexpress.exe

In your C:\Windows\System32\ folder, there is a file called iexpress.exe.

Right-click it an Run as administrator.
Create a new SED and select "Extract files and run an installation command."
Add the script you want, and make sure that on the next screen, you set the install program to cmd /c [your_script.bat] where [your_script.bat] is the script file you want to execute. If you don't do this, windows will try to use Command.com (the old version of Command Prompt) which hasn't been in use for quite a while.
Select preferences (you might need to select "Store files using Long File Name inside Package), set an output path (to the .exe file you want to create), and select "No restart".
Click next and you should have your .exe!
Just a note, this file actually only acts as a wrapper for your script, and the script itself actually gets executed in a temp folder created on execution (and deleted afterwards), so make sure you don't use any relative paths.

After all is done, place your exe file to a suitable folder. Open the Setting->Devices->Pen & Ink
At the bottom of Surface Pen setting for double or single click. select open with classic app and brows to the exe. Once done you can test it.

So now I can do a direct save screenshot by clicking my Surface Pen.




No comments: