Skip to content

Windows Print Screen #615

@jweingarten-rv

Description

@jweingarten-rv

Short summary
How do I make the Windows 11 PrintScreen keyboard shortcut work to take a screenshot?

Desired execution environment / tested on

  • Virtual machine
    Docker container
    Dev/Host system

node version:
v.22.13.0

OS type and version:
Windows

Full code sample related to question

  1. Execute the below code
'use strict';

const {keyboard, Key, } = require("@nut-tree/nut-js");



const main = async () => {
    
   await keyboard.type(Key.LeftSuper, Key.Print);

};



main();
  1. Try to paste into Microsoft Paint.
    Nothing seems to be in the Clipboard at this point.

Detailed question

Not sure what I am doing wrong, but I tried all kinds of combinations of LeftWin or LeftSuper with Print or even just Print and I don't seem to get a screenshot either saved to disk or clipboard.

My goal in the test on Windows is to

  • take a screenshot of the current screen
  • paste the screenshot, that is in the clipboard now, into my application under test

Activity

s1hofmann

s1hofmann commented on Apr 16, 2025

@s1hofmann
Member

Hi @jweingarten-rv 👋

I’ll have a look!

s1hofmann

s1hofmann commented on May 6, 2025

@s1hofmann
Member

Hi @jweingarten-rv 👋

I can confirm your issue.
It seems to be caused by the event generation inserting the event at a higher level, causing the screenshot trigger not to react to it.

I implemented a workaround for this case and confirmed the fix myself, I'll release a snapshot for you to test soon.

Best regards

Simon

s1hofmann

s1hofmann commented on May 24, 2025

@s1hofmann
Member

Hi @jweingarten-rv 👋

there are new snapshots to test the fix:

npm i @nut-tree/nut-js@next

and/or

npm i @nut-tree/bolt@next

jweingarten-rv

jweingarten-rv commented on May 31, 2025

@jweingarten-rv
Author

Fix confirmed in npm i @nut-tree/nut-js@next . Sorry for the delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @s1hofmann@jweingarten-rv

        Issue actions

          Windows Print Screen · Issue #615 · nut-tree/nut.js