Well, I’m an expert in being a non-expert, I suppose.
Where I started was, what are the tiniest things I want to automate just because I’d get something out of Bending the Computer to my Will and letting it do something I want it to do and it doesn’t out of the box. Think of the things that frustrate you as a user, where you think ‘I wish my Mac would just go and do this without being asked’.
The big thing that I love about the Mac was there’s a sense of being allowed-to-tinker that I never felt I got with Windows, so you can get it the way you want it, it’s forgiving, and you can choose what you want to do without it being channelled towards ‘you want to do something it doesn’t do out of the box, buy a product!’ the way Windows is.
A very good place to start, especially if you want to do stuff with your audio files, is Doug’s Applescripts for iTunes http://dougscripts.com/itunes/index.php: as a complete beginner, you can look at simple examples that aren’t too overwhelming, and will give you that all-important sense of ‘I can use iTunes to do things it doesn’t do “naturally”, even by writing a few lines of simple code’.
The thing I’m proudest of doing so far is learning how to fiddle with the details of an audio CD on iTunes so it does what I want it to do. The way iTunes stores CD details is in a database called CDInfo, and that’s what does the magic behind the scenes when you insert a CD your Mac knows about (or you connect to CDDB and it knows about that). This database seems to be just a bit fragile at times, especially if all your audio (like mine which is audiobooks, some ripped from CDs and some from CDs I burned myself from tape or Audible) doesn’t fit the pattern of ‘Songs from an Album’ which it expects to see. The most brain-dead thing it does is ‘every time you insert a long single-track CD, it puts in the tag metadata (ID3 things, which are what iTunes looks at for album/artist/whatever) for the last long-track CD it saw’. This really freaks people out, incidentally: the Toast forums are full of people who get scared when Toast pulls in junk metadata from CDDB this way. It is also fragile and occasionally breaks on its own, to the extent that occasionally I put in a CD and it doesn’t register until I delete the CDDB file and start again. And, of course, the way CDDB and CDInfo work involves looking at track lengths at the fraction-of-a-second level, because even if everything is in three-minute tracks the pattern of exact lengths are different. Except when they aren’t. Doesn’t happen often, but it’s annoying when it does (and one audiobook CD publisher in particular does exact five-minute tracks not broken for sense and pauses, which tend to get the wrong info entered on CDDB).
Is this a commercial project? No! Most people don’t have more audiobooks than they do music! The nearest I could find on the Internet to a program that did what I wanted it to do was a program called CDInfo, which works with the CDInfo database. The snag with that is if your CDInfo database pulled in junk data by getting confused about a CD or downloading the wrong info from CDDB, you’re then working from the wrong information.
So I made CDInfo write out the album details into an XML file, and did my best to learn about how to use XML from Applescript (which involved, for me, pretty much finding out about the DOM for the first time; if you’ve ever done anything with XML before that sort of step will be easier. If I could do it, however, any fool could). I was using XML, incidentally, because my boyfriend (a Windows programmer) pointed out that it’s ‘a better text file’ because you don’t have to interpret it in a line-by-line freeform way.
Now, if I insert the CDs of an audiobook, I can set the details once at the beginning for the things which stay the same, number all the tracks absolutely rather than by CD, and then write all that info out to an XML file (including the track durations down to fractions of a second, remember, because iTunes knows about that). Then I’ve got that information on file, so if iTunes ever loses its CDDB info again, I tell it which audiobook the disc belongs to, and it trots off and looks up the information in the XML file. Then it does what CDInfo and CDDB does, tries to match the durations with the durations of a CD ‘on file’, but I’m telling it to match against ten CDs belonging to that book, not ‘every CD ever inserted by me’ or in the case of CDDB ‘every CD ever inserted by anyone, ever’. And as for why the XML stage, it’s an attempt to keep the data clear of CDDB in case CDDB goes wrong again.
Am I telling you this because it’s something you might want to do? No! I’m telling you because it’s an example of somebody with about 0 coding experience learning how to do what they want as about their first coherent Applescript project (in the sense of ‘has its own data rather than just sticks two apps together’). I learned going along. And before I learned how to do that, I practiced sticking two apps together in even shorter programs.
And considering how I used Windows for about 20 years, including various attempts to learn Delphi, VB or VBA, and never once got the sense that I was allowed to tell my computer what to do, I feel that’s enough of an instance that the Mac works the way I think more than Windows does. Especially since my help was simply asking questions of a single mailing-list: I’ve never even met anybody who’s ever used Applescript. Doug never even responded to the stupid questions I sent him in e-mail (he’s a busy man, and had already given me loads of help by putting the site up), which means I not only had no-one to talk to locally, but had almost no help with the iTunes specifics other than what I could figure out by looking at code examples. All my own work, such as it is. If I can do it, anyone can.
So think about the things that frustrate you as a user, and in particular the things that have no commercial application whatsoever, so you’re unlikely to find that somebody else has done the work and you can buy it, then code from that. Take it slowly. Make it modular as far as possible (stick different bits in handler functions at the bottom of the file, so if it goes wrong you can look at one thing at a time).
Model: Mac mini G4
AppleScript: whatever’s in Tiger
Browser: Firefox 126.96.36.199
Operating System: Mac OS X (10.4)