SYSTEM

From STX Wiki
Jump to navigation Jump to search

The STx SYSTEM family of commands executes Windows system commands. Their SYSTEMCALL variants work like their SYSTEM counterparts, except that they return warnings rather than errors on failure.

SYSTEM: Open the Windows command interpreter

SYSTEM

This will simply start the windows command interpreter.

SYSTEM: Open a Windows program or a batch file

SYSTEM command arguments
SYSTEMCALL command arguments

Execute a system command or a program, and wait for the process to finish. The numerical exit code of the program is stored in the shell variable XRC.

SYSTEMX command arguments
SYSTEMCALLX command arguments

Start a system command or process in the background, without waiting for it to finish. The windows program ID of the started process is stored in the shell variable XRC, and STx shell execution will continue.

If the SYSTEM family of commands is applied to an executable(.EXE), the respective program is executed directly, i.e., without involving the Windows command interpreter.

For the identification of the Windows command interpreter and for deciding where to look for the programm, the normal settings of the Windows environment are used (COMSPEC, PATH, and so on).

SYSTEM HELP: Accessing HTML help files

SYSTEM HELP chmFile htmlTopic

Using the Windows HtmlHelp API, STx will open the topic htmlTopic of the HTML help file chmFile.

chmFile
The compiled HTML file (e.g. "stx help.chm")
htmlTopic
The HTML topic to call (e.g. "526.htm").
SYSTEM HELP CLOSE

Close the HTML Help file if it is open.

SYSTEM HELP INDEX searchString [ helpFile ]

Search the help index. Open up the specified help file, activating the index tab and insert the search string. If no help file is specified, the default STx help file is used (as defined in @HELPFILE).

searchString
The string to search for.
helpFile
The help file to search. If no help file is specified, the help file specified by the user in the STx Configuration Settings Dialog in the user settings is used.
SYSTEM HELP KEYWORD searchString [ helpFile ]

Search the specified help file for a keyword matching the search string. If no help file is specified, the default STx help file is used (as defined in @HELPFILE). You may search for multiple keywords by separating them with semicolons (e.g. "dataset;edit"). Note that even in this case, searchString must still be a single argument (use quotation to be safe). Note also that the modular file containing the keyword is opened, rather than the master file.

searchString
The string to search for.
helpFile
The help file to search. If no help file is provided, the help file specified by the user in the STx "Configuration Settings" dialog in the User settings is used.
SYSTEM HELP SEARCH searchString [ helpFile ]

Open up the specified help file, activating the search tab and inserting the search string. Note that the search does not take place. Press return to search. If no help file is specified, the default STx help file is used (stored in @HELPFILE).

searchString
The string to search for.
helpFile
The help file to search. If no help file is specified, the help file specified by the user in the STx Configuration Settings Dialog in the user settings is used.

SYSTEM MKDIR: create a directory

SYSTEM MKDIR directoryPath

Creates the directory specified by directoryPath. If directoryPath is relative, it is relative to the @WORK directory. If other directories in directoryPath do not exist, they are all created.

Note that you can use a shell file item to check whether a directory exists.

You may retrieve the present working directory with the STx command PWD.

system mkdir '\\server1\public\data\output\$#var'
system mkdir 'd:\data\output\$#var'
system mkdir 'output\$#var'

SYSTEM OPEN: Open a document

SYSTEM OPEN doc

Use the registered windows application to open the file/document doc. This command is useful to open text document with the right text processor or to display HTML pages with the default browser application.

SYSTEM OPEN app doc

Use the specified windows application app to open the file/document doc.

Neither type of OPEN subcommands waits for the Windows application to finish. So macro execution continues right after the command has been submitted to the Windows system.

The OPEN subcommand can also be used to send e-mails (SYSTEM OPEN 'MAILTO:…') or to open a bookmark in an HTML page (SYSTEM OPEN 'HTTP:&hellop;').

If there is an error using the OPEN subcommand (e.g. if no application is registered for the document type), the error will not be reported to STx nor, in turn, to the macro. This means that it is impossible for an STx script to check if the document could be opened.

SYSTEM RMDIR: Remove a directory

SYSTEM RMDIR directoryPath

Removes the directory specified by directoryPath. Only the last directory is removed (e.g. if directoryPath is 'new1\new2' then only the directory 'new2' is removed).