How to Take a Screenshot from Spotlight – Keyboard and Automator Tips

automatorkeyboardscreen capturespotlight

I want to be able to take a screenshot using Spotlight. I know I can just press "Command-Shift-3" to get the job done, but I want to get some very computer-illiterate people to learn to take a screenshot without having them to learn a shortcut. They already know how to use Spotlight, hence the question.

I thought of making an Automator script to do this. But that did not work.

on run {input, parameters}

    (* Your script goes here *)
    tell application "System Events"
        keystroke "3" using {command down, shift down}
    end tell

    return input
end run

Any other suggestions? I don't want to install some app to do this.

Best Answer

You can use this AppleScript in an Automator app to take a screenshot.

on run
    do shell script "/usr/sbin/screencapture \"" & ¬
        POSIX path of (path to desktop as string) & ¬
        "Screen Shot " & (current date) & ".png\""
end run

Save the Automator workflow as an app with an appropriate name for Spotlight to find it and suggest it.