AppleScript Context [AppleScript]AppleScript Program[/AppleScript]
Executes the AppleScript contained in the context and displays the results.

To embed the results of an AppleScript into one of your pages, put an AppleScript context into a template. The AppleScript program contained inside the context is executed, and any returned value is displayed in place of the context. Any [xxx] tags inside the context are first substituted for their real values before the AppleScript is executed.

Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):

[AppleScript]if [random]>50 then return "it's more than 50!"
else return "it's less that 50!"[/AppleScript]

In this example, the tag [random] is first substituted with a random number, then the resulting AppleScript is executed. Any WebDNA [xxx] tags are allowed inside the AppleScript program, even if they represent complex lookups or searches. The WebDNA tags are always evaluated first, and the resulting text is then executed as an AppleScript program.

Caution! AppleScripts have complete access to your hard disk and all programs on your web server. You can write an AppleScript that erases the contents of your hard disk. Do not worry: remote visitors to your web site have no way of executing their own AppleScripts remotely. They can only execute an AppleScript inside a template file that you have saved on your web server's hard disk.

User Contributed Notes

Copyright © 2008 WebDNA Software Corporation, Inc.