About OrcaScript

OrcaScript allows you to write batch scripts to process PowerBuilder applications and files without using the PowerBuilder development environment. You can use OrcaScript to get the latest version of a target from source control, build the target PBLs, and compile PowerBuilder executable files—all without operator intervention.

Using OrcaScript with source control

Note

The OrcaScript command for getting the latest objects from the source control server is not supported by the SVN/Git solution. You can consider using the SVN/Git client tool (such as TortoiseSVN, TortoiseGit etc.) to get the latest objects via commands. For more information, see Usage notes for OrcaScript commands with SVN/Git.

The targets you obtain from source control using OrcaScript could be placed on a network build computer that is shared by PowerBuilder developers. This is especially advantageous for large shops with fixed working hours: the builds could be done nightly by running an OrcaScript batch file, and an up-to-date version of the targets and libraries would be available at the start of the next work day.

Developers could then use OrcaScript or operating system commands to copy the shared files directly to their local computers. Although developers would still connect directly to source control from their local workspaces, refreshing the targets in the workspaces would be much faster since compilation times for complex targets would be greatly minimized.

Batch file order

If you include OrcaScript commands in a batch file, the file is read line by line. Each OrcaScript batch file must begin with a start session command and end with an end session command. You can save the batch file with any extension. You run the batch file by calling the OrcaScript executable on a command line and passing the batch file name as an argument:

OrcaScr190 myOrcaBat.dat

If you use relative directories in the OrcaScript batch file, create the batch file in the directory that is the required root directory at runtime. This must be in the same directory or in the path above a directory containing the files referenced by the batch file.

When you use relative directories, the OrcaScript batch file is portable for all users. However, users must make the directory where they copy the batch file the current directory (the one displayed in the DOS prompt) before invoking OrcaScr190.exe. The command to start the OrcaScript executable can also take the following parameters:

Parameter

Description

Example

/D

Sets variables that are valid in the batch file

OrcaScr190 /D myVar1=value1 /D myVar2=value2 myOrca.dat

/H or /?

Prints syntax help to screen

OrcaScr190 /H


Caution

You should not run an OrcaScript batch file if PowerBuilder is currently running on the same computer. If the PowerBuilder development environment is not shut down while OrcaScript is running, your PowerBuilder libraries can become corrupted. For this reason, casual use of OrcaScript is not recommended.

Executing DOS commands and batch file

The OrcaScript commands can call DOS commands and arguments and the batch file. For example,

start session
cmd "delete c:\test.txt"
end session

Or

start session
cmd "c:\test.bat"
end session

About pbc190.exe

The pbc190.exe tool can be used to automate the PowerBuilder application building process. See below to compare the scripts for building a project using the OrcaScript batch file and the pbc190.exe tool.

OrcaScript batch file

The OrcaScript batch file contains the following scripts:

start session
set liblist "D:\Test\PB\190cmdvss\test11.pbl;D:\Test\PB\190cmdvss\appeontry.pbl;"
set application "D:\Test\PB\190cmdvss\test11.pbl"  "test11"
build library "D:\Test\PB\190cmdvss\test11.pbl" "" pbd
build library "D:\Test\PB\190cmdvss\appeontry.pbl" "" pbd
build executable "D:\Test\PB\190cmdvss\test11.exe" "" "" "yy" newvstylecontrols
end session

pbc190.exe tool

Directly execute the pbc190.exe tool with the following commands:

pbc190 /d D:\Test\PB\190cmdvss\test11.pbt

Note

Please make sure the PBC tool is the same version as the PowerBuilder application source code.

If you use the 2017 PBC tool (pbc170.exe) to build the 2019 application source code, the application will be downgraded from 2019 to 2017, and the 2017 application cannot be built using the 2019 PBC tool.

For more about how to use the pbc190.exe tool, refer to the standalone PBC user guide (pbc.pdf) in the AutoCompiler folder.

Error handling

Each line of an OrcaScript batch file either succeeds or fails. If a command fails, subsequent commands are not processed and the OrcaScript session is ended. An error message is printed to the command window.

Exception handling

User-defined exceptions such as Try...Catch is not supported by OrcaScript.

Comments

A semicolon (;) indicates that the rest of the line is treated as a comment.

The comment (including the semicolon) must start in a new line; it cannot be added to the end of a command. This is a correct example:

scc connect  
;test