print/snapshot key not working
Opened this issue · 3 comments
On my Windows 10 PC I can take a quick screenshot with Win+PrtScn
or open the Windows "Snip & Sketch" tool with PrtScn
. With the physical keyboard this works as expected.
I haven't found any existing remote supporting this action so I tried creating one. In the key list I found the codes snapshot
/print
for PrtScn
and I tried using them with this remote:
remote.lua
:
local kb = libs.keyboard;
actions.winPrint = function ()
kb.stroke("win", "print");
end
actions.winCtrlPrint = function ()
kb.stroke("win", "ctrl", "print");
end
actions.winFnPrint = function ()
kb.stroke("win", "fn", "print");
end
actions.print = function ()
kb.stroke("print");
end
actions.snapshot = function ()
kb.stroke("snapshot");
end
layout.xml
:
<?xml version="1.0" encoding="utf-8"?>
<layout>
<row>
<button text="Fast win print" ontap="winPrint" />
</row>
<row>
<button text="Fast win ctrl print" ontap="winCtrlPrint" />
</row>
<row>
<button text="Fast win fn print" ontap="winFnPrint" />
</row>
<row>
<button text="Slow print" ontap="print" />
</row>
<row>
<button text="Slow snapshot" ontap="snapshot" />
</row>
</layout>
None of the above actions do the screenshot. winPrint
opens the Start menu, winCtrlPrint
. print
and snapshot
do nothing. winFnPrint
does nothing, unless you are in the browser, in wich case it searches the letter 'ù' in the page.
How can I use the PrtScn
key and take a screenshot?
did you find a solution?
Kind of. Here are some tests I made:
layout.xml
:
<?xml version="1.0" encoding="utf-8"?>
<layout>
<!--
<row>
<button text="Fast win print" ontap="winPrint" />
</row>
<row>
<button text="Fast win ctrl print" ontap="winCtrlPrint" />
</row>
<row>
<button text="Fast win fn print" ontap="winFnPrint" />
</row>
<row>
<button text="Fast win shift s" ontap="winShiftS" />
</row>
<row>
<button text="Slow print" ontap="print" />
</row>
<row>
<button text="Slow snapshot" ontap="snapshot" />
</row>
<row>
<button text="Sniptool" ontap="sniptool" />
</row>
-->
<row>
<button text="Screenshot" ontap="winShiftS" />
</row>
</layout>
remote.lua
:
local kb = libs.keyboard;
local tmr = require("timer");
-- https://www.unifiedremote.com/tutorials/how-to-create-a-custom-keyboard-shortcuts-remote
-- https://github.com/unifiedremote/Docs/blob/master/res/keys.md
-- Documentation
-- http://www.unifiedremote.com/api
-- Keyboard Library
-- http://www.unifiedremote.com/api/libs/keyboard
actions.winPrint = function ()
kb.stroke("print", "win");
end
actions.winCtrlPrint = function ()
kb.stroke("ctrl", "print", "win");
end
actions.winFnPrint = function ()
kb.stroke("fn", "print", "win");
end
actions.winShiftS = function ()
kb.stroke("shift", "s", "win");
tmr.timeout(function ()
kb.stroke("tab");
kb.stroke("tab");
kb.stroke("tab");
kb.stroke("enter");
end, 1000);
end
actions.print = function ()
kb.stroke("print");
end
actions.snapshot = function ()
kb.stroke("snapshot");
end
actions.sniptool = function ()
script.default("C:\\Windows\\System32\\SnippingTool.exe /clip");
end
The only working action is winShiftS
: it opens the screenshot tool (shift+s+win
), it moves itself to the "Capture full screen" (tab
3 times) and it executes it (enter
).
The catch is that the screenshot tool takes some time to open, especially if you are in the middle of a game, so you must wait for it.
1 second was enough for me but if it does not work for you you can change the 1000
(ms) value to something else.
The problem persists, print does not work, will there be a fix?