pause(0.05)
robot = java.awt.Robot();
temp = app.fig_SpeedTrapTool.Position;
allMonPos = get(0,"MonitorPositions");
curMon = find(temp(1)<(allMonPos(:,1)+allMonPos(:,3)),1,"first");
curMonHeight = allMonPos(curMon,4)+1;
pos = [temp(1),curMonHeight-(temp(2)+temp(4)),temp(3)-1,temp(4)];
rect = java.awt.Rectangle(pos(1),pos(2),pos(3),pos(4));
cap = robot.createScreenCapture(rect);
rgb = typecast(cap.getRGB(0,0,cap.getWidth,cap.getHeight,[],0,cap.getWidth),"uint8");
imgData = zeros(cap.getHeight,cap.getWidth,3,"uint8");
imgData(:,:,1) = reshape(rgb(3:4:end),cap.getWidth,[])';
imgData(:,:,2) = reshape(rgb(2:4:end),cap.getWidth,[])';
imgData(:,:,3) = reshape(rgb(1:4:end),cap.getWidth,[])';
hImg = imshow(imgData);
saveas(hImg,file,"png")
close(hImg.Parent.Parent)
10 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751713
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751713
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751765
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751765
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751772
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751772
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751776
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751776
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751789
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751789
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751857
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751857
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751926
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751926
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751973
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751973
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751975
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751975
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751977
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/483043-appdesigner-print-screen-problem-appdesigner-is-a-disappointment#comment_751977
Sign in to comment.