SYSTEM

Sends a command to the operating system.

Syntax

SYSTEM expression [RESET|CLOSE] [INVISIBLE] [BACKGROUND | REMOTE]

Parameters

expression

Any expression that evaluates to a character string. Expression may include constants, variables, parameters, functions, and so on.

RESET

Causes all of the software's internal data buffers to be flushed to disk. Other programs (e.g., single-user Programming Language Interface programs) that modify the current database can be safely invoked.

CLOSE

Causes all of the software's internal data buffers to be flushed to disk and all files that are not currently in use to be closed. Other programs (e.g., single-user Programming Language Interface programs) that modify the current database can be safely invoked.

INVISIBLE

Permits the command specified in expression to be executed without affecting the screen display.

BACKGROUND

Indicates that the command specified in expression is to be executed asynchronously while Zim continues to run. Many operating system commands can be processed concurrently.
When BACKGROUND is omitted, execution is suspended while the operating system executes the specified command.

REMOTE

Only applicable to Zim Thin Client, it executes the operating system command specified in expression in the server side.

Comments

SYSTEM sends the command represented by expression to the operating system. For expression to be successfully executed, it must be meaningful to the operating system. Any software required for the execution of expression must be available to the system.

The SYSTEM command runs synchronously by default; the BACKGROUND subcommand can be used to force any SYSTEM command to execute asynchronously.

Note: For batch files, precede the command with an exclamation mark (!).

Note: There is no sense issuing the command SYSTEM with CMD, COMMAND or SH and the option BACKGROUND because it will require user interaction but there is no visible window to do it. The result is that Zim will wait for an event (closing the operating system window) that will never occur.

Example

find Customers where LastName = "Smith" and FirstName = "John"
system $concat("archive ", fCustomers.cc, ".dat")

If the cc value is 7592, then this command invokes a program called "archive" to archive the data file by passing the command archive 7592.dat to the operating system.

system "erase c:\\file.dat"

In systems where the path delimiter character is the backslash, remember that the backslash is also the escape character in character strings. Two backslashes are required, as shown above, to send the backslash to the operating system.

set escapechar off
system "erase c:\file.dat"
set escapechar on

In the above example, SET ESCAPECHAR is used to turn off use of the escape character in character strings. Or, use SET SPECIALSCAN to switch off use of all reserved characters in text strings.

Note: See the user documentation for your operating system.

Related Topics