applescript(
SOURCE
)
The applescript( function executes AppleScript source code and returns the result.
Parameters
This function has one parameter:
source – source code of an AppleScript program. Note: It is very convenient to use “pipe” delimiters for the source code parameter, for example |||code|||
. This eliminates needing to worry about the delimiters appearing in the source code itself.
Description
This function executes AppleScript source code and returns the result. Here is a simple example that lists all of the people in your address book.
applescript({tell app "Address Book" to get name of every person})
☞ {"Scott Frankel", "John Kuttel", "Jim Cook", "Eric Grunbaum", "Alex Lebosq",
"Chris Griffin", "Steve Zantos", "Steven Saltman", "Pat Furnare", "Bob Ferrrini",
"Cheryl Maybee", "Mark de Jong"}
Panorama formulas can be embedded in the AppleScript source code using special tags. To embed a Panorama formula, use
$«formula»$
The formulas are calculated in advance, then embedded into the source code as constants. For example, the formula $«2*3»$
will be embedded into the program as 6
. The formula $«upper("hello world")»$
will be embedded as "HELLO WORLD"
. Note: You can embed database fields, global variables, fileglobal variables, and windowglobal variables into the formula, but local variables will not work. (You can, however, use local variables with the applescript statement.)
In the case of text formulas any special characters will be encoded as necessary for a proper AppleScript constant. For example the formula $«{"}»$
will be embedded as "\“"
.
To embed a Panorama formula with no quotes or translation, use this format
^«formula»^
See Also
- applescript -- executes an AppleScript.
- blindposixscript( -- executes a POSIX shell script using NSTask and returns the process id.
- executeapplescript -- compiles and runs an AppleScript.
- executeperlscript -- executes Perl code.
- executesudounix -- executes a UNIX shell command using *sudo* (root) privileges.
- executeunix -- executes a UNIX shell command.
- info("posixtasks") -- list of POSIX shell tasks running in the background.
- perl -- executes a Perl script (program).
- perl( -- executes a perl program and returns the result (stdout).
- php -- executes a PHP script (program).
- php( -- executes a PHP program and returns the result.
- posixscript( -- executes a POSIX shell script using NSTask and returns the result.
- posixtask -- executes a POSIX shell script in the background using NSTask.
- posixtask( -- executes a POSIX shell script in the background using NSTask.
- python -- executes a Python script (program).
- python( -- executes a python program and returns the result (stdout).
- ruby -- executes a Ruby script (program).
- ruby( -- executes a ruby program and returns the result (stdout).
- scriptbglog -- specifies a path/file for output from STDOUT from embedded programs run in the background (Perl, Ruby, Python, PHP).
- Scripting Language Configuration -- configuring the scripting languages available to Panorama (Perl, PHP, Python and Ruby).
- scripttimeout -- sets the maximum runtime allowed for an embedded program (AppleScript, ShellScript, Perl, Ruby or Python).
- shellscript -- executes a UNIX shell script.
- shellscript( -- executes a UNIX shell script and returns the result.
- stopposixtask -- stops a POSIX shell script that is running in the background.
- usebashprofile -- grabs the search path from the `.Bash_profile` file in the user's home folder, so that these paths will be used by scripting languages (*Ruby, Python*, etc.).
- xcallbackurl -- performs an action in another application using the x-callback-url mechanism.
History
10.0 | No Change | Carried over from Panorama 6.0. |