Clipstart file actions

“Clipstart 1.1”… is out, with support for the iPhone 3GS, YouTube, and more. I’m really happy with the response I’ve received so far. The 3GS is such a convenient device for video that even people who weren’t taking lots of clips before now find themselves with a bunch of videos. That deserves a dedicated management app.

“Ryan Irelan” asked me the other day if Clipstart would support a simple email option, for quickly sharing a video with family without uploading to a web site. This is a pretty good candidate for using Clipstart’s file actions, which allow you to process the selected video files with a script.

I liked how “Acorn handled this kind of thing”… so I essentially lifted its file actions feature directly and put it into Clipstart, even down to the ACShortcutKey shortcut comments. Even though Acorn is for still images and Clipstart for videos, it seemed similar enough that you could conceivably take lightly-modified scripts from one app and use it the other, if they did not deal with the file’s contents.

Here’s the email script that will be included in Clipstart 1.1.1:


on run argv

    set filepath to item 1 of argv

    set old_delims to AppleScript’s text item delimiters

    set AppleScript’s text item delimiters to {"/"}

    set path_items to text items of (filepath as text)

    set AppleScript’s text item delimiters to old_delims

    set filename to last item of path_items

    tell application “Mail”

        set new_msg to make new outgoing message with properties {subject:filename, content:"" & return & return}

        tell new_msg

            set visible to true

            tell content

                make new attachment with properties {file name:filepath} at after the last paragraph

            end tell

        end tell


    end tell


Running scripts has been in Clipstart since 1.0. The implementation is pretty simple. I parse the available file action files to extract the executable path and any shortcut keys and modifiers, then dynamically create the menu items. When it’s time to run an action I use NSTask and friends to execute the program and pass the script file and selected movie path to it.

Instead of this:

/path/to/ /path/to/movie.avi

Clipstart does it like one of these:

/usr/bin/bash /path/to/ /path/to/movie.avi

/usr/bin/osascript /path/to/ /path/to/movie.avi

I did this to not require setting +x on the file, but it also seems to be a more convenient way of processing command line arguments when run from osascript.

Manton Reece @manton