DO_APPLE_SCRIPT

The DO_APPLE_SCRIPT procedure compiles and executes an AppleScript script, possibly returning a result. DO_APPLE_SCRIPT is only available in IDL for Macintosh .

Calling Sequence

DO_APPLE_SCRIPT, Script

Arguments

Script

A string or array of strings to be compiled and executed by AppleScript.

Keywords

AS_STRING

Set this keyword to cause the result to be returned as a decompiled string. Decompiled strings have the same format as the "The Result" window of Apple's Script Editor.

RESULT

Set this keyword equal to a named variable that will contain the results of the script.

Example

Suppose you wish to retrieve a range of cell data from a Microsoft Excel spreadsheet. The following AppleScript script and command retrieve the first through fifth rows of the first two columns of a spreadsheet titled "Worksheet 1", storing the result in the IDL variable A:

script = [ 'tell application "Microsoft Excel"', $

           'get Value of Range "R1C1:R5C2" of Worksheet 1', $

           'end tell' ]

DO_APPLE_SCRIPT, script, RESULT = a

Similarly, the following lines would copy the contents of the IDL variable A to a range within the spreadsheet:

A = [ 1, 2, 3, 4, 5 ]

script = [ 'tell application "IDL" to copy variable "A"', $

           'into aVariable', $

           'tell application "Excel" to copy aVariable to', $

           'value of range "R1C1:R5C1" of worksheet 1' ]

DO_APPLE_SCRIPT, script

See Also

Chapter 2, "Operating System Access" in the IDL Advanced Development Guide .

"Macintosh-Specific OS Abilities" on page 1-35 of the IDL User's Guide .