2 posts tagged “applescript”
I've never been one of the people who's seen a need to use any terminal application in Mac OS X other than the one supplied by Apple in Utilities. It does the job, uses Monaco 9, doesn't anti-alias (or at least, can be made not to). It starts up in Mac-ish black on white, and generally Just Works.
10.5 saw a bit of an overhaul, with a much saner configuration interface (all in Preferences, rather than hidden in a rather baffling out-of-the-way inspector) and tabbed browsing. Now, I still don't use tabs on the Mac OS, personally; I like the established app/window split and don't see the need to bring a third level of indirection into play, especially when it doesn't even have consistent shortcuts. (Tabs on Windows? Now that's a different story.) In fact, for years I'd quite happily got by with a bunch of scripts in ~/Library/Scripts/Applications/Terminal/ that would neatly stack all the windows.
Sadly, the new version of Terminal also introduced an annoying AppleScript bug which renders these scripts less than useful. When positioning a window, the vertical positions aren't honoured correctly: instead, the window ends up 320 pixels up the screen from the desired location - OK if you want a window at the top, but certainly not if it's meant to be at the bottom right, which is my usual position. I mention this now because the bug in Terminal that broke my window arrangers will also affect a script to centre windows that TALlama (no really) posted in response to a lazytwitter invocation by John Siracusa. If you try to centre a Terminal window, it ends up jammed at the top of the screen, for no apparent reason.
Now, I'm not down with the cool kids who post radr:// URLs, so if anyone who's reading this is, it's really easy to replicate the error: get a Terminal window towards the bottom of the screen, run this script - which should do nothing, as it's merely putting the window back where it started - and watch your window shift around. Do that, report it, and hopefully eventually I'll be able to retire my "set voffset to 320 -- work around AppleScript bug" line.
tell application "Terminal"
set b to bounds of window 1
set bounds of window 1 to b
end tell
Anyway, thanks for listening, and here's hoping for a better Terminal AppleScript interface in 10.5.3.
Thanks to all the people who dropped by after the link from John Gruber, and indeed to him for (evidently) leading people here. Hopefully it's been useful. I appreciate all the comments, on vox and off. I hadn't really thought about the implications of posting an article like that on a site that requires the creation of a login, and of course these days it's not exactly a great idea to leave your email address lying around, so bonus points to those of you who managed to evade my (rather bad) spam filtering.
Some specific comments, then. Thanks to Rod Begbie for his comments about MusicBrainz, which has apparently supported sort data for a while, and Todd Larason for his dissection of ID3 tags that iTunes uses. I also updated the article to clarify how to apply fields to multiple items after an email from Chris Brummel made me realise that they weren't quite clear enough.
Speaking of applying fields to multiple tracks, Jacob Rus sent through an AppleScript that allows you to select a batch of tracks and apply a "Sort Artist" to each of them. It's worth reading the commentary at the beginning, as it's a little fragile (as scripts that rely on orders often are), but it also looks to be a useful fix for some of the UI issues noted in my original piece.