This chapter describes how to script the BeIDE to manage projects and files.
The topics covered in this section include:
tell
command line application. Commands given here are in the format used by tell
.
At present most of the scripting commands refer to the project.
You will need the following three components to successfully script the BeIDE:
Scripting commands fall into several catagories. Tehse catagories include:
Use get
to return information about a project or file.
To return the name of a project file:
tell BeIDE get 'target: name of project'
To return the record_ref
of the project file:
tell BeIDE get 'target: record_ref of project'
To return the record_refs
of all the files in the project:
tell BeIDE get 'target: files of project'
This can be used to send scripting messages directly to the project window
tell BeIDE get 'target: messenger of project'
Use dependencies
to return information on file dependencies. Always returns a list of record_refs
for the specified file in the project. The formats for getting file information is shown in Listing 4.1.
tell BeIDE get 'target: dependencies of file 2 of project'
tell BeIDE get 'target: dependencies of file "HelloView.cpp" of
project'
tell BeIDE get 'target: dependencies of file "/boot/projects/
HelloWorld/HelloView.cpp" of project'
To open a file (aka B_REFS_RECEIVED
) use the formats shown in Listing 4.2.
tell BeIDE receive 'refs:["/boot/projects/HelloWorld/
HelloWorldNew.proj"]
tell BeIDE receive 'refs:[{ 1234, 55678}]
Use the following file commands to add or remove files from a CodeWarrior project.
To add a file using its pathname use:
tell BeIDE create 'target: file of project' 'data: "/boot/myproject/file.cpp"'
To add a file using its record_ref
, use the formats shown in Listing 4.3.
tell BeIDE create 'target: file of project' 'data: { 1234, 5678 }'
tell BeIDE create 'target: file of project' 'data: [ 1234, 5678 ]'
tell BeIDE create 'target: file of project' 'data:
["/boot/myproject/file.cpp"]'
tell BeIDE create 'target: file 1 of project' 'data:
["/boot/myproject/file.cpp"]'
tell BeIDE create 'target: file 2 of project' 'data:
[ 1234, 5678 ]'
To remove a file by index number:
tell BeIDE delete 'target: file 1 of project'
tell BeIDE delete 'target: file "HelloView.cpp" of project'
tell BeIDE delete 'target: file "/boot/projects/HelloWorld/HelloView.cpp" of project'
Use make
to compile a project.
tell BeIDE Make 'target: project'
The error codes listed below may be encountered when scripting the BeIDE.
MScripting.h
file for additional details.