Automator task to open screenshots in Preview automatically

applescriptautomatorpreviewscreen captureterminal

I'm pretty new to Automator but it seems like it's possible – I just can't seem to get it to work.

I'd like to be able to take a screenshot and then open it up in Preview for easy annotation. If it's possible I'd then like to copy it to clipboard after saving but that's not 100% needed.

I've tried following a few articles but never received good results. The one that got me closest is here: https://andytaylor.me/2014/05/22/better-os-x-screenshots-with-shell-scripts/

I don't need Dropbox so I edited that part out and I modified it based on some other suggestions – here's what I have:

directoryname="Screenshots"
filename="shot_$(date '+%Y-%m-%d_%H-%M-%S').png"
path="$HOME/Pictures/$directoryname/"
mkdir -p "$path"
screencapture -o -i "$path$filename"
open -a 'Preview' "$path$filename"

When I run the Automator task it says that it was completed successfully but it just opens up Preview, it doesn't even allow me to do a screencapture. When I copy/paste into Terminal it hangs on the last line – but successfully allows me to do the screencapture.

Best Answer

@Feanux I was answering your question and then you deleted it but I see you reposted it, anyway I have made a Automator app that does this and will attach a screenshot (that was taken by Automator).enter image description here As you can see it takes two screenshots, one for clipboard and one for preview/save

UPDATE:

enter image description here