Usage notes for OrcaScript commands and parameters
Before calling
any other ORCA functions, you need to open a session:
|
1 |
start session |
You can start and end multiple OrcaScript sessions in the
same batch file.
Copying files, objects, and properties
If you want to use OrcaScript simply to move objects among
libraries, you do not need to set a library list or application.
You can use the copy commands to copy files,
objects, and properties. This example copies the d_labels DataWindow
from the source.pbl library to the destin.pbl library:
|
1 |
copy entry "c:\app\source.pbl" "d_labels" dw "c:\app\destin.pbl" |
Setting a library list and an application
If you want to use OrcaScript to build targets or deploy components
(or set product and version information using the set exeinfo command),
you must first set the library list and the current application.
You can set the library list and current application only once in
an OrcaScript session. To use another library list and application,
end the OrcaScript session and start a new session. The following
OrcaScript commands build target libraries and compile an executable
file:
|
1 |
start session<br />set liblist ".qadbtestqadbtest.pbl;.shared_objshared_obj.pbl;.datatypesdatatype.pbl;.chgreqschgreqs.pbl"<br />set application ".qadbtestqadbtest.pbl" "qadbtest"<br />build library ".shared_objshared_obj.pbl" "" pbd<br />build library ".datatypesdatatype.pbl" "" pbd<br />build library ".chgreqschgreqs.pbl" "" pbd<br />build executable ".qadbtestqadbtest.exe" ".emp.ico" ".qadbtest.pbr" "nyyy"<br />file copy ".qadbtestqadbtest.exe" ".inqadbtest.exe"<br />file copy ".chgreqschgreqs.pbd" ".inchgreqs.pbd"<br />file copy ".datatypesdatatype.pbd" ".indatatype.pbd"<br />file copy ".shared_objshared_obj.pbd" ".inshared_obj.pbd"end session |
You can use relative paths when you generate PBDs with the “PBD” option, but
the PBD always gets generated in the same directory as the PBL.
To actually run the executable, you might have to move the PBDs
to a “BIN” directory. The above example calls
several file copy commands to accomplish this.
Building DLLs instead of PBDs If you select 32 as the last argument in a build
library command, you must use the full path for the PBL
or PBR name included in that call.
Source control example
You can use OrcaScript source control commands instead of
the commands to set the library list and application. The following
is an example of an OrcaScript session that builds the same libraries
as the previous example, but uses the target properties to set a
library list and application:
|
1 |
start session<br />scc get connect properties "testbld estbld.pbw"<br />scc connect <br />scc set target "c: estbldqadbtestqadbtest.pbt" "outofdate exclude_checkout"<br />scc refresh target "incremental"<br />build library ".shared_objshared_obj.pbl" "" pbd<br />build library ".datatypesdatatype.pbl" "" pbd<br />build library ".chgreqschgreqs.pbl" "" pbd<br />build executable ".qadbtestqadbtest.exe" ".emp.ico" ".qadbtest.pbr" "nyyy" <br />scc close<br />end session |
You can call the scc connect command only
after getting connection properties, and you must call it before
you set or refresh the source-controlled targets. You must call
the scc close command before you end your OrcaScript
session.
Shared library example
If you have another target that shares libraries with a target
that you already refreshed, you can use the OrcaScript exclude command
to quickly reconstitute your target. The following example excludes
the shared libraries shared_obj.pbl, datatype.pbl,
and chgreqs.pbl that were refreshed in the previous
example. It also demonstrates the use of variables for refresh options and
build type. Set statements define variables that can be used throughout
an OrcaScript session wherever the parser expects a string token.
|
1 |
start session<br />set refresh_flags = "outofdate"<br />set refresh_flags += "exclude_checkout"<br />set build_type = "incremental"<br />scc get connect properties "c: estbld estbld.pbw"<br />scc connect <br />scc set target ".dbautodbauto.pbt" refresh_flags<br />scc exclude liblist ".shared_objshared_obj.pbl" ".datatypesdatatype.pbl" ".chgreqschgreqs.pbl"<br />scc refresh target build_type <br />build executable ".dbautodbauto.exe" ".emp.ico" "" "nyyy" <br />scc close<br />end session |
Defining variables from the command line Instead of defining variables in the OrcaScript session, you
can define them from the command line when you call your script.
If you saved the OrcaScript example in the previous script in a
file named MyExample.dat, you could set the
same variables by typing the following at a command line prompt:
|
1 |
Orcascr9 /D refresh_flags="outofdate exclude_checkout" <br />/D build_type="incremental" MyExample.dat |
SCC connection properties
The SCC get connect properties command
is an easy way to populate the Orca SCC connection structure with
the source control properties of a local workspace. However, to
create OrcaScript batch files that are portable from one workstation
to another, the recommended technique is to set each property explicitly.
Many of these properties are vendor specific. The best way to obtain correct
values is to copy them directly from the SCC log file for your PowerBuilder
workspace.
After you have obtained the values you need from the SCC log
file, you can create portable batch files by setting the required
connection properties and using relative directories and URLs for
path information. The following example shows portable OrcaScript
batch file commands for a workspace that connects to PBNative:
|
1 |
start session<br />scc set connect property provider "PB Native" <br />scc set connect property userid "Jane"<br />scc set connect property localprojpath "."<br />scc set connect property project "\network_machinePBNative_Archiveqadb"<br />scc set connect property logfile ".MyPortableExample.log"<br />scc set connect property logappend "FALSE"<br />scc set connect property deletetempfiles "FALSE"<br />scc connect<br />; Perform refresh and build operations<br />scc close<br />end session |
Build command failures
OrcaScript build commands for an executable or a library fail
if the executable or library already exists in the build directory.
To prevent an OrcaScript batch file containing these commands from
failing, move or delete existing executables and libraries from
the build directory before running the batch script.
Escape characters for string variables
OrcaScript, like PowerScript, uses the tilde ( ~ ) as an escape
character. If you need to include a special character, such as a
quotation mark, inside a string, you must place a tilde in front
of it. A character in an OrcaScript batch file with a tilde in front
of it is processed as a literal character.
Ending an OrcaScript session
You must close an OrcaScript session after you finish calling
other OrcaScript commands. You close an OrcaScript session by calling:
|
1 |
end session |
Property values are deleted during end session processing.
If an Orcascript program creates numerous sessions, each individual
session must contain statements to specify property values, such
as those assigned in set exeinfo commands.