So… I play World of Warcraft on both my laptop and on my desktop. I want something to keep the addons and settings in-sync (particularly Auctioneer and Outfitter data)… I’d been contemplating setting up a Subversion repository to hold the data (`svn up` before play, `svn commit –message=”I like cheese.”` after play) but I thought that’d be a bit like stomping on an anthill with a meteorite. As well, the Auctioneer data can get a bit big, and I didn’t particularly want the expense of committing it whenever I closed World of Warcraft down.

Thus I opted for something a bit lighter-weight. I shared out my World of Warcraft directory from my desktop, and then considered how to auto-pull the data from the desktop to the laptop when it was available (and push it back when complete).

Silly me, I opted to try using AppleScript, as I really never had a chance to play with the language before. It should be easy, though, right?

Infuriatingly easy.

… Right?

I managed to get the Mac laptop to mount the Windows SMB share in about 10 minutes of toodling about; and I figured with that the hard part was over. I mean, after that (and it was fancy, too! If it was already mounted it didn’t try again, and it caught mount failures properly and errored out.) all that was left was to:

  1. Copy files from the share to the local World of Warcraft directory before launching World of Warcraft.
  2. After World of Warcraft terminated, update the files on the share with those from the local copy.

These here (for any of you out there who don’t happen to be programmers) are trivial points.

I couldn’t get it to work. Three and a half hours later, here I sit — the AppleScript thrown out the window and very little chance remaining I’ll ever try to do anything with the language again. I mean, what is the right response, when all you can get out of the language is messages like “Can’t make class cfol of application System Events into the expected type.” and “Can’t make some [sic] data into the expected type.” and finally “Can’t make some [sic] data into the expected type file alias.”

It shouldn’t be any more than:

duplicate sourceFile to destinationFolder

… which is what all the examples that I can find display. None of them mention “class cfol” or “some data” error messages. I have no doubt I’m missing something stupid (I’m wondering if it has to do with the source folder being on an SMB share? But that doesn’t make any sense, because what is the sense of the abstraction done by the OS if a scripter has to worry about such things?), but Apple has thoroughly outsmarted me. I haven’t a clue what it is.

Nor will I ever. I’ll leave AppleScript to whomever Apple has targetted it at (Soccer Moms? Grand-Parents? Geriatric Patients?) and stick with BASH.

At least then there’s a good ol’ `cp` command that doesn’t screw around and just lets me copy a file (-f for overwrite, even! The future is here, today!).

Yeah, yeah, call me a quitter if you like. I admit it… I’ve got a dread fear that cfol will delete my home directory if I push it too far.

Leave a Reply