Process Management

Process Management

Process Management

Process Start and Identification

The StartProcess and WaitProcess commands ensure that the script interacts with the correct windows app before running the main body of the script.

The LaunchUrl command allows integration with web applications.


LaunchURLLaunches the target URL in the user’s default browser.

This command is used when a web app requires a desktop script because the web app technology is not compatible with a browser extension, e.g. Flash, Java or IE compatibility mode apps.

The “Application Supports Desktop Launch” flag should be cleared for any scripts using this command, otherwise, if there are multiple scripts using this command, the user will be prompted to select a user when the browser starts.

Syntax Diagram


Parameters

  • browserTarget - URL (or URI) of website / file to open in the default browser

Example

LaunchUrl "https://SomeSite.com/login"

Or, if the URL is in the Path to App field

LaunchUrl bmPathToApp




StartProcess

Used to start a desktop application if the user clicks on an app’s Vault tile.

If the application is started from the user’s desktop (i.e. not by clicking on a vault tile) and the Allow OS Launch setting on the application template is disabled then a runtime error is raised.

If OS launch is permitted then StartProcess does nothing when an app is started from the desktop.

Syntax Diagram


Parameters

Refer to the syntax diagrams for the valid combinations and positioning of the parameters.

Parameter Name

Description

executableName

The path to the executable or file to be launched. This is the only mandatory parameter.

commandArgument

Command line arguments for process start.

startIn

Path to the startup folder for the app. This is not normally required. If needed then the commandArgument must be provided, use an empty string if no actual arguments are needed.

SingleInstance

Informs the system that the application only allows one instance to run. i.e. regardless of how often the app is started only one process instance actually runs.

Morphs morphedExecutableName

If the process morphs into a different process (and it does not have the same name as the original) then this is the process name or filename of the new process.

timeoutMilliseconds

In milliseconds. Amount of time to wait for the process to start before throwing an error. The default is 4,000 (4 seconds)

Example

Starts the application defined by the desktop application template, passing in the command line arguments.

StartProcess bmAppPath bmAppArgument

See the Advanced Script Examples for more examples.




WaitProcess

The WaitProcess command pauses the execution of the script until a matching process is identified, or the timeout expires.

The default timeout is 10 seconds.

Syntax Diagram


Parameters

Refer to the syntax diagrams for the valid combinations and positioning of the parameters.

Parameter Name

Description

Secondary

Does not change the process that the script is attached to.

processMatchOptions

See Process Caption Match Options

timeoutMilliseconds

Length of time to wait until process is found before raising an error.

Examples

The simplest mode of use is to have the command wait for a process that matches a specific file path or process name. E.g. both of the following will wait until a new instance of Notepad is detected:

WaitProcess "C:\WINDOWS\system32\notepad.exe"

WaitProcess "Notepad"

If the process to be waited on is the one specified in the “Path to App” template field then you can use the template variable:

WaitProcess bmAppPath

The Caption option allows you to specify the target process by matching text in its main window caption. The command below will wait until a window is visible whose caption begins with the text “My App”

WaitProcess Caption BeginsWith "My App"

Details on caption matching are shown below.

WaitProcess may be required more than once in a script when the script needs to pause until a secondary process is running. This is the case when the windows credential dialog is used.

E.g. for the remote desktop app, the user is prompted for their credentials in what looks like a normal window, but it’s actually a separate process.

// Wait for credential dialog to open by its process exe name
WaitProcess Secondary "CredentialUIBroker.exe"

The Secondary option prevents the script from replacing the process it started with by this secondary process. If this option is not used then subsequent commands will not work against the main application. The default behaviour is to run the script in the context of the process that has been found.


Process Window Caption Matching

If the Caption option is used then there is considerable flexibility in matching against the target window’s caption.


Refer to the syntax diagrams for the valid combinations and positioning of the parameters.

Parameter Name

Description

executableName

Filename to exe or process name to look for.

Caption

Required to set caption matching mode

stringMatch

See below

concatenatedStringParameter

Valid String (Text) Literals

bookmarkAttribute

Allows matching against a value in a user’s bookmark. E.g. storing a user specific value in one of the additional fields such as bmEnc1.



String Match Options

Option

Meaning

StartsWith

The control’s text must start with the value.

Contains

The control’s text must contain the value.

EndsWith

The control’s text must end with the value.

Regex

The control content pattern is treated as a regex and an IsMatch performed between it and the control’s text.

The two string match options shown below both perform the same funtion of matching the caption of the application (below) by checking if it ends in the text “2.1”.

EndsWith "2.1"

Regex "2.1$"



Vault Launching

If the user has the My1Login browser extension installed then they can launch desktop applications by clicking on the application’s vault tile. (If the template allows it.)

In certain cases it may be necessary to perform additional scripting, such as opening a login window, that isn’t necessary if the app is started from a desktop shortcut.


WhenVaultLaunch

WhenVaultLaunch wraps a set of script commands between start and end braces { }. These commands are only executed if the script is started as a result of the user clicking on a vault tile.

Syntax Diagram


Parameters

None.

Example

The SAP GUI application requires the login window to be opened if it is launched from the vault, but not if it is launched from the user’s desktop. See also the full example for SAP GUI Application.

// Force SAP GUI app into a specific mode on vault
// startup by clicking a specific toolbar button

WhenVaultLaunch
{
 // Force the Explorer View
 // (select then click the button)
 SelectControl ControlButton 0x801B
 LeftClick HorizontalMiddle VerticalMiddle
}

    • Related Articles

    • Desktop Scripting

      Structure of a Script A Desktop DSL Script has the following functional sections (not all are required for all apps): Error Directive Determines the impact of errors on the script run. Process Start and Identification Ensures the correct windows ...
    • Working With the OS Environment

      Working With the OS Environment 32 bit Apps on 64 & 32 bit Windows Specifying the bmAppPath for a 32 bit process should use the “Program Files (x86)” folder if the script is to be run on 64 bit versions of windows. At runtime the bmAppPath will be ...
    • My1Login Desktop Client Overview

      Introduction The Desktop Client (DTC) is My1Login’s Windows solution for integrating Single Sign On with legacy (desktop, terminal) applications and web based applications. The Desktop Client runs on the user’s desktop. It monitors the processes ...
    • Script Example - Using Notepad

      Script Example - Using Notepad This section introduces a basic script that interacts with the windows Notepad application. The script does three things: It inserts some text in the Notepad window when Notepad starts. It shows a message to the user ...
    • Child Windows

      Child Windows Child window commands are responsible for triggering behaviour when a dialog (child window) of the monitored process opens. WhenWindow Waits until a window (dialog box) child of the target app, whose caption matches the parameter value ...