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.
Asked
Active
Viewed 136 times
0
1 Answers
3
Update
Another way! using
Notebooks[]
to list all the windows and then copy one of them to Export!
Export["newCapture.png", copySomethingAbove, ImageResolution -> 400]
See the picture as below!
Original
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]];
SetSelectedNotebook[nb1];
Export["nb1-picture.png", %, ImageResolution -> 400]
SetSelectedNotebook[nb2]
Export["nb2-picture.png", %, ImageResolution -> 400]
cvgmt
- 72,231
- 4
- 75
- 133

CurrentScreenImagecaptures full screens or a rectangle from the screen. – Jean-Pierre Sep 30 '20 at 23:45