Softimage SDK Programmer's Guide > Script Development > Using the Script Editor >

# Managing Script Files

The first time you open the script editor, the editing pane is empty. Once you written a script, you can save the contents of the editing pane as a script file. The script editor also lets you open existing script files and create new ones.

Scripts are saved as plain text files with an extension that denotes the scripting language. For a description of the supported scripting languages, see Introduction to Scripting in Softimage.

Where Script Files Are Stored

Although you can save script files anywhere, it is recommended that you use a standard location. This makes it easier to keep track of your scripts, especially when editing and updating them. The default location is the Data\Scripts subdirectory of your user path.

The Paths button in the Open and Save Script File browsers lets you quickly choose between various base locations, including:

- Installation (Factory) is the location where the Softimage program files are installed. Scripts saved here are available to any user on the local machine. You will need to copy these scripts if you install Softimage to a new location.

- Workgroup Application lets you share scripts, presets, and other data with members of your team. To set a workgroup application path, choose File User Preferences and set the option on the Data Management tab.

- User is your user path, for example, C:\users\kilroy\Softimage\Softimage_2012. Scripts saved in this location are available to you whenever you are logged in as the same user on that installation of Softimage.

- Sample Project is a project with sample scenes included with Softimage. It is not recommended to save your scripts here.

- Workgroup Project is a project that can be shared with other members of your team. To set a workgroup application path, choose File User Preferences and set the option on the Data Management tab.

- Current Project is the project that contains the open scene. You could use this folder if your script is specific to a particular project.

- Factory Add-ons is the Addons subdirectory of the location where the Softimage program files are installed.

- User Add-ons is the Addons subdirectory of your user path.

- Other projects in your Projects List are listed under Projects.

Note that there is a Scripts folder in every project. This is a good location if a script is very specific to a particular project or scene, or if you want to make sure that the correct version of a script is stored with a project for the purpose of archiving.

Saving Script Files

You can save either the entire contents of the editing pane, or just the selected text.

To save the entire contents of the editing pane to disk as a script file

Do one of the following:

- Click Save on the command bar.

  or

- Choose File Save from the command bar.

  or

- Press Ctrl+s.

If the script has not been saved before, the Save Script File browser prompts you to specify a file name and folder. You should also make sure that the extension is the correct one for the language of the script. Once you supply a file name for the script, the name is displayed in the title bar of the script editor window.

To save the entire contents of the editing pane with a new name

- Choose File Save As from the command bar. The Save Script File browser prompts you to specify a file name, folder, and extension.

To save selected text as to disk as a script file

1. Select some text in the editing pane.

2. Choose File Save Selection from the command bar. The Save dialog box prompts you to supply a file name. You should also make sure that the extension is the correct one for the language of the script.

Opening Script Files

You can open a saved script from the script editor's File menu, or by dragging and dropping. You can also open a script that has been registered as a custom command directly from its command button.

Important

If you open a script file in a different language, it automatically changes the scripting language that is set in your user preferences.

To open a script from the File menu

1. Display the Open dialog box by doing one of the following:

   - Choose File Open from the command bar.

     or

   - Press Ctrl+o.

2. If the current contents of the editing pane have not been saved, you are prompted to save them. Click Yes or No as desired.

3. Use the Open Script File browser to select a script file and click OK.

   The contents of the script file are displayed in the editing pane, and the name of the file is displayed in the script editor's title bar.

To open a script by dragging and dropping

- Drag the script file from a browser view into the editing pane, or drag a link to the script file from Net View. On Windows, you can also drag it from a folder window.

To open a script that has been registered as a custom command

- Right-click on the command button in a custom toolbar, and choose Edit Script. Alternatively if the script editor is already open, you can drag the button into the editing pane.

Starting New Script Files

Do one of the following:

- Click the New button on the command bar.

  or

- Choose File New from the command bar.

  or

- Press Ctrl+n.

When you create a new script file, you are prompted to save the contents of the editing pane. After you have clicked Yes or No, the editing pane is cleared and the name of the script is displayed as Untitled in the script editor's title bar.

Important

In the script editor, you can also clear the contents of the editing pane by choosing Clear Script Editor from the Edit menu. However, this does not change the name of the script as displayed in the title bar of the script editor. Accidentally choosing Save instead of Save As would then overwrite the named file on disk.