Shell (function)

Syntax

Shell(command$ [,WindowStyle])

Description

Executes another application, returning the task ID if successful.

Comments

The Shell statement accepts the following parameters:

 

Parameter

Description

 

command$

String containing the name of the application and any parameters.

 

WindowStyle

Optional Integer specifying the state of the application window after execution. It can be any of the following values:

 

 

1

Normal window with focus.

 

 

2

Minimized with focus (default).

 

 

3

Maximized with focus.

 

 

4

Normal window without focus.

 

 

7

Minimized without focus.

 

An error is generated if unsuccessful running command$.

The Shell command runs programs asynchronously: the statement following the Shell statement will execute before the child application has exited. On some platforms, the next statement will run before the child application has finished loading.

The Shell function returns a value suitable for activating the application using the AppActivate statement. It is important that this value be placed into a Variant, as its type depends on the platform.

Example

This example displays the Windows Clock, delays awhile, then closes it.

Sub Main()
  id = Shell("clock.exe",1)
  AppActivate "Clock"
  Sleep(2000)
  AppClose "Clock"
End Sub

See Also

SendKeys (statement); AppActivate (statement)

Note

This function returns a global process ID that can be used to identify the new process.

Important

CIMPLICITY runs as a service. Programs started from the Event Manager run as part of the service. Services, by default, do not interact with the desktop. Therefore, shelling of a program such as CimView, will cause the program to run, but with no interface.

 

 

 

 

More information

S