To get started with AppleScript and the CodeWarrior IDE, let's take a look at a simple script that opens the IDE, brings it to the foreground on the Mac, opens a project, removes the binaries, and starts a build of the project. This script, shown in Listing A.1, is something that could be double-clicked to automatically do all these operations unattended.
TIP You might want to rename your CodeWarrior IDE application to just CodeWarrior IDE instead of CodeWarrior IDE 4.0.4. This makes it easier to migrate your scripts as versions of the IDE change.
Listing 0.1 My First CodeWarrior AppleScript
tell application "CodeWarrior IDE" (* go! *) activate (* bring CW to the front *) open file "SD:MyProj:MyProject.mcp" Remove Binaries Make Project end tell
You can imagine how convenient it will be to automate many tasks with AppleScript from this short example. Try entering this script in your Editor and get it to run. After getting this short example to run, you will probably be motivated to try some more extensive examples.
TIP If you are using Apple's Script Editor instead of a third-party script editor, you might want to increase the size of the memory partition for Script Editor while in the Finder. This is because Apple ships the application with a very small default memory partition. If you notice strange behavior while running your scripts, you might try increasing the memory for Script Editor to see if the problems go away.