NOTICE: Our Community is moving. Get more information. Updated information on a New Login Process
Using the Windows SDK function ShellExecute allows you to fully controlwhich program to startup, of course, it depends on the certain task.For instance, if you need to run a batch file, wait until it terminatesand then check the data in the output, it is better to use the SYS_Execute() function. If you need to run only executable files and want to havecompatibility between different SilkTest versions, method Start() isthe most suitable. And if you want to open files of different formats, or to run executable file and continue executing your script without waiting for the executable file to finish working, it would be better to use the ShellExecute function. More information on using the ShellExecute function can be found in:
An alternative to using SYS_Execute to execute commands from SilkTest (alternative to using SYS_Execute to execute commands from SilkTest)
Why does ShellExecute not work with SilkTest International? (Using wide-byte version of ShellExecute)
How do I launch an application without using the Default BaseState or Application States? (Launching an application without using Default BaseState or Application States).
Therefore the ShellExecute function can open files of different formats or to run executable files, but in the case where you would like SilkTest to wait for the application to open before executing the scripts, this is where the invoke method comes into play. However, youcan use wait statements with ShellExecute to wait for the applicationto open, however, this is NOT machine independent (i.e. loading of the application may differ on different environments).
The Invoke method invokes the current dialog or window, using information specified in the declaration to determine how to invoke the object. For a dialog, the declaration must contain the wInvokevariable, which defines the menu, menu item, or push button that invokes the dialog. For a ChildWin, wInvoke can be either a menu or a menuitem. When you use the Invoke method for a MainWin, Invoke calls theStart method and passes to it parameters specified in the declaration for the MainWin: sCmdLine variable: a string that defines the command line used toinvoke the application. The MainWin declaration must contain a definition for this variable in order to use the Invoke method to invoke the main window. sdir variable: a string that defines the working directory of the application when it is invoked. This variable is optional. bextensionReady: a Boolean that, if set to TRUE, indicates thatSilkTest should wait until the application???s extension has finished registering. This variable is optional. nInvokeTimeout: an integer that specifies the number of seconds that SilkTest waits fo the main window of the application to appear.This variable is optional.