Sunday, August 23, 2009

AppleScript And Piano Scales

I'm occasionally amazed that I'm progressing right through this tutorial on AppleScript without many major problems. I've only had one sample script I couldn't resolve all the bugs eventually. Finally, in the interest of moving on I had to give it up and admit defeat, temporarily. As a matter of fact, I stopped working the problems to write this entry because I got too excited about finally catching on to a section that took a while to get through.

I've wanted to do this for a long time, but I didn't have the tools I needed to get started good previously. The fact that everything I need to do this scripting bit comes with the Mac operating system, and if something is wrong it's not because i haven't downloaded the right library or whatever. Another decisive factor, I think, is how the industry has moved along and every aspect of computing seems much easier. More and better organized tutorials for about anything a person wants to study shows up constantly.

One of the reasons I've wanted to learn a scripting or programming language is because I suspect I've got just the sort of mind that it takes to address the kind of problems a coder might run into. A lot about the reason I feel this way comes from my love for doing expert level crossword puzzles without resorting to external reference materials, and in ink. It's true. I give myself airs about this, but I gotta, it's part of the deal. Faking it until I make it has held a time-honored place in my personal Hall of Fame.

Some people get obsessed over details. I'm not as obsessed as some people I've encountered during certain pursuits or sojourns or quests. I would be if I had the drive, but I'm very comfortable with my lack of ambition. In fact, my real challenge is to find out just how little I can get by on or with. Avarice. Miserliness. According to the Enneagrams, that's my chief negative feature that I hae to overcome if I wanna go to heaven... or something.

Another facet of learning to code a little bit is that programming is about binary systems. The I Ching is a binary system. Yin and yang. I spent three decades mastering that system, and even then, nobody does or can know that but me. The only way I'll know if the binary system I learned from the Yellow Book is the same binary system as in digital computing systems is for me to learn to write code and see what happens.

I think learning AppleScript might be the best of both worlds for me in the sense that it employs Modern English as much as currently possible, but I'm also thinking about my belief that the way to get word recognition programs to work is to teach people to speak in a manner the machines find more relevant.

It's kind of like in the Drama and Speech classes I took in college. To become an actor that could play a lot of different careactors the drama student has to take speech classes to neutralize their native culture's way of speaking. In the United States acting students are taught that neutral way of speaking is a mid-western accent, and from that neutral zone they can adopt to any regional accent that features English.

AppleScript seems to be about half-way between numbers and words and allows for a person skilled in one to make do with the other. If a person is talented with both words and numbers they got entirely different options. I've tried to balance my preference for words out by laboriously struggling to acquire better skills with numbers, and maybe that's what I'm doing with this current effort to learn some semblance of a computer language.

I just did something I've wanted to do all along. I changed an existing script designed to get one result on another computer that has an application that's not on my computer to a script I can use on my own computer with the applications I have on it. I turned a script designed to open a URL in the tutorial to opening this blog site at the click of a button on my desktop.

I figured at first that learning how to get the right addresses for the basic applications I used on my computer might take a while, but the guys who wrote the tutorial anticipated my needs, and demonstrated how to get that information to make the scripts work locally. In fact, most of the targets on my own computer that have their own names that are different from the given examples can be elicits with one or two commands, and they can be copied and pasted with a couple of clicks.

The online tutorial I'm using doesn't allow me to copy their scripts in order to paste them into my Script Editor to see if they'll work. I have to type them in manually. It's not unusual for me to make several typos in the process. Contrarily, having to type all the code in by copying it word by word, symbol by symbol I'm learning a lot that way. A lot of it is repetitious like boilerplate stuff, and after I've typed it out so many times I've practically memorized some of the forms the content has to take. It's not that difficult to imagine that by the time I get to the end of the tutorial that's over 800 pages long (I'm on page 133) I'll have learned a lot of the fundamentals by rote.

I'm still fitting in some practice on playing the scales and some chord exercises on my digital piano. It's a great relief to turn from struggling through these scripting assignments to playing scales on my piano. Even then, however, I have to take a break and go walking just to keep from getting bedsores on my ass from sitting so long.