Along with the reserved words defined by FScript and Cocoa, Daylite adds a few reserved words of its own.
- objectContext: Available in all execution contexts. Represents the gateway to all data available to the app. See methods defined in DLPObjectContext.
- document: Available via AppleScript, DistributedObjects and Direct Scripts. The Daylite subclass of NSDocument and the bridge between the UI and data.
- selectedObject: Available via AppleScript, DistributedObjects and Direct Scripts. Assumes that the user has selected one of more objects in the main window. Those objects will be a subclass of MCPObject.
- globals: Available only in PDF Reports and Interactive Reports. A mechanism to share variables/data between the FScript execution contexts within the same report and with the template language.
- baseURL: Available only in Interactive Reports. Represents the unique URL of the report and used to navigate (drill down) to other pages of the report.
- token: Available only in PDF Reports. Represents the (blue) token in TextAreas. You can manipulate the token itself using this identifier, notably setting a URL on it.
- element, reportElement: Available only in PDF Reports. Represents the actual report element the script is tied to.
- object: Available only in PDF Reports. If not nil, represents the object used for the element, typically the object that a report table row is tied to.
- objects: Available only in PDF Reports. If not nil, reports the objects on the element, typically a report table.
- userInput: Available only in PDF Reports. If not nil, represents the user's input. It's an instance of a dictionary.
- arguments: Available only in PDF Reports. A dictionary. Arguments passed to the report generator.
- generator: Available only in PDF Reports. The object that drives the PDF generation process.
- argument: Available only in AppleScript. An object passed from the AppleScript environment to the FScript execution context. This has to be a basic type such as a number, string, date, dictionary or array.
The FScript Console and Debugging
You often need to find out if your script (or line of script) returns something valid or not. You can test those lines against the console before putting them in your report or AppleScript. To bring up the console, execute the following AppleScript:
tell application "Daylite"
eval "document showFScriptConsole:nil."
The console has the document and objectContext set on it. To get the selected objects, use the following:
objects := (NSApplication sharedApplication) selectedObjects.
FScript within AppleScript
To execute FScript from within AppleScript, you wrap the FScript inside an eval command or an eval with command. The latter allows you to pass an argument to the fscript environment.
You can find a bunch of examples on this page.