Start Method

Class

MainWin.

Action

Invokes the application, using the specified command line, and waits for the main window to appear.

Syntax

MainWin.Start (sCmdLine, sDir, sExtensionReady, nInvokeTimeout)
Variable Description
sCmdLine The command line used to run the application. STRING.
sDir The working directory of the application when it is invoked, as specified by the sDir member of the MainWin declaration. STRING.
sExtensionReady

If the bExtensionReady member of the MainWin declaration is defined and not false, the Invoke method passes "~ExtensionReady" to the Start method as its third argument. STRING.

When this argument is "~ExtensionReady", Silk Test Classic stops waiting when the timeout expires or when the application’s extension has finished registering.

If bExtensionReady is not defined in the MainWin declaration and if the wStartup member of the MainWin declaration is defined and not null, Silk Test Classic interprets the wStartup value as a window and specifies its tag for sExtensionReady. Silk Test Classic looks for the specified window until the timeout expires.

nInvokeTimeout

Number of seconds that Silk Test Classic waits for the main window of the application to appear. INTEGER.

The Invoke method passes the value of nInvokeTimeout to the Start method as its fourth argument.

If sExtensionReady is "~ExtensionReady", Silk Test Classic waits until the timeout expires or until the application’s extension tag (if it has one) has finished registering.

If sExtensionReady is not "~ExtensionReady" but not null, Silk Test Classic interprets it as the tag for the window specified by the wStartup member of the declaration. Silk Test Classic looks for the specified window until the timeout expires.

If the bExtensionReady and wStartup members are not defined in the MainWin declaration, Silk Test Classic looks for the MainWin itself.

Notes

Start runs the application specified in sCmdLine, and waits for the application window to exist before returning.

The first part of the command line specifies the name of the executable file. Since all platforms support a search path, Silk Test Classic uses the search path to locate the specified executable file. The rest of the command line is passed as arguments to the specified executable file.

If Silk Test Classic cannot start the application (for example, if it cannot find the file or there is not enough memory), the exception E_CANT_START_APP is raised.

As an alternative to Start, you can use the Shell32.dll from Microsoft Windows with the ShellExecuteW() command. ShellExecuteW() returns control to the application after it starts the executable. Or, use APP_Start() from bwcompat.inc, which is provided with Silk Test Classic. For details about APP_Start(), refer to the bwcompat.inc file. For details about ShellExecuteW(), refer to the Windows help.

Example

	[-] if (!TextEditor.Exists ())
		[ ] TextEditor.Start ("textedit.exe")