Tag Archives: applescript

Thanks to our Core Int listeners

Yesterday we published episode 260 of Core Intuition. From the show notes:

Daniel and Manton discuss Sal Soghoian’s sudden departure from Apple, and what it may mean for Apple’s future ambitions with automation. Then they react to Apple’s alleged decision to abandon their line of AirPort branded routers, and bemoan the loss of yet another “just buy the Apple one” peripheral option

I liked the topics for our show this week because it allowed us to not just talk about AppleScript as it exists today, but also to reflect on what life developing scriptable apps was like in the early days of AppleScript. It’s always fun to think back on 1990s Mac development.

Many of our listeners are celebrating Thanksgiving today. To all of our listeners, whether you’ve listened since the beginning in 2008 or just recently discovered the podcast, thank you so much for giving our show a chance and for being part of the community. Daniel and I still feel incredibly lucky that we get to chat every week about Apple news and our work as indie developers.

Email archiving with Evernote

For a long time, I’ve struggled with having important email archived in one place. I’ve switched between several clients over the years, from Eudora and Mailsmith and even Cyberdog, in the very early Mac days, to more recently the fairly reliable Apple Mail. Yet I still occasionally lose old email when switching between machines and not handling the migration properly.

Last year I set out to fix this. While I didn’t do an exhaustive search of archiving options, the main solutions I considered were:

  • Switch to Gmail. There are plenty of native clients for Gmail, but I fundamentally don’t like the idea of an ad-supported email service. I’m very happy with Fastmail and want to continue using it.
  • Local archiving with EagleFiler. This gets the email archived in a central place outside whatever mail client I’m using, which is great. However, I’d like something that is focused on cloud search first.
  • Save to files on Dropbox. All of my notes are stored on Dropbox, so why not put an email archive there too? But Dropbox doesn’t seem well-suited to accessing and searching easily.
  • Save to Evernote. I’ve never actively used Evernote for notes. Using Evernote for email would keep the email separate from normal notes on Dropbox, and Evernote already has excellent support for forwarding email into their system. I’d be able to search the archive from my Mac, iPhone, or the web.

I’ve settled into a pretty basic workflow of using Evernote to save any email that looks moderately valuable. This is usually a handful of messages each day, not every email I receive or send. By picking and choosing what gets archived, I can ignore everything else, letting it sit in Mail’s archive indefinitely or deleting it.

Here’s an AppleScript I currently trigger in Mail for any selected message I want to archive. It’s set to command-shift-S via FastScripts. If I’m away from my Mac, or I want to preserve HTML and inline attachments, I can save an email by forwarding it to a special Evernote email address. (I also pay for Evernote Premium.)

Now that I’m about a year and thousands of archived messages into this setup, I’m declaring it a success. I plan to continue using Evernote in this way for years to come. Let’s just hope they’re on the right track with their own business.

Clipstart 1.2 ships soooon

Now that I’m done “giving away a free iPhone”:http://twitter.com/manton/status/3370506213, I can move on to the next phase of my marketing plan: release new and better software! Crazy, huh? Clipstart 1.2 is nearly ready and I’m very proud of this release. There’s so much new stuff I could have called it 2.0.

Batch export. Select multiple videos and convert them to H.264, or optimized for iPod, iPhone, and Apple TV, and optionally run a script on the results. It can even create an HTML 5 web site and export in Ogg Theora format for Firefox and Opera users.

Twitter upload. Works with Yfrog to upload a video and post to Twitter. To include a custom tweet, use the “Upload with Options” command, just as you would add a description to a Flickr, Vimeo, or YouTube upload.

New tagging interface. Easy way to tag multiple videos from the keyboard. You can also now drag videos to an existing tag to apply that tag to the selection.

iSight capture. I wasn’t planning on adding this until later, but I think it complements the Twitter support well. Capture from the iSight and it records as H.264 and adds the video to your Clipstart library.

New toolbar and button style. I shouldn’t have used the round rectangle scope button style in Clipstart 1.0, so I decided to roll my own that fit well with the toolbar. It’s still not a standard toolbar but I hope to transition to one in a future version of Clipstart.

Change date for multiple videos. You can update the date for multiple videos at once, with the flexibility of changing specific portions of the date, such as just the year or month. Great for correcting dates from cameras.

AppleScript support. Just the basics for now, but you can get a list of videos, with tags and other metadata for each.

Plus some other fixes and Snow Leopard compatibility. I plan to release it in the next couple days, just in case Snow Leopard is released on the 28th as rumored. If you are interested in trying a beta and submitting some last-minute feedback, drop me an email at “support@riverfold.com”:support@riverfold.com.

Clipstart file actions

“Clipstart 1.1”:http://www.riverfold.com/software/clipstart/ 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”:http://ryanirelan.com/ 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”:http://flyingmeat.com/wikka/AcornExtraScripts, 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:

#!/usr/bin/osascript

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

        activate

    end tell

end

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/myscript.sh /path/to/movie.avi

Clipstart does it like one of these:

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

/usr/bin/osascript /path/to/myscript.sh /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.