In my continued pursuit of the illegitimate programming language of AppleScript, I’ve banged my head against the wall for nearly 3 hours again.
Updated 2015-01-15 See Addendum
A friend sent me a list of people in an Excel spreadsheet, a la:
Mark | Twain | 123-456-7890 | mark@twain.tld |
Elwin | Ransom | no phone number but friend on facebook | |
Albus | Potter | albus@the-potter-family.tld |
and on and on for about 25 rows. The table came with some intent that I should send a text message to every one of these people to coordinate an upcoming event.
I hold no ill will towards this person, in fact, I think the table format is appropriate. But holy smokes was this a nerd snipe moment.
Could I manually go down this list, enter the phone number, and construct a text message? Sure. But that is automated work and I’m a developer. I should be able to automate this with some fancy dancy Apple Script to send a text message mail-merge style.
several weeks later, this:
Addendum, 2015-01-15
I want you to notice something about that text there. At the end of some lines is an extended character set character ‘¬’. I’ve had to vim-yank it down to this paragraph because apparently the wonky apple keyboard combination that they’ve wired up doesn’t appropriately forward through and ssh connection into vim as something that is immediately printable. In fact, it seems to instead add a new line.
I was, at least initially, rather impressed that they’d chosen to use a character other than the \ to escape a line ending. Memories of VBScript flashed in detail.
But there comes a time in a programmers life when they realize a couple of things about parsers. First, there is a character at the end of each line already…it isn’t really necessary to require an “end of line” character. The
AppleScript, in a fantastic demonstration on the evolution of parser design in the last decade, has chosen to require escaping the line ending. Additionally, they’ve chosen to require a special purpose line ending escape character, which isn’t traditionally typeable from the classic keyboard.
YMMV