Desktop Scripting

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 process (application) is running

  • Child Window Responses
    • Script behaviour to be invoked when dialog boxes open

  • Main Window level commands
    • Commands to run against the application’s main window

This section only gives a flavour of the commands mentioned, the reference section and examples give full details on their use.

Error Directive

The OnError directive is used to control how any errors are handled and whether they are shown to the user.

The options are to either stop all processing or to continue with it and, independently, to show, or not show, the error to the user.

For example, the following will stop the script processing and show a notification to the user.

OnError Terminate AlertUser

The OnError directive may be used at multiple points in a script. It is possible that a command in a script throws an error if an application is in a specific state, but that this is not fatal to the execution of the script. In such cases it may be preferable to temporarily change the error handling to permit this.

// Do not stop the script and do not
// inform the user of the error
OnError Continue

<Some command(s) that may cause a recoverable error>

// Switch back to normal error handling
OnError Terminate AlertUser

Process Start and Identification

The Process Start and Identification section is responsible for ensuring that the Desktop DSL Script knows which windows process is to be handled by the remainder of the script, it is comprised of two commands, always in the following order:

StartProcess <options>
WaitProcess <option>

A Desktop DSL Script may be triggered by a windows app in one of two ways:

  1. The user clicks on a tile in their Vault.

  2. The user starts an application via a desktop shortcut or command line.

If the user clicks on a Vault tile, then this means that there is not a windows application (process) currently running. Therefore, the script must start the appropriate process. This is performed by the StartProcess command.

The WaitProcess command is used to prevent any further processing of the script until the Desktop Agent is sure that the required process is running.

Getting the start and wait processes commands correctly configured is essential to allowing the remainder of the script to work correctly. Many line of business applications use a pattern where the process that is started is not the process that the user interacts with, the Desktop DSL refers to this as a Morphing process. The detailed notes on the command reference and the examples show how this should be configured.

Alternatively the script may open a URL in the user’s default browser.

Child Window Responses

The WhenWindow command allows you to define a set of script commands that are only run when a child window of the application comes to the foreground.

There are options to allow fine control over matching the target window, e.g:

  • The caption of the window.

  • The existence of specific controls within the window.

  • Text on controls within the window.

Main Window Commands

The main window commands are those that interact with the controls on the current application window, e.g.:

  • Send text to the current control.

  • Select a control.

  • Send a mouse click.

  • Force a window to the forground.

  • Pause the script for a period of time.

  • Present the user with a dialog box to control the login (used for Flash and java based web sites).

  • Show a message to the logged in user.

  • Write a message to the log file.

    • Related Articles

    • Desktop Scripting Overview

      Purpose The My1Login Desktop Scripting language is a Domain Specific Language (Desktop DSL), targeted at controlling and responding to Windows desktop applications, with the aim of injecting user credentials that are stored in the My1Login system. It ...
    • Commenting Desktop Scripts

      The Desktop Scripting Language supports both inline and block comments. Inline Comments C# / C++ style single line comments are supported. Any text starting with two “/”s is ignored to the end of the line. Example: // This is a comment UnSelect // ...
    • 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 ...
    • Defining a Desktop App Template

      Desktop Template Definition The desktop application template is defined in the My1Login admin area (the script has been omitted from this view). Setting Explanation Name The template name, user bookmarks have their title defaulted to this value. ...
    • Desktop Client Commands

      Table of Script Commands Command Description AlertInfo / AlertError Commands to show text messages to users. BringToForeground Attempt to force the main app window to desktop’s foreground. InteractiveSelectBookmark Allows manual intervention when ...