DekGenius.com
[ Team LiB ] Previous Section Next Section

13.11 Data

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

tell application "Finder"
        activate
        get (the clipboard)
end tell
-- {«data RECT0000000000B40075», ¬
        «data PICTFA480000000000B40075001102FF0C—... and so on for pages and pages

What was on the clipboard was a picture, and the Script Editor has no way to display it (though Script Debugger can); so it uses the data class and just shows you the data. The first four letters of this data can be informative, because they represent a resource type; clearly what's on the clipboard is a rectangle (probably the bounds of the picture) and a picture 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 was shown earlier in this chapter).

    [ Team LiB ] Previous Section Next Section