Adobe 65009333 Scripting Guide - Page 20
Getting the current script
UPC - 883919155852
View all Adobe 65009333 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 20 highlights
Scripting Features Getting the current script 20 Property userInteractionLevel version Description This property controls the alerts and dialogs InCopy presents to the user. When you set this property to UserInteractionLevels.neverInteract, InCopy does not display any alerts or dialogs; set it to UserInteractionLevels.interactWithAlerts to enable alerts but disable dialogs; and set it to interactWithAll to restore the normal display of alerts and dialogs. The ability to turn off alert displays is very useful when you are opening documents via script; often, InCopy displays an alert for missing fonts or linked graphics files. To avoid this alert, set the user-interaction level to UserInteractionLevels.neverInteract before opening the document, then restore user interaction (set the property to interactWithAll) before completing script execution. The version of the scripting environment in use. For more information, see "Script versioning" on page 21. Note that this property is not the same as the version of the application. Getting the current script You can get a reference to the current script using the activeScript property of the application object. You can use this property to help you locate files and folders relative to the script, as shown in the following example (from the ActiveScript tutorial script): var myScript = app.activeScript; alert("The current script is: " + myScript); var myParentFolder = File(myScript).parent; alert("The folder containing the active script is: " + myParentFolder); When you debug scripts using a script editor, the activeScript property returns an error. Only scripts run from the Scripts palette appear in the activeScript property. When you debug scripts from the ExtendScript Toolkit, using the activeScript property returns an error. To avoid this error and create a way of debugging scripts that use the activeScript property, use the following error handler (from the GetScriptPath tutorial script): function myGetScriptPath() { try{ return app.activeScript; } catch(myError){ return File(myError.fileName); } }