As I mentioned in the update at the end of the article, I had written on this blog, back in November 2007, "I have never found a practical way to use AppleScript in my workflows..."
That same year, 8 months earlier, I was talking about OmegaT in Tokyo. It was in one of the first editions of the "Open Source Conference", a local (Japanese) conference that moves around the country and takes place in Tokyo twice a year: "翻訳者を支えるオープンソースの翻訳メモリソフト". At the time, OmegaT did not have most of the features that make it now a professional CAT. I wanted to promote it in FOSS circles here because I thought they would be the best places to find potential developers. The strategy did not work, but that gave me a chance to meet amazing people from Hokkaido to Okinawa that I am still in touch with today.
2 years later, invited by one such person, I wrote a short presentation of OmegaT where I mentioned Applescript, it was published in issue 45 of the Journal of the "Asia-Pacific Association for Machine Translation". I put a copy here: "自由に翻訳!". At the time I was exploring ways to extend OmegaT with easy to write scripts because developing new features in Java was something I never felt I'd be able to do (I never was, and that's the main reason why I eventually left the project, last July).
The script I quote in the article is:
on run { } do shell script "sed \"s/<[^>]*>/ /g\" ~/Library/Preferences/OmegaT/script/source.txt | /usr/local/bin/pbcopy" end runNothing very Applescripty there, I'm only calling a one line shell script that removes OmegaT tags from the source segment and pasting the result into the pasteboard. This one must have been using Automator, released 4 years earlier. It was a 6 layered "machine": Key shortcut → Automator service → Applescript handler → shell script → sed process → Cmd-P.
At the time, OmegaT had no "API" or any sort of scriptability to speak of. But it supported the OSX services because the Java UI framework it used (and still uses) allowed for that (unlike other Java applications that use other frameworks less "connected", if connected at all, to the OS). Marc Prior, then project manager, invested some money to have a "source, target and selection text export" feature. The feature still exists. There are 2 files that are automatically created in the OmegaT preference folder (source.txt and target.txt) and with a shortcut (Shift+Cmd+C) you can export the contents of the selection to selection.txt in the same location.
And OmegaT did not have any sort of tag management either. What I did as a workaround (obsolete now, thanks to new developments) was create scripts that would parse the source.txt when entering a new segment that I'd use as Automator services called by a shortcut. The script would basically call a "do shell script" as above to extract the tags from the source.txt file (opposite to the above) and output them so that I could paste them in target. The first version was relatively trivial (get all the tags), then I had a more complex one where the service would call a dialog where I'd enter the tag number and the service would paste that around the selection, inside the OmegaT target segment.
It was all relatively smooth and fun to develop, except that Automator was quite slow if I remember well. Now that I think about it, I'm pretty sure that it the starting point of my Applescript coding. Considering the fact that the article was published in March 2009 I must have started developing that around the end of 2008.
From what I can see in my job archives, I was still using an ad-hoc folder hierarchy for my jobs in November 2008 while in January 2009 I was using a more structured version that I had scripted. The script was something relatively simple that took a start date, and end date, combined the 2 with the client name code and an "→" in between and created a folder with that as a name, and then a sub-hierarchy of folders where I'd put the client mail in a folder, the attachments to translate in another one, references if any, and 2 extra folders for the delivered files and the invoice. Some computer archeology shows that I was probably still saving the mails manually as RTF...
A few checks in my emails show that indeed, in 2006 I was writing to a friend "I have no idea what Applescript is" but in December 2008 I was sending a mail to the Applescript official list about word tokenization (https://lists.apple.com/archives/applescript-users/2008/Dec/msg00025.html) So, I guess all this shows conclusively that my first attempts at introducing Applescript and automation in general in my workflow date back from sometimes in late 2008.
I was writing yesterday about how I copy-pasted code from the web, but my main source of information, programmatic help and mental support came from the above mentioned and still existing Applescript User List hosted by Apple (https://lists.apple.com/mailman/listinfo/applescript-users). There is extremely little that I could have accomplished without list members' help. Which may confirm that Applescripting is not that trivial, or maybe that I'm just a little bit too thick, or maybe that I am not committed enough. In any case, (almost) 10 years later, I say as I did yesterday, that without the level of automation we have on the Mac, my professional life would not be what it is now.