You are not logged in.
I want to get back to the original purpose for this column: teaching beginners how to write AppleScripts. With that in mind, let's get started.
This month, we're going to explore data types. Data types are simply the form in which information is returned from AppleScript commands. They are important because they are the key ingredients in any AppleScript recipe. As an AppleScript chef, of sorts, you'll need to know what sort of ingredients are called for in any given dish. If you use the wrong ingredient, your souffle falls or your cake might taste downright bad. Passing improper data types is another key mistake most beginners make which creates great frustration in an otherwise talented chef.
For example, when using AppleScript to place an image into a picture box in InDesign, you'll need to know what sort of data you need to pass to InDesign within the command so it can properly execute the command. This data must come in a particular form, or data type. If the data passed to InDesign in this command isn't in the proper form, your script will throw an error stating "... unexpected type". If a command requires a file reference, it wouldn't do any good to pass a boolean value of true or false.
A general list of possible data types includes:
Most all of the information you'll work with in your AppleScript recipes will come in one of these forms or another. Let's go down the list and I'll give you some examples.
First in our list is integer. Easily enough, this data type is simply a standard number like 3, 76, 983. The same goes for a negative number like -3, -98, etc.
I know this an old post, but was very helpful! Thanks
How do you determine the data type of an existing variable if you do not already know what type is?
Last edited by jsherk (2012-03-07 11:27:19 pm)
How do you determine the data type of an existing variable if you do not what it already is?
I think a verb in your question is missing so it's hard to understand what you mean