My First Bit of Programming in a Long Long Time

The last time I did any computer programming was back in the days of Basic. I don’t even really remember much about the programs I wrote or worked on. I know that we used to get some magazine that had code in it and you would type it in to make basic programs. Often, my Dad reminded me, there would be bugs in the code and, unless you figured it out, you had to wait for next months issue in order to get the program to work.

It’s all very fuzzy to me know, all so long ago.

So I’m just a bit proud of myself for figuring out a small Applescript programming issue that I came across when trying to set up GeekTool to display my current iTunes information. Basically, I found a decent script and set of instructions at Keynote2Keynote.com, but the thing is that I tend to listen to a lot of RadioParadise and SomaFM, and when I ran the script while running a streaming radio station, the artist and track information wouldn’t show up. Doing a little research I discovered that you needed to include the instruction “set stream to the current stream title” in the Applescript in order to capture the streaming song title & artist.

All fine and good, except that if I simply added that to the “set” list in the script, I would get a “missing value” whenever I was playing songs from my library, and blank values for the artist and album whenever I was listening to the radio. So, after a bit of trial and error, I was able to edit the original Keynote2Keynote script slightly. So, instead of

Picture 1 I have

Picture 3

So yeah, it’s only 2 lines of additional code, and “if . . . then” statements are pretty understandable to anyone who’s done any kind of programming, even if only Basic and 25 years ago at that! But I did figure out the syntax for setting artistName to a null value and so I’m taking a small bit of pride at solving the problem.

In the end, I also ended up taking off the words “Track,” “Artist” and “Album” from the final script, so it simply reveals the track, artist and album if local content: Picture 5 

or the radio station and the streaming info if radio: Picture 9 

Here’s a full screen shot to show it in context:

  Picture 1 21-02-43 

I”m sure this isn’t all that exciting to many of you who don’t care about programming and to those who do, it’s a pitifully small accomplishment, but still and all, I’m rather pleased with myself.

Technorati Tags: , ,

On this day..