You are not logged in.
The Corleone family, Scarface, the Sopranos. They all have one interesting skill in common: the power of persuasion, also known as 'coercion'. In this edition of unScripted, I'm going to expand on our previous lesson in data types and show you how to take one bit of data in its original form and make it an offer it can't refuse by coercing it to another type of data.
The fact that the word 'as' does all the dirty work for us in the dark underworld of coercion is as pleasingly powerful as a garlic-rich canolli. This one simple word lets an AppleScripter bend just about any poor value to his or her will.
Let's look at a couple of examples. In the illustration below, I've set up a variable containing a date. If you'll remember, the result pane is going to show us the result of the *last command* in our script. In this case, the result is a value of the date data type. We know this because of its structure: the word 'date' followed by a special string in a very specific format including month, day, year, etc.
T.J.
tj@tjmahaffey.com
Offline