WD: AppleScript Example: Data Size Command

Last reviewed: February 3, 1998
Article ID: Q125583
The information in this article applies to:
  • Microsoft Word for the Macintosh, version 6.0, 6.0.1, 6.0.1a
  • Microsoft Word 98 Macintosh Edition

SUMMARY

The information in this article discusses the following AppleScript event:

   Data Size

This event is found in the Core Suite of Word's Event Dictionary.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/ 

The Core Suite contains events that a program should support to facilitate easy, intuitive communications between the application and the system software. System 7.0 was the first operating system to support these events.

The Data Size command is used to get the size, in bytes, of an object. The result is displayed as an integer in "the result" window of AppleScript.

   Data Size of 'something' [as 'type']

      The As argument tells the Data Size command which data type to
      calculate the size for.

      The seven basic data types in AppleScript:

         Strings
         Numbers
         Integers
         Real Numbers
         Booleans
         Lists
         Records

NOTE: The Data Size command cannot use some of the data types listed above. The valid data types for the Data Size command are:

         Strings
         Real Numbers
         Lists

Example

The following AppleScript script sample gets the data size, in bytes, of the selected object. This script does the following:

  1. Opens the document named "MyWordFile".

  2. Selects the first paragraph in the document.

  3. Uses the Data Size command to get the size, in bytes, of the selected object.

tell application "Microsoft Word"
   open "MyWordFile"
   set selection to paragraph 1
   data size of selection as string
end tell


Additional query words: Apple Script datasize
Keywords : kbmacroexample macword word6 kb3rdparty kbcode kbmacro kbprg
Version : MACINTOSH:6.0,6.0.1,6.0.1a
Platform : MACINTOSH
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 3, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.