Things: Procrastinate

An inbox with an attractive tick on it (like the symbol for a tick, not a little beastie that latches on to your leg and gives you Legionnaire's Disease or something)Why on Earth anyone would do anything immediately is beyond me. Hence the invention of this simple little script, which will resechedule your currently selected To Dos in Things for tomorrow.

As is often the case with application scripting, a large part of the challenge is wrapping your head around the app’s unique nomenclature – every program has its own cat-skinning inclination. I spent some time trying to “move” the selected items to the “scheduled” list, to no avail. However, thanks to the excellent AppleScript documentation provided by Cultured Code (available here), I eventually figured out that they had a special verb for me: schedule.

As usual, my preferred way of running all these scripts is with Red Sweater Software’s FastScripts, and attaching a dynamic, attractive keyboard shortcut to ‘em (historians may note that for this particular script I have chosen control-right arrow. My mnemonic: get away from me).

Download Procrastinate.rb.zip.

The source code is dozing amongst those fern fronds, just over there.

Read More »

Posted in things | Leave a comment

Things: Add NetNewsWire Headline

An inbox with an attractive tick on it (like the symbol for a tick, not a little beastie that latches on to your leg and gives you Legionnaire's Disease or something)While hacking my way through the RSS jungle in NetNewsWire, I often find something interesting that I don’t have time to look at right now. Instapaper takes care of long form articles, but if the media in question is a little richer – a video of a skateboarding dog, say – you’ll need another way to come back to it.

This script (which is based on this one by Mike Hall) creates a new To Do in Things based on the currently selected headline, gives it a couple of tags to make it easy to find again, and embeds the URL in the notes section. So you can save up all your Internetistractions (and yes, that is a clumsy neologism/portmanteau of my own creation) and consume them when you’re not supposed to be working.

Download Add to Things.rb.zip

The source code is hastily finishing its breakfast and pulling on its gumboots, just south of here.

Read More »

Posted in things | Leave a comment

Illustrator: Delete Invisible Layers

A pretty descriptive name, yeah? This script is similar to Illustrator’s “Flatten Layers”, but it will leave your visible layers intact, rather than squishing everything onto one.

n.b. if you’ve carefully locked certain layers, this will reset everything to unlocked. The script could certainly be tweaked (by someone less lazy than me) to remember which layers were locked.

Download Delete invisible layers.rb.zip

What I like about this is the use of Appscript.its to operate on a bunch of items at once, rather than having to loop through them. I suspect (though I’m not sure) that this is an advantage of an Apple Events approach as opposed to ExtendScript, Adobe’s JavaScript based alternative. For more on the powerful – and sexy – filtering that Appscript.its lets you achieve, check out this section of Matt Neuberg’s book.

The source code is playfully chasing its shadow in that leafy glade over there. Read More »

Posted in illustrator | 2 Comments

Open for Business, Yes Sir

You’d be forgiven, of course, for thinking that this blog’s maintainer had just been deported to Russia for spying – such is the rate of updates. This, sadly, is not the case. The real reason is far more prosaic: I have been distracted.

However, the Internet toils tirelessly whether I’m paying attention or not. One tireless toiler is Mike Hall, a guy who has more rb-appscript prowess in his little finger than I have in my entire hand. He kindly pointed me in the direction of his blog, which has a terrific array of ruby scripts. It’s so good that I’m going to put it on its own line:

http://mph.puddingbowl.org/category/ruby/

If you’re jonesing for more app("Grue").do_some_stuff({:like => "now"}) then I highly recommend you check it out. I plan on porting Mike’s scripts over here too, so that they’re preserved for posterity, but mainly so I look like I know what I’m doing.

Posted in learning | Leave a comment

Finder: Symlink This Window to That One

Symlinks! They’re not just for Christmas. They are, in fact, just like aliases, enabling you to litter your hard drive with shortcuts in no time flat. You can make them in the terminal with the “ln -s” command, but if you’ve got the windows open in the Finder, hell! Why not use ‘em?

This little baby uses the front two Finder windows to figure out the source and destination. Just be careful that they are the front two windows, or you may get unexpected – perhaps terrifying – results. I took the time to build in a confirmation dialog; just edit the code if you feel like living dangerously.

The source code dances a merry jig, over yonder.

Download Symlink-this-window-to-that-one.rb.zip.

Read More »

Posted in finder | Leave a comment

Photoshop: Export Layer Comps

photoshop.pngWeb designers, in particular, are famous for making Photoshop files with 134 layers, all named “Layer 2 copy copy copy copy”, and spending an hour turning them on and off to show you one iteration of their handiwork. Using Photoshop and not using layer comps is akin to chartering a Gulfstream jet – and then taxiing to your destination.

This script will save all your layer comps separately, in a format of your choosing. “But,” I hear you cry, “Photoshop already comes with a script that already does that already”. Yes, but this one uses the magnificent “Save for Web” command, which performs superior squishing and optimising.

Download Export-layer-comps.rb.zip.

The source code is rubbing its sleepy eyes and yawning, just over there.

Read More »

Posted in photoshop | Leave a comment

InDesign: Update All Modified Images

indesignThis has actually been added as a command in the latest release of InDesign (curse you Adobe, for improving your software and rendering my scripts obsolete). It still serves as a useful example for how to filter a bunch of objects based on a selector.

Download Update-all-modified-images.rb.zip.

As it’s only little, I’ve decided to let this source code live on the front page.

#!/usr/bin/env ruby

# rb-appscript code by Ian Haigh : http://ianhaigh.com/
# Fri Dec  4 15:54:38 EST 2009

require 'rubygems'
require 'appscript'
include Appscript

ai = Appscript.app('Adobe InDesign CS4.app')

#  Update all modified images
ai.active_document.links[its.status.eq(:link_out_of_date)].update
Posted in indesign | 1 Comment

iTunes: Total Size of Current Playlist

itunesThis script, erm, duplicates the functionality of simply looking at the bottom of the iTunes window, where you’ll find the total size of the current playlist smugly peering up at you. So why did I write this? Your guess is as good as mine. However, in the name of providing examples for would-be iTunes scripters, I present it here in all its redundant glory.

Download Total-size-of-current-playlist.rb.zip.

The source code is cowering sheepishly around the corner.

Read More »

Posted in itunes | Leave a comment

Illustrator: All Layers Visible

illustratorThe clue is in the title. This is especially handy when you attach a keyboard shortcut with a utility such as – the frankly indispensableFastScripts.

Download All-layers-visible.rb.zip.

The source code is sheltering from a brief sun shower below.
Read More »

Posted in illustrator | 2 Comments

InDesign: Reveal Links in Finder

indesignLoops through all the selected items, attempts to figure out whether any of them are linked images, and opens their containing folders, selecting all of ‘em.

Download Reveal-links-in-Finder.rb.zip.

The source code is bouncing from foot to foot in anticipatory glee, just after the jump.
Read More »

Posted in indesign | Leave a comment
  • What’s this all about then?

    rb-appscript is a powerful way to automate your Mac. It's similar to Applescript but it's built in Ruby, which means you get to leverage that language's powerful syntax and libraries. Giving you more time to make toasted sandwiches. You want long-winded explanations? We got those.

    Please note that these scripts are by no means bulletproof, and are intended to provide examples of application scripting. I take no resposibility for any loss of data or mishaps; you download and run everything at your own risk. That said, I use all of these scripts in a production environment every day (well – more accurately, I use some of these scripts in a production environment most days).