Saturday, 19 June 2010

Applescript - Demo changing a file label

Files in MAC OS X can be given a label. This is a colored background in the Finder and on the desktop. There are 8 possibilities:
none, red, orange, yellow, green, blue, purple and grey

That's also the order in which the labels are shown in the Finder menu. However, when experimenting in Applescript, I found that the order seems to have been randomised when trying to change the label color programmatically.

Copy and paste the code below into Applescript Editor and try it out for yourself on a file of your choice.


tell application "Finder"
set thisItem to selection as alias
if label index of thisItem < 7 then
set the label index of thisItem to (label index of thisItem) + 1
else
set label index of thisItem to 0
end if
end tell

(*
0 = no label
1 = orange
2 = red
3 = yellow
4 = blue
5 = purple
6 = green
7 = grey
*)


As you'll see, the order of colors is not as the Filer makes you believe it is.

Tuesday, 25 May 2010

If You Open Your Mind Too Much Your Brain Will Fall Out

Lyrics of a song by Tim Minchin:

If anyone can show me one example in the history of the world

of a single psychic who has been able to prove

under reasonable experimental conditions

that they are able to read minds


And if anyone can show me one example in the history of the world

of a single astrologer who has been able to prove

under reasonable experimental conditions

that they can predict future events

by interpreting celestial signs


And if anyone can show me one example in the history of the world

of a single homeopathic practitioner who has been able to prove

under reasonable experimental conditions

that solutions made up of infinitely tiny particles of good stuff

dissolved repeatedly into relatively huge quantities of water

have a consistently higher medicinal value

than a similarly administered placebo


And if anyone can show me one example in the entire history of the world

of a single spiritual or religious person who has been able to show

either empirically or logically the existence of a higher power

that has any consciousness or interest in the human race

or ability to punish or reward humans for their moral choices

or that there is any reason, other than fear, to believe in any version of an afterlife


I will give you my piano,

One of my legs

And my wife


Thursday, 18 March 2010

Men heeft geen absolute zekerheid nodig om een atheïst danwel een theïst te kunnen zijn (of worden). Wat wel vereist is, is een aantal hele goede redenen. Zodat iemand de juiste keuze kan maken, voor eender welke richting.
Voor atheïsten is één van die redenen het onvermogen van theïsten om een goede, overtuigende casus te presenteren vóór theïsme in het algemeen, dan wel een specifieke vorm daarvan.

Theïsten, in het algemeen, denken dat zij goede redenen hebben voor hun geloofsovertuiging. Maar ik moet nog steeds een vermeend opperwezen tegenkomen dat mijn geloof waard is. Ik heb geen zekerheid nodig, dat die vermeende goden niet bestaan, om een atheïst te kunnen zijn. Alles wat ik nodig heb om niet te geloven, is een gebrek aan goede redenen. Misschien komt er een dag waarop dat zal veranderen. Maar ik draai al zo lang mee, dat ik dat ten zeerste betwijfel.