Tuesday, August 31, 2004

Fighting with AppleScript

While I'm waiting for some external things to get finished up for the 2.6 release, I've been tinkering around with AppleScript support. It's been kind of a rocky road. AppleScript from the developer's side isn't always as easy to implement as they tell us. In a simple case it can be easy from what I hear, but what is a simple case anyway? Supposedly some apps can do it with zero extra code. MacJournal 2.6 is entirely MVC-friendly, but I've still encountered problems. I've been able to get some things working, but other things are broken inexplicably with little or no apparent reason why. AppleScript is hard to debug: Script Editor gives you no help when something goes wrong. You end up with an error name that isn't descriptive and an error number that isn't explained anywhere. I lost a lot of time to a problem that really shouldn't have been an issue in the first place. Apple is assuming something about how I set up my application that turns out to be wrong, and now I have to work around it by adding more extra code. It's always a little disappointing whenever that happens.

The heart of AppleScript-ability lies in two well-formatted text files. It seems weird that with all the fancy developer tools they give us, a simple graphical tool to create these files weren't include. At the very least something to validate the files would have been nice because small errors can be very hard to ferret out, especially when you don't know where the problem is. Maybe something like this will be coming in Tiger with the new release of Xcode. One can only hope.

But I am optimistic about MacJournal's AppleScript support. Admittedly this is my first AppleScript implementation that I have done, so I'm hitting a lot of the first-timer roadblocks that will no doubt get easier with experience. Hopefully a basic set of features can be available for the very next version, with more features coming after that.