SystemUtil Object

Description

An object used to control applications and processes during a run session.

IMPORTANT

The SystemUtil object is a reserved object. Reserved objects are not learned or stored in the object repository. Reserved objects enable you to retrieve or control settings or to modify OpenText Functional Testing behavior during a run session.  Most reserved objects are described in the Utility section of the Object Model Reference.

Operations

The sections below list the built-in methods and properties that you can use as operations for the SystemUtil object.

Methods

Method BlockInputPrevents keyboard and mouse input events from reaching applications.
Method CloseDescendentProcessesCloses all processes opened by OpenText Functional Testing.
Method CloseProcessByHwndCloses a process that is the owner of a window with the specified handle.
Method CloseProcessByIdCloses a process according to its Process ID (PID).
Method CloseProcessByNameCloses a process according to its name.
Method CloseProcessByWndTitleCloses all processes that are owners of windows with the specified title.

Method PrintToDebugStream

Prints custom log messages from a OpenText Functional Testing test to the Windows debug stream.
Method RunRuns a file or application.
Method UnblockInputRe-enables keyboard and mouse input events after a BlockInput statement was used to block them.

Back to top

 

BlockInput Method

Description

Prevents keyboard and mouse input events from reaching applications.

Syntax

object.BlockInput

Return Type

None

IMPORTANT

You can use this method to prevent a run session being accidentally interrupted by someone using the keyboard or mouse on a OpenText Functional Testing computer.

After using this method, keyboard and mouse input is blocked until one of the following occurs:

  • An UnblockInput statement is used
  • A run session ends or is paused for any reason (end of test run, run error, breakpoint)
  • The Ctrl+Alt+Delete key combination is pressed on the keyboard
  • A critical system error occurs

Example

Back to top

 

CloseDescendentProcesses Method

Description

Closes all processes opened by OpenText Functional Testing.

Syntax

object.CloseDescendentProcesses

Return Type

A long integer value.

The number of instances of the application that are closed when the statement runs.

IMPORTANT

Note: OpenText Functional Testing initially tries to close the process by sending a WM_CLOSE message to the process window. If the process is still open after 5 seconds, OpenText Functional Testing terminates the process.

Example

Back to top

 

CloseProcessByHwnd Method

Description

Closes a process that is the owner of a window with the specified handle.

Syntax

object.CloseProcessByHwnd (hWnd)

Arguments

ParameterDescription
hWnd Required. An unsigned long integer value.
The handle of the window owned by the process you want to close.
Tip: You can retrieve the window handle using the hwnd property.  For example:
Window("MyAppName").GetROProperty("hwnd")

Return Type

A Boolean value.

  • True--The specified process was successfully closed.
  • False--The specified process was not closed.

IMPORTANT

Note: OpenText Functional Testing initially tries to close the process by sending a WM_CLOSE message to the process window. If the process is still open after 5 seconds, OpenText Functional Testing terminates the process.

Example

Back to top

 

CloseProcessById Method

Description

Closes a process according to its Process ID (PID).

Syntax

object.CloseProcessById (wdProcessId)

Arguments

ParameterDescription
wdProcessId Required. An unsigned long integer value.
The Process ID (PID) of the process you want to close.
Tip: You can find the PID of an application by viewing the value in the Processes tab of the Windows Task Manager, or you can retrieve the value using the process id property.  For example:
Window("MyAppName").GetROProperty("process id")

Return Type

A Boolean value.

  • True--The specified process was successfully closed.
  • False--The specified process was not closed.

IMPORTANT

Note: OpenText Functional Testing initially tries to close the process by sending a WM_CLOSE message to the process window. If the process is still open after 5 seconds, OpenText Functional Testing terminates the process.

Example

Back to top

 

CloseProcessByName Method

Description

Closes a process according to its name.

Syntax

object.CloseProcessByName (bsProcessName)

Arguments

ParameterDescription
bsProcessName Required. A String value.
The name of the process you want to close.

Return Type

A long integer value.

The number of instances of the application that are closed when the statement runs.

IMPORTANT

Note: OpenText Functional Testing initially tries to close the process by sending a WM_CLOSE message to the process window. If the process is still open after 5 seconds, OpenText Functional Testing terminates the process.

Example

Back to top

 

CloseProcessByWndTitle Method

Description

Closes all processes that are owners of windows with the specified title.

Syntax

object.CloseProcessByWndTitle (bsTitle, [bRegExp])

Arguments

ParameterDescription
bsTitle Required. A String value.
The title of the window owned by the process you want to close.
bRegExp Optional. A Boolean value.
Indicates whether the bsTitle argument is treated as a regular expression. 

Default value = False

Return Type

A long integer value.

The number of instances of the application that are closed when the statement runs.

IMPORTANT

Note: OpenText Functional Testing initially tries to close the process by sending a WM_CLOSE message to the process window. If the process is still open after 5 seconds, OpenText Functional Testing terminates the process.

Example

Back to top

PrintToDebugStream

Description

Prints custom log messages from a OpenText Functional Testing test to the Windows debug stream.

Tip: A useful tool for viewing debug messages is DebugView. For details, see the online Microsoft documentation.

For more details on sending strings to the debugger, see the OutputDebugString function in the Windows Dev Center.

Syntax

object.PrintToDebugStream (message)

Arguments

ParameterDescription
message Required. A String value.
The message to be printed to Windows debug stream.

Return Type

None

Example

Back to top

 

Run Method

Description

Runs a file or application.

Syntax

object.Run file, [params], [dir], [op], [mode]

Arguments

ParameterDescription
file Required. A String value.
The name of the file you want to run.
params Optional. A String value.
If the specified file argument is an executable file, use the params argument to specify any parameters to be passed to the application.

Default value = ""
dir Optional. A String value.
The default directory of the application or file.

Default value = ""
op Optional. A String value.
The action to be performed. If this argument is blank ( ""), the open operation is performed.
The following operations can be specified for the op argument:

Operation

Description

open
Opens the file specified by the FileName parameter. The file can be an executable file, a document file, or a folder. Non-executable files are open in the associated application.
edit
Launches an editor and opens the document for editing. If the FileName argument does not specify an editable document file, the statement fails.
explore
Explores the folder specified by the FileName argument.
find
Initiates a search starting from the specified folder path.
print
Prints the document file specified by the FileName argument. If the specified file is not a printable document file, the statement fails.

Default value = "open"
mode Optional. An integer value.

Specifies how the application is displayed when it opens. You can specify one of the modes in the table below.
Default = 1

Mode

Description

0
Hides the window and activates another window.
Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. Specify this flag when displaying the window for the first time.
Activates the window and displays it as a minimized window.
Activates the window and displays it as a maximized window.
Displays the window in its most recent size and position. The active window remains active.
Activates the window and displays it in its current size and position.
Minimizes the specified window and activates the next top-level window in the Z order.
Displays the window as a minimized window. The active window remains active.
Displays the window in its current state. The active window remains active.
Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. Specify this flag when restoring a minimized window.
10 
Sets the show-state based on the state of the program that started the application.

Default value = 1

Return Type

None

IMPORTANT

When specifying a non-executable file, the file opens in the associated application.

Note: A SystemUtil.Run statement is automatically added to your test when you run an application from the Start menu or the Run dialog box while recording a test.

Tip: You can also use this method to perform operations on the specified file, similar to the usage of the Windows ShellExecute command.

Example

Back to top

 

UnblockInput Method

Description

Re-enables keyboard and mouse input events after a BlockInput statement was used to block them.

Syntax

object.UnblockInput

Return Type

None

IMPORTANT

You can use this method to unblock keyboard and mouse input that was earlier blocked using a BlockInput statement.

Example

Back to top

See also: