On the Mac Power Users G+ group, someone asked:
Is there a scriptable/automated way for to attach my last screenshot to a Mail message? I'm constantly dragging screenshots (which get saved to the Desktop) into messages. I'd love a keyboard shortcut within the message that attaches the latest screenshot wherever the cursor is.
This seemed like an interesting challenge, so I put together a Keyboard Maestro macro to do this.
Customized Screen Capture preferences? No problem.
It is build primarily around a shell script (quelle surprise). It tries to be smart, so if you have changed:
- The default folder where screen shots are stored (
defaults read com.apple.screencapture location
) - You have changed the type of image used for screen shots (
defaults read com.apple.screencapture type
) - You have changed the default âprefixâ for screen shots (
defaults read com.apple.screencapture name
)
It will still find any screenshots that match.
Notifications
If it does not find any screenshots which match, it will tell you, using Growl (if Growl is running) or OS X notifications. (Growl notifications work better because they show more text than OS X notifications.)
Paste, if possible
The macro also checks to see if the current app has a Paste
menu item enabled. If it does, the image will be pasted. So, for example, if you sending an email, it will attach the screenshot.
If the Paste
menu item is not found or not enabled, a notification tells the user that the pasteboard now contains the latest screenshot image.
Credit to Chris Johnsen whose AppleScript I used to build this macro around: http://apple.stackexchange.com/a/15542/9226.
Download the macro here: Put Latest Screenshot on Pasteboard.kmmacros (9.2 KB)
Note that you may wish to limit this macro only to apps where you are most likely to use it, but I have made it a global using ââ„âV as the keyboard shortcut.
This is what it looks like: