17 November 2006

Google Earth KML Date Formatting

I am just building stuff using Google Earth, especially the new time stamped stuff. Very nice, really.

However GE expects dates in the format 2006-11-17 which isn't so bad in itself. It's AppleScript's fault that it is a pain to format dates other than the system's preset. You just do a

set dateString to (year of theDate) & "-" & (month of theDate as number) & "-" & (day of theDate)

and there you go. Nevertheless GE still choked on my formatted dates: 2006-9-5 can't be parsed by Google Earth. The leading 0 is mandatory!? WTF!?

Well here is the solution:
on format_date(theDate)
tell theDate
set y to year as string
set m to (month of theDate as number) as string
if (count of m) is 1 then set m to "0" & m
set d to day as string
if (count of d) is 1 then set d to "0" & d
end tell
return y & "-" & m & "-" & d
end format_date

Script Friday: Keynote Slide Sets

I do a lot of presentations. I put together various slide decks on the different topics and then depending on the event, customer and time available I skip and reveal a different subset of slides. If I want to keep track of which slides I showed where then all I can do is have multiple copies of the same Keynote Presentation. Which is a pain, because say I want to change the content of one slide from say "October 2006" to "November 2006" then I have to remember which copy is the most current or do the change in all copies.

Wouldn't it be great if I could store multiple slide sets in one Keynote Presentation?

Keynote 3 introduced AppleScript support. Though the implementation is... er... special, it is surprisingly adept to this task.

Use the notes area of the slide to store the skipped/shown status of a slide. Decide on a name for your slide set. For Slides that should be shown in this Slide Set add a line with <Slide Set Name> to the notes. For slides that should be skipped add <Slide Set Name skip>. Obviously if your name ends in "skip", you're in deep trouble. I used the <> as markers, change the scripts if that bothers you. If a slide has neither in its notes the script will leave it unchanged. This way you can have different slide sets for different topics and the won't affect each other.

Then show all slides (or change the skip/hide setting of slides in some weird way) run this script, enter the name of the set and enjoy.

Restore Slide Set

Ok, so this manually setting the markers in slides will get tiresome really quickly. So I wrote a script to store the current slide set, run it, give a name for your slide set... wonderful.

WARNING: the way AppleScript (or specifically Keynote's implementation) handles the notes field means that when the script has to change the notes field ALL rich text formatting will be lost... :( If you don't like that, you will have to add the markers manually.

Save Slide Set

If you are bored of a certain Slide Set, you can remove the markers again:

Remove Slide Set Tags

This opens up a whole bunch of possibilities. You could have one Slide Deck with three slide sets, one for 25 minutes, one for 50 minutes and one for 100 minutes. Let's call them "Hurry Up!", "Standard" and "Detailed". Now before a presentation you could choose the proper slide set and go. However we all know how these things go. Sometimes you get a lot of questions on a certain topic and you would actually like to be able to dig deeper into this. So you could drop out of presentation mode, change the slide set to detailed and continue. Then after you are done with this topic you switch to the "Hurry Up!" set to make up for lost time. To make this easier, use "pre-canned" scripts with the marker name built-in.

Standard Set

I use Salling Clicker to switch on-the-fly, in presentation mode using the cell to execute these scripts. Unfortunately Keynote doesn't allow you to modify slides in the background using AppleScript, so the scripts will actually drop presentation mode, do their stuff, then resume presentation mode. It is a brief but ugly flash of your desktop on the screen. However I think the pay off is worth it. You should be able to assign these scripts to a HotKey Manager or other way of executing them, I leave that as an exercise for the reader.

Please let me know how you use these.

15 November 2006

Xserves!

This is important to me, mainly for business. Still: YAY!

(Late) Script Friday: Fading Terminal Windows

This script was inspired by the scripts of Erik Barzeski and Daniel Jalkut.

What the script does is watch your Terminal Windows and if they are busy doing some important process it will slowly fade them into the background (increase the transparency). Once the process is complete (or if you quit the watcher), it will set the transparency back to normal.

Note: there seems to be a bug in Terminal scripting, so that changes in transparency only register when there already is a transparency set in the background color, so you have to set at least a minimal transparency for your default windows. (Move the slider in the Windows Preferences just a tick or two, you won't see it but then everything works fine.)

Some people (like my wife, believe it or not, she uses Terminal) might find all that fading and transparency is distracting. So especially for you (well, her, actually) I wrote a version that will minimize the window instead. (I find that all those windows zipping about are worse than fading windows, but she is a biologist and the stuff she invokes from the command line usually runs for a long long time, so I guess that "ghost letters" on the desktop might be distracting.)

Download the scripts here.

Swamped

I'm still here... around... somewhere....

Very busy lots of work. Be back Friday with a neat script.

02 November 2006

Perceived security

The Boarding Pass Brouhaha is a great summary of the recent fall-out concerning boarding passes. So many of the security measure introduced since 9/11 are just give you the perception of security.

One solution to this particular problem would also be to not give the passenger the option of printing the boarding pass at home. You could still check-in early, securing your seat, but not print the boarding pass. Once you are at the airport, you can print the boarding pass at the machines at the airport. I already do that when I'm on the road and can't print. If TSA only accepted the machine boarding passes, easily recognized by the paper, then it would be much more difficult to forge a boarding pass. Still not impossible, but right now the authenticity of the boarding passes is laughable.