Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Language Guide / Part 2 - AppleScript Language Reference
Chapter 4 - Commands / Command Definitions


Data Size application command

A Data Size command is a request for the size, in bytes, of the data of one or more objects. The value returned is the size of the data (a value) that would result from a Get command on the same object or objects.

SYNTAX
data size of referenceToObject [ as className ]
PARAMETERS
referenceToObject
A reference to the object or objects whose data size is to be returned.
Class: Reference
className
The class of data for which to determine the size (see "Notes").
Class: Class identifier
Default value: The default value class for the object
RESULT
The size, in bytes, of the object or objects.

If the referenceToObject parameter specifies a single object only (such as word 1 or the last word), the result is a single integer that specifies the size of the object in bytes. If the specified object doesn't exist, for example, if the reference is word 12 and there are fewer than 12 words in the specified container, the application returns an error.

If the referenceToObject parameter refers to more than one object (such as the words whose first letter is "B"), the result is a list of integers. The first item in the list is the size of the first object specified, the second item is the size of the second object specified, and so on. If the specified objects don't exist, for example, if the reference is the words whose first letter is "B" and there are no words that begin with "B", the result is an empty list.

Class: Integer or list of integers

EXAMPLE
set theSize to the data size of paragraph 1 through 10
NOTES
As described in the definition of the Get command, the data of some application objects can be returned as values of different classes. Because the size of the data returned as different classes can be different, the Data Size command includes an optional class parameter that allows you to specify the class of the data.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996