Previous Page
Next Page

13.3. Data

The data class represents raw data , a stream of bytes. It's a catch-all for situations when a value cannot be displayed in any other way. For example:

tell application "Finder"
    activate
    get (the clipboard)
end tell
-- {«class RECT»:«data RECT0000000000B40075»,
picture:«data PICTFA480000000000B40075001102FF0C...»}, and so on for pages and pages

Here we see a record with two items; the value of each item (after the colon) is a data object. What was on the clipboard was a picture, and the Script Editor can't display it (though Script Debugger can), so it shows you the data as a sequence of hex bytes. Evidently what we have is a rectangle (probably the bounds of the picture) and a picture resource in PICT format.

It is also possible to form a data object yourself, by typing just the sort of thing you see here: the word data, a space, and then the resource type and the data, in guillemets (« »). However, this is an advanced technique and shouldn't arise much in real life (though an example of it appears later in this chapter).


Previous Page
Next Page