How can I execute Command-Shift-4 from a Pushbutton?

Hello,

I can crop an image using Command-Shift-4 on the Keyboard on a Mac.

How can I execute Command-Shift-4 from a Pushbutton?

Thanks.

Lennox

We have a plugin to press keys on keyboard ,but I’m not sure if it can trigger systemwide hotkeys.
see http://www.monkeybreadsoftware.net/module-remotecontrolmbs.shtml

Why not get a screenshot directly yourself?
see http://www.monkeybreadsoftware.net/pluginpart-screenshot.shtml

or just a screenshot rendering of a window?
see http://www.monkeybreadsoftware.net/module-cgwindowmbs.shtml

Thanks Christian,

What I want to do is to crop an image that is being displayed, (not from my app), on the desktop.

Command-Shift-4 does that on a mac as a screenshot.

Lennox

Dim s as new shell s.Execute "screencapture -i ~/Desktop/Hello.png"
This is exactly the same as pressing cmd-shift-4 and the user will be in a position to select the area required.

Or, remove the -i flag and it will automatically take a screenshot of the full-screen.

Thanks Gavin,

Exactly what I wanted.

Thanks again. I don’t know how to use solved.

Lennox

When you point to Gavin’s post, there is an icon for “answer” or something like that.

Thanks Kem it is a little “Tick” near the “Quote” at the top right of the post.

Lennox

[quote=74134:@Gavin Smith]Dim s as new shell
s.Execute “screencapture -i ~/Desktop/Hello.png”[/quote]

How can I modify the above to capture the window the pushbutton calling that shell is in? e.g. Self.Width, Self.Height

Thanks.

Lennox

OK, I got it… http://dailymactips.com/take-screenshots-on-your-mac-using-the-terminal-application/

[quote=310489:@Lennox Jacob]How can I modify the above to capture the window the pushbutton calling that shell is in? e.g. Self.Width, Self.Height

Thanks.

Lennox

OK, I got it… http://dailymactips.com/take-screenshots-on-your-mac-using-the-terminal-application/[/quote]
Are you trying to capture your applications window?

You might be able to use DrawInto for that or with some declares you can capture the window buffer.

Yes, I am trying to capture my application’s window.

I drop a folder item, .jpg, onto the canvas, then I make a few marquees then I would like to capture the window with the marquees.

If I use DrawInto the marquees don’t show, maybe I need some declares to capture the window buffer, but I do not know how to code those declares.

Any suggestions… Code?

Thanks.

Lennox