[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


How to Start Scripting

This section discusses how to begin using the public interfaces of the CodeWarrior IDE to write scripts and extend the operation of the IDE.

The sections here are:


Creating an Application Instance

One of the first lines of your script should be something like:


set codewarrior = CreateObject("CodeWarrior.CodeWarriorApp")

This creates a COM instance of the CodeWarrior IDE that you can interact with in subsequent scripting operations. For more information about this, refer to "ICodeWarriorApp."


An Example Script Command

Now we'll analyze how you would use OLE/COM Object Viewer to learn how to script the IDE for one simple operation. In order to do much in the IDE, you will need to open a project. This can be accomplished with this script command:


set project = codewarrior.OpenProject(projectname, true, 2, 0 )

How would you know how to write this command? Simple, use the OLE/COM Object Viewer to inspect the CoClasses for the operation you want to perform, as in the steps here:

1. To do this for the OpenProject method, you would first launch OLE/COM Object Viewer.

2. Then use the View menu to put it into Expert Mode, click on the plus sign "+" next to Type Libraries in the left window pane, then double-click on the Metrowerks CodeWarrior IDE entry.

A window similar to Figure 3.2 appears.

3. Then use the View menu of the ITypeLib Viewer window to choose Group by type kind.

4. Then click on the plus sign "+" next to CoClasses, then the + next to coclass CodeWarriorApp, then the + next to Methods.

5. Click on OpenProject.

Your window should now look something like that shown in Figure 3.3.

OpenProject Method:

This shows that the OpenProject method requires 4 arguments, all are parameters that are passed in only (the [in] designation signifies this):

You can view the values for the enumerations in the same window under the Enums hierarchy.

You can also refer to "CodeWarrior IDE COM Reference" for more information on the specific interfaces instead of looking each one up with the OLE tool.


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 02, 2000