Is there a way to find the handle of a certain window and take a screenshot in Mathematica without having to call external programs? Something that connects with the API for the operating system.

  • $\begingroup$ does CurrentNotebookImage` give what you need? $\endgroup$
    – kglr
    Commented Sep 30, 2020 at 23:35
  • 1
    $\begingroup$ CurrentScreenImage captures full screens or a rectangle from the screen. $\endgroup$ Commented Sep 30, 2020 at 23:45
  • $\begingroup$ Is this what you need: 56065? $\endgroup$
    – Kuba
    Commented Oct 1, 2020 at 14:05

1 Answer 1



Another way! using


to list all the windows and then copy one of them to Export!

Export["newCapture.png", copySomethingAbove, ImageResolution -> 400]

See the picture as below!

enter image description here


To control the resolution of image, we can use CreateDocument to creat a new notebook, then write some code and run. SetSelectedNotebook can be used to chose the exact window and then capture it.

nb1 = CreateDocument[Plot[Sin[x], {x, -5, 5}, PlotStyle -> Red]];
nb2 = CreateDocument[Plot[Cos[x], {x, -5, 5}, PlotStyle -> Blue]];
Export["nb1-picture.png", %, ImageResolution -> 400]
Export["nb2-picture.png", %, ImageResolution -> 400]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.