TITLE
    ClarisWorks: Using AppleScript to Create a New Document
Article ID:
Created:
Modified:
30723
8/24/98
8/24/98

TOPIC

    I want to write an AppleScript to launch ClarisWorks and automatically create a new word processing (or spreadsheet, etc.) document, what commands and syntax should I use?


DISCUSSION

    It is a two-part process:

    1) Create a ClarisWorks macro that creates a new word processing document. Name it something intuitive, such as "Create New WP Doc," and make sure it is set to play in all environments. If you are unfamiliar with the process of creating macros, see the "Record a macro" topic in ClarisWorks' on-screen help.

    When creating macros, it's always best to use as many keyboard commands, and as few mouse clicks, as possible. This ensures that your macros will continue to function properly, even if your window or dialog box positions change.

    To create this macro, record the following steps:
      1. Press Command N (Ctrl. N on Windows)
      2. Press Return (Enter on Windows)
      3. Stop recording (go ahead and close the resulting blank file)
    Command N brings up the New Document dialog box. Pressing Return chooses the first option, which is Word Processing.

    To create a macro which makes a different type of new document, record the following steps:
      1. Press Command N (Ctrl. N on Windows)
      2. Press the down arrow on your keyboard until the desired document type is highlighted in the New Document dialog box
      3. Press Return (Enter on Windows)
      4. Stop recording (go ahead and close the resulting blank file)
    Run the macro to confirm that it actually creates a new file.


    2) Use Script Editor (or some other AppleScript editor) to create the following AppleScript. This script will run the macro that creates the new file:

    tell application "ClarisWorks"
    do script "Create New WP Doc"
    end tell

    NOTE: The name in quotes after the "do script" command must match the name of your macro.

    If ClarisWorks is not already running, the script will launch it, then create the new file.

Document Information
Product Area: Apple Software
Category: Claris Software
Sub Category: ClarisWorks

Copyright © 2000 Apple Computer, Inc. All rights reserved.