ScrnShots AppleScript Upload Folder Action

Posted on June 5, 2008

Now that we've announced the public API (beta) for ScrnShots.com, I can start blogging about some of the tools I've built to interact with it.

The first, is a folder action for Mac OS X that lets you drop images onto it and they are automatically uploaded to your ScrnShots account.

DISCLAIMER: This script was created fairly quickly and is very simple. It is in no way complete or robust in its error handling. If you find any bugs or errors, please post a comment below and I will update the script as necessary.

Here are the steps to get the folder action setup:

  1. Download the ScrnShots Folder Uploader (1.0) script file.
  2. Put the above file in "~/Library/Scripts/Folder Action Scripts" (create the folder if it does not already exist)
  3. Double click the script file to open it in the script editor, then edit the following code at the top of the file to include your ScrnShots username and password:
    1. -- SETTINGS
    2. -- Update to be your username
    3. property user_name : "INSERT YOUR USERNAME HERE"
    4. -- Update to be your password
    5. property user_password : "INSERT YOUR PASSWORD HERE"
  4. Create a new folder on your desktop called "Upload to ScrnShots"
  5. Right click the folder and select "More > Enable Folder Actions"
  6. Right click the folder again and select "More > Attach a Folder Action..."
  7. From the file selector, select the downloaded applescript file in "~/Library/Scripts/Folder Action Scripts/ScrnShots Folder Uploader"
  8. Voila! You should now be able to drag images onto that folder and they will upload to ScrnShots! After a screenshot us uploaded it moves it into the "Uploaded" folder.

Hope this is useful to anyone who needs to quickly upload screennshots without using the ScrnShots Desktop app.

BONUS POINTS

If you really want to make the Folder Action cool, create an icon for the folder and add it to your dock. Then you get immediate access to upload images to screenshots with the drag of a file. I've tried this out with Skitch and it works beautifully.

Please post any bug, comments or code updates below! Enjoy.


8 Replies to "ScrnShots AppleScript Upload Folder Action"

  • assbach
    June 5, 2008 (8:49 am)
    Reply

    great, thanks for that Greg.
    I will test it tonite. :)

  • Greg Bell
    June 5, 2008 (8:50 am)
    Reply

    Excellent. Let me know how it goes.

  • Kenzie
    June 5, 2008 (10:05 am)
    Reply

    Just tried it, works great. I use Paparazzi [http://www.derailer.org/paparazzi/] to take screen shots, and I can just “save as…” to this action folder.

    The only issue I encountered was definitely an edge case… after adding a file to the folder for uploading I deleted it from scrnshots, and then tried to add it again to the folder again. I got an error that the file already existed (in the uploaded folder). I just deleted it from the Uploaded folder and problem solved.

  • Greg Bell
    June 5, 2008 (10:25 am)
    Reply

    @Kenzie – Great point. I’ll update it so that it writes to a new filename with a number appended to it. Thanks for the bug.

  • assbach
    June 5, 2008 (2:41 pm)
    Reply

    it works fine.
    i made a little screencast to show my buddys, it’s uploading at vimeo. ;)
    hope that is okay for you. http://vimeo.com/1124781 ( still converting )

  • assbach
    June 12, 2008 (10:45 pm)
    Reply

    Hey Greg, found a bug.
    look http://skitch.com/assbach/p14c/finder
    this seems to happen when there are special characters in the filename i guess, like comma or something!?! HTH

  • Greg Bell
    June 13, 2008 (8:51 am)
    Reply

    Ah yes. This is one of the problems with using cURL through applescript. I’ll take a look and see if it can escape filenames with special characters.

  • Daniel Groves
    October 5, 2009 (3:10 am)
    Reply

    Hi,

    Is there a way for me to change the location of the folder?

    Thanks,
    Dan.


Got something to say?

Some html is OK