Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Take and upload screenshots via Automator Internet
I often take screenshots and upload them for my friends to see -- especially while working on web projects etc. So I created an Automator workflow that does this automagically!

First the workflow snaps the whole screen and saves it to the desktop. Then a bash script is run wich uses ftp to upload the image to the webserver. It then takes the URL of the image and copies it to the clipboard. Lastly it notifies you of the upload via Growl. It has no error handling or anything. This is my first workflow and bash script ever, but it works for me. In Automator, create the following steps in a new blank workflow:
  1. Utilities » Take Screenshot. Use these settings:
    • Type: Full Screen, or whatever you prefer.
    • Select Main Monitor Only and/or Timed as you desire.
    • Set the Save To pop-up menu so that it saves to a file named tmpScreen.png on your Desktop.
  2. Utilities » Run Shell Script. Set Shell to /bin/bash and Pass Input to to stdin. Enter the following code, noting the lines you need to edit:
    # Author: Simon Ljungberg @
    # Edit the 5 lines below to fit your configuration
    # URL will be copied to your clipboard!
    REMOTEFILE='pathtoremotefile(including filename)'
    # If you change this you need to change the rm-line too.
    # For some reason (I'm new at this) I couldn't get the file
    # to disappear when using the variable...
    ftp -n $HOST <<END_SCRIPT
    quote USER $USER
    quote PASS $PASSWD
    rm ~/Desktop/tmpScreen.png
    echo $URL | pbcopy
  3. If you have Growl installed, add Utilities » Show Growl Notification. Give it a Title ("Done!") and Description ("Your screenshot has been uploaded") so you'll see a message after the upload is completed.
Alternatively, you could download the script from my server, and then just change the variables in the shell script section of the workflow.

To make this work, you need a web server with FTP access, and note that your username and password are stored in the script. Works for me in 10.5.7; I hope someone can make use of it!
  • Currently 1.64 / 5
  You rated: 5 / 5 (11 votes cast)

10.5: Take and upload screenshots via Automator | 4 comments | Create New Account
Click here to return to the '10.5: Take and upload screenshots via Automator' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Take and upload screenshots via Automator
Authored by: Doc Drang on Jun 16, '09 10:12:37AM

Unless I've read the code wrong, this workflow doesn't allow the user to change the name of the screenshot file, either locally or on the server. That's a pretty serious limitation.

ImageWell is a commercial ($20) application that will upload an image and allow you to edit both the name and the image itself before it goes to the server.

If you just want to upload a screenshot with a name of your choosing, my snapftp, a Python program that uses the Pashua GUI utility, might work for you. The source code and instructions for building and using it are at the link.

You could also incorporate file renaming into the shell script by using Pashua.

Doc Drang

[ Reply to This | # ]

10.5: Take and upload screenshots via Automator
Authored by: Simme on Jun 16, '09 12:13:13PM

I'm the author! Hehe...

Well, no. You can't dynamically change the filename.
The point of this workflow was to quickly upload a screenshot to show something to a friend. It was not meant to upload many screenshots. It was meant to be quick, dirty and simple.

Sure, if you want to pay 20 bucks just to be able to name your screenshots! Go ahead ;) Someone who's profficient with bash-scripting and Automator may be able to add a prompt for a filename.

[ Reply to This | # ]
10.5: Take and upload screenshots via Automator
Authored by: regulus on Jun 16, '09 12:17:21PM
Here's a little applescript to do the same thing without the automator and shell script effort. It has error checking too. Note: if you don't want to store your password in clear text in the script (not very secure!) you can look at post #5 here for a method of using the keychain to store/restore the password:
-- variables
set ftpHost to ""
set ftpUserName to "ftp user name"
set ftpPassword to "ftp password"
set ftpRemotePath to "/tmpScreen.png"
set screencapturePath to (path to desktop folder as text) & "tmpScreen.png"
set webImageURL to ""

-- take the screenshot
do shell script "/usr/sbin/screencapture " & quoted form of POSIX path of screencapturePath

-- ftp upload
set ftpURL to "ftp://" & ftpUserName & ":" & ftpPassword & "@" & ftpHost & ftpRemotePath
set hadSuccess to false
  tell application "URL Access Scripting" to upload file screencapturePath to ftpURL replacing yes with binhexing
  set hadSuccess to true
on error theError number errorNumber
  if errorNumber is not -128 then
    tell me
      display dialog "There was an error:" & return & return & theError & return & "Error Number: " & errorNumber as text buttons {"OK"} default button 1 with icon stop
    end tell
  end if
end try

-- delete the screenshot
do shell script "rm " & quoted form of POSIX path of screencapturePath

-- open the website file
if hadSuccess then open location webImageURL
robg adds: edited to show code in fixed-width box.
Edited on Feb 19, '10 10:43:21AM by robg

[ Reply to This | # ]
10.5: Take and upload screenshots via Automator
Authored by: Doc Drang on Jun 16, '09 07:56:00PM

Well, I suppose if you repeatedly upload screenshots to show a friend, and if you don't mind overwriting your old files with every new upload, then the workflow is worth it for you. But if you made the workflow for a single screenshot and upload, I don't see how it could be quicker or simpler than just taking the screenshot and uploading the file "by hand."

I don't own ImageWell; as I said, I use my own script for screenshots and uploads. I thought ImageWell (which does more than just rename and upload files) was worth mentioning because some people reading your hint might find it useful. Even for $20.

Doc Drang

[ Reply to This | # ]