Run – PB Docs 2017

Run

PowerScript function

Description

Runs the specified application program.

Syntax

Argument

Description

string

A string whose value is the file name of the program
you want to execute. Optionally, string can contain one or more
parameters for the program.

windowstate (optional)

A value of the WindowState enumerated datatype
indicating the state in which you want to run the
program:

  • Maximized! — Maximized; enlarge the program window to
    its maximum size when it starts

  • Minimized! — Minimized; shrink the program window to
    an icon when it starts

  • Normal! — (Default) Run the program window in its
    normal size

Return value

Integer. Returns 1 if it is successful and -1 if an error occurs. If
any argument’s value is null, Run returns null.

Usage

You can use Run for any program that you can run from the operating
system. If you do not specify parameters, Run opens the application and
displays the first application window. If you specify windowstate, the
application window is displayed in the specified state.

If you specify parameters, the application determines the meaning of
those parameters. A typical use is to identify a data file to be opened
when the program is executed. If you are running another PowerBuilder
application, that application can call the CommandParm function to
retrieve the parameters and process them as it sees fit.

If the file extension is omitted from the file name, PowerBuilder
assumes the extension is .EXE. To run a program with another extension
(for example, .BAT, .COM, or .PIF), you must specify the extension.

Examples

This statement runs the Microsoft Windows Clock accessory
application in its normal size:

This statement runs the Microsoft Windows Clock accessory
application minimized:

This statement runs the program WINNER.COM on the C drive in a
maximized state. The parameter passed to WINNER.COM opens the file
EMPLOYEE.INF:

This example runs the DOS batch file MYBATCH.BAT and passes the
parameter TEST to the batch file. In the batch file, you include percent
substitution characters in the commands to indicate where the parameter is
used:

In the batch file the following statement renames FILE1 to
TEST:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x