Using the DoScript method. Adobe InCopy CS6

Add to My manuals
108 Pages

advertisement

Using the DoScript method. Adobe InCopy CS6 | Manualzz

Scripting Features Using the DoScript method 29

Set myInCopy = CreateObject("InCopy.Application")

Rem Set to 7.0 DOM myInCopy.ScriptPreferences.Version = 7.0

Using the DoScript method

The DoScript method gives a script a way to execute another script. The script can be a string of valid scripting code or a file on disk. The script can be in the same scripting language as the current script or another scripting language. The available languages vary by platform: on Mac OS, you can run either an

AppleScript or a JavaScript; on Windows, you can run a VBScript or a JavaScript.

The

DoScript

method has many possible uses:

 Running a script in another language that provides a feature missing in your main scripting language.

For example, VBScript lacks the ability to display a file or folder browser, which JavaScript has.

AppleScript can be very slow to compute trigonometric functions (sine and cosine), but JavaScript performs these calculations rapidly. JavaScript does not have a way to query Microsoft® Excel for the contents of a specific spreadsheet cell, but both AppleScript and VBScript have this capability. In all these examples, the

DoScript

method can execute a snippet of scripting code in another language, to overcome a limitation of the language used for the body of the script.

 Creating a script “on the fly.” Your script can create a script (as a string) during its execution, which it can then execute using the

DoScript

method. This is a great way to create a custom dialog or panel based on the contents of the selection or the attributes of objects the script creates.

 Embedding scripts in objects. Scripts can use the

DoScript

method to run scripts that were saved as strings in the label property of objects. Using this technique, an object can contain a script that controls its layout properties or updates its content according to certain parameters. Scripts also can be embedded in XML elements as an attribute of the element or as the contents of an element. See

“Running scripts at start-up” on page 30 .

Sending parameters to DoScript

To send a parameter to a script executed by

DoScript

, use the following form (from the

DoScriptParameters tutorial script):

Set myInCopy = CreateObject("InCopy.Application") myJavaScript = "alert(""First argument: "" + arguments[0] + ""\rSecond argument: "" + arguments[1]);" myInCopy.DoScript myJavaScript, idScriptLanguage.idJavascript, Array("Hello from

DoScript", "Your message here.") myVBScript = "msgbox arguments(1), vbOKOnly, ""First argument: "" & arguments(0)" myInCopy.DoScript myVBScript, idScriptLanguage.idVisualBasic, Array("Hello from

DoScript", "Your message here.")

Returning values from DoScript

To return a value from a script executed by DoScript , you can use the ScriptArgs (short for “script arguments”) object of the application. The following script fragment shows how to do this (for the complete script, see the DoScriptReturnValue tutorial script):

advertisement

Key Features

  • Seamless collaboration between copywriters and designers
  • Copyflow workspace tailored for editorial workflows
  • Effortless integration with InDesign for copy placement and editing
  • Comprehensive text editing and styling capabilities
  • Efficient handling of long-form and complex documents
  • Streamlined copyfitting and typesetting features
  • Advanced typography controls for precise text formatting

Related manuals

Frequently Answers and Questions

Can InCopy be used independently of InDesign?
Yes, InCopy can be used as a standalone application for text editing and styling.
How does InCopy integrate with InDesign?
InCopy seamlessly integrates with InDesign, allowing copywriters to place and edit copy within InDesign page layouts.
What are the benefits of using InCopy for editorial workflows?
InCopy provides a specialized copyflow workspace tailored for editorial workflows, ensuring efficient and collaborative copywriting and editing.
Does InCopy support advanced typography features?
Yes, InCopy offers advanced typography controls for precise text formatting, giving you complete control over the appearance of your text.
Download PDF

advertisement

Table of contents