Archives / Search ›

AppleScript is fun!

No, not really; I find it really frustrating programming almost exclusively by trial and error. I figured I might as well potentially save some people time in experimentation, and share the couple of scripts I wrote this week.

Move message to saved (view as HTML, download AppleScript) lets me use my inboxes as “to-do” lists; after I put the script in ~/Library/Scripts/Mail Scripts/ and name it “Move message to saved___cmd-d”, I can use command-D to move mail from my inbox to a mailbox named after the month.

It does for Apple Mail what takes a couple of lines of configuration file in Mutt:

folder-hook . save-hook .+ `date +'=%Y-%m'`
folder-hook \\+/.* set mbox=`date +'=+/%Y-%m'`

(The Mail version only matches INBOX and +/INBOX boxes, though, since in actuality those are the only ones I ever evaluate the save-hook from.)

Mutt’s save-hooks let me automatically file mail according to any characteristic of the mail I want. It’s perfect when I want certain pieces of mail to be high-priority enough to be dumped into my inbox, but don’t want them saved along with the rest of my mail (say, if they are sent to a mailing list). It’s a bit like Eudora’s ability to specify that certain rules should only apply when manually filtering. Apple Mail has an “Apply Rules” menu item, but there appears to be no way to specify that certain rules don’t get applied automatically.

Thankfully, Apple Mail is reasonably scriptable. The obvious handler for selected messages doesn’t work, for some reason; when I try to extract the mailboxes from those messages, despite their being the exact same mailbox, they don’t test as equal to the two inboxes I want to check for. So I just grab the selection out of the frontmost mail viewer explicitly.

Otherwise, the only other painful part was ensuring that some message was selected once the mail was moved; I had to do that with accessibility scripting (hit the down arrow key, after spending 10 minutes figuring out what key code that was).

Still, scripting the Mac is a lot nicer than it used to be. Here’s hoping whatever eventually replaces AppleScript will deal with the terminology messes once and for all.

I want…

I want I want I want.

Either that, or I buy a desktop G5 this summer and try to figure out some way to get it to school with me (with the approval of the powers that be). More screen space == good.

Photography in Australia

The main reason I bought a new camera (Canon PowerShot G6) last month was to document my trip to Australia. My family is not getting any younger, and the land around my mother’s family’s place is changing hands pretty fast. Every other time I’ve visited, I’d never taken any pictures, so it was like having an entire part of my life that wasn’t documented anywhere.

I decided to record everything in RAW format with 1600×1200 JPEG previews, mainly because I’m such a bad photographer that every bit of adjustment I can do on the computer helps. Some observations:

I don’t regret my camera purchase at all. Yeah, the comparable Sony has slightly better image quality, faster autofocus and a competent movie mode, but it hangs for 15 seconds while it writes a RAW and I’d have had to buy a Sony flash to talk to the camera. A DSLR would have been too unwieldy for my purposes, though I imagine I’ll get one eventually.

I don’t regret getting an external flash, either. I never had to worry about redeye or unevenly exposed indoor photos.

The bag my mother bought me makes a great camera bag, though it doesn’t seem to be designed for that. It’s not padded on top, but the large pocket holds the flash and camera like it was designed for them.

While I was in Norway, I had to take my Coolpix 950 out of my fanny pack and the camera bag inside it; for that reason I missed quite a few nice photos, especially on trains. In Australia, my camera bag lived on my hip about 90% of the time, and the mesh pocket (which I see was designed to hold a water bottle) did a good job of holding a spray-on sunscreen bottle too. Did I ever need sunscreen—I got pretty badly burned on several occasions because of my lack of awareness of the sun.

The Canon’s battery pack (and the higher-capacity third-party version I have) really lasts a long time compared with the NiMH AAs I used on my Coolpix. Since a 1 GB card only holds about 150 RAW images, and the battery’s good for many times that, I never had to worry, but I bought a spare battery in any case.

I should remember that my camera has a remote. I used the self-timer for a photo in my grandmother’s dining room, but it took a lot of effort to set up. I still missed getting one of my cousins in the picture (sorry, Julian!)

A lot of people don’t like being photographed; I need to be more careful about offending them. However, I think I should have asked for people to stop and let me take more photos of scenery, especially around Dorrigo, instead of feeling like I was intruding—the countryside doesn’t get offended. The fog didn’t help when I had a change of heart and decided to get some photos *sigh*.

iView MediaPro kicks ass, and makes dealing with lots of photos incredibly easy. But you already knew that. I ran into a few small bugs: it doesn’t recognize the orientation on .CRW files, it doesn’t automatically delete the associated .THM files when importing and deleting the .CRW files (after which the camera thinks you have lots of questionable photos on the card), and when the camera writes out a zero-byte RAW image (why?), it complains it is out of disk space when trying to import it. The latter two might be Image Capture bugs; I haven’t had a chance to isolate them. I wish the slide show were more responsive on my aging PowerBook when dealing with 7 megapixel JPEGs.

Photoshop’s Camera Raw plugin is a gigantic, vast, huge improvement over Canon’s RAW converter. Don’t even think about using the latter if you have a machine the speed of my PowerBook G4/800; Canon’s converter takes several seconds to redraw the preview when you change a parameter, versus Camera Raw’s virtually instant feedback. Once every 50 photos or so, Camera Raw would hang Photoshop while opening, and it annoyingly flickers the cursor when you’re holding down a modifier key, but it’s otherwise great software. Instead of using Photoshop to browse the folder directly, I set iView MediaPro’s default image editor to Photoshop and Option-clicked each image in turn. For those RAW images I wanted to keep, I set a label. One of these days I should write an AppleScript for iVMP that deletes all the RAW images in a folder that have JPEG equivalents, but don’t have the “Keep as RAW” label.

When you’ve got 600–800 MB of photos to offload, USB 1.1 is very very slow, and your 40 GB hard disk doesn’t seem so big any more. I had given my CompactFlash PC Card adapter to my mother with my old camera, but even with it, it wouldn’t have been speedy. FireWire and USB 2 readers are available. but if you’ve got a machine with a CardBus slot, even faster is a CardBus CompactFlash reader such as the Lexar ($38 shipped from NewEgg), typically cheaper than the identical Delkin card. Both are equivalent to the ASKA SPEED OVER !! CF32A—even if you don’t read Japanese, take a look at that page, as it includes lots of benchmark information, even Mac-specific benchmarks which I was astonished to find. (Or at least laugh at the picture at the top—“speed over”, get it?)

Unlike the 16-bit PC Card equivalents, the ASKA and its derivatives require additional drivers on Windows and Mac OS X. Lexar doesn’t give any indication that they sell this card on their Web site, and the driver download Web site whose URL is on the back of the card doesn’t mention it either. They provide a 1.0b5 driver on the included CD (entitled “CF32L” where I assume the L is for Lexar), but this driver caused my Mac to hang and finally freeze when I tried to eject the card. Delkin distributes a 1.0 “CF32A” driver, and ASKA themselves distribute a CF32A 1.0.1 version, which fixes the hanging problem for me. The cards use the same PCI vendor and device IDs, so the drivers are interchangeable, but make sure to delete the CF32L driver from /System/Library/Extensions if you’ve got it installed, before you install the CF32A driver. Unfortunately, none of the driver versions support dynamic unloading, so you’ll have to restart after installing if you had an old version.

Photos from the first few days of the trip are here; I’ve still got a lot of work to catch up on, but I’ll eventually convert, caption and post the remainder.

I really need to learn more about photography. My experimentation in manual mode was somewhat effective, but I’m still suffering from a lack of knowledge. I bought a cheap-ish travel tripod (after about five hours of research) and plan to get a wide-angle lens converter and some filters in a few months, as well as doing a lot more reading and experimenting.

All I’ve done since getting back is research, email and IRC, errands, eating, sleeping, and exercising: not much to talk about, although I’m very happy to be productive and writing another paper. As usual, I’m getting feature requests for Pester and ICeCoffEE that I’d love to satisfy, but until my typing ability lets me work more than eight hours a day, I’m not going to have time for them.

Merry Christmas!

Merry Christmas, everyone! I’m off to the airport… back on January 14.

Convincing programmers to use better tools

Philip J. Eby: I’m just not evil enough. I’ve been continually frustrated in my attempts to convince other people to use better tools—they seem to think most any time invested in learning to use tools won’t be recouped in productivity, or they just want to get their work done now without regard to reinventing the wheel or maintainability. Strikes me as rather short-sighted, but then again, I’m not the most productive programmer in the world. Using poor, buggy, or inconvenient tools just slows me down a lot, and increases my general frustration and annoyance level. I’m just glad I’m not alone!

‹ Newer Posts  •  Older Posts ›