Making Coding Easier

There are several commands on the contextual menus that are also available from either the command-bar menus or via keyboard shortcuts. These allow you to manipulate the contents of the history and editing panes by moving, copying and removing text (Cut, Copy, Paste, SelectAll, ClearAll and ClearSelection). In addition, there are a couple of functions that control the playback of your scripts (Undo, Redo, Run and Repeat).

In addition, there are several functions that are available only on the editing contextual menu. These provide access to many helpful features that make it easier to use the Softimage scripting editor: Syntax Help, Tools, Toggle Comments and Set to <language>.

Syntax Help

The Syntax Help submenu provides a variety of code snippets that you can automatically insert into the editing pane. The types of snippets provided are fundamental syntax contruction (standard for-loops, if-then-else clauses, etc.), instrinsic Softimage object creation (XSICollection, SIVector3, etc.), and more advanced constructions, such as JScript and Python custom objects (depending on the language preference).

When you select one of the entries on the Syntax Help submenu, a code snippet in your current language is inserted into the editing pane at the cursor’s insertion point (if you have text selected it will replace your selection).

| Since the language preference affects the syntax of the inserted code snippet, each submenu entry may give slight results (for example, a semicolon and a couple of keywords to create an SIVector3) or completely different constructions (for example, try using Catch Error in VBScript, JScript and Python).

Tools

The Tools submenu gives you access to tools that provide services to help you create and debug your scripts:

• Add Command

• Filename to Clipboard

• Set Breakpoint

• Enable External Script Debugger (JScript and VBScript only)

Add Command

Launches the Command Wizard which you can use to generate the code for for a self-installing command, including these components:

• the PluginRegistrar.RegisterCommand method

• the Init (Command) callback

• the Execute (Command)

Filename to Clipboard

Stores the full path and filename of the script file currently loaded in the Script Editor on the clipboard.

Set Breakpoint

Inserts the breakpoint call to the debugger for the current language at the insertion point in the editing pane (see Debugging Scripts).

Enable External Script Debugger

Enables Just In Time debugging. JIT debugging invokes the MS Script Debugger whenever your script either generates an error or contains a breakpoint (see Debugging Scripts).

Toggle Comments

If you select a block in the scripting pane and then select Comment Out from the contextual menu, the selected lines are commented out (using the comment characters for the current language, of course). As the name suggests, Comment Remove removes the comment characters.

This is very handy when you want to test disjointed snippets of code in the editng pane, to achieve something like this:

    // I have to run this block
    var root = Application.ActiveSceneRoot;
    var n = Application.ActiveSceneRoot.AddNull();
    PerformSomeNastyOperation( n );

    // I don't want to run this if-clause
    if ( n.Name == "null" ) {
       root.AddNull();
    }

    // I want to run this block
    function PerformSomeNastyOperation( in_obj )
    {
       // Does whatever...
    }

Set to <language>

For script writers who use different languages to implement or test their code, this is a handy shortcut to be able to switch back and forth between them. This is the shortcut for changing the Script Language parameter value on the Scripting preferences page (File > Preferences > Scripting tab > Script Language from the Script Editor), one menu entry for each language (with the current language greyed out).

Autodesk Softimage v7.5