Service Trigger

Description

Launches a task when the specified service starts, stops, pauses, resumes or stops responding. You can select a currently running service by way of the provided drop-down or enter the service name manually. To indicate partial service names, wildcard characters can be used (for example,. * or ?).

Practical usage

Frequently used to monitor service applications for unexpected crashes. For example, if the specified service suddenly stops, a task can launch and execute a Services - Start activity to restart the service as well as run a Email - Send message activity to email a message regarding service stoppage to the appropriate recipient.

Related Topics  

Parameters

General

Property Type Description
Service state Options Specifies the service action to monitor. The available options are:
  • Stopped responding - The task will run when the specified service stops responding, "hangs" or crashes.
  • Started - The task will run when the specified service is started.
  • Stopped - The task will run when the specified service is stopped.
  • Resumed - The task will run when the specified service is resumed (started again after being paused).
  • Paused - The task will run when the specified service is paused.
  • Installed - The task will run when the specified service is installed.
  • Removed - The task will run when the specified  service is removed.
Service name Text Specifies the name of the service to watch. The provided combination list box accepts manual text entry or the service can be selected from the drop-down list of open services. Wildcard characters * and ? can be used to indicate partial service names. For example, entering e*.exe will watch for all processes starting with the letter e.
Include device and file system drivers in list Yes/No If selected, device and file system drivers will be included in the list of services.

Behavior

Property Type Description
Enable Trigger Yes/No If selected, the trigger will immediately be active upon creation. If disabled, the trigger will stay inactive until it is manually enabled. This parameter is selected by default.
Trigger on startup if condition is true Yes/No If enabled, the system will act upon conditions that already exist upon startup of the current trigger. For example, if the Notepad window is already open on the desktop, a newly created Window trigger set to monitor for the existence of a Notepad window will immediately launch the task as a result. If disabled, the trigger will ignore the open Notepad window upon startup. This parameter is disabled by default.
Trigger after the condition has been met Text If enabled, specifies how many times the trigger condition must be met before the task is started. For example, if a Window trigger is set to monitor for the appearance of a Notepad window and this parameter is set to 3, the task will not launch until the third instance of Notepad appears on the desktop.

Additional notes

AMTrigger

When this trigger is activated, it automatically passes the AMTrigger object to the task. AMTrigger is a standard Automate Desktop dataset and can be used much like the datasets created by the Database - SQL query activity and Email action. The fields of AMTrigger can be used within a task to determine specific values, such as whether or not the task was started by a trigger, which trigger started the task, when the trigger was activated and other properties. AMTrigger populates a unique set of field–value pairs for each Automate Desktop trigger. The following table lists the ones specific to this trigger. For more details about a specific AMTrigger field–value pair, click the associated link.

Name Type Return
AMTrigger.Action String Returns the action that took place to cause the task to trigger.
AMTrigger.FileName String Returns the full path and file name (also known as Path to executable) of the service that activated the trigger.
AMTrigger.ServiceDisplayName String Returns the Service Display Name of the service that activated the trigger.
AMTrigger.ServiceName String Returns the Service Name of the service that activated the trigger.
NOTE: A full list of AMTrigger objects exclusive to each trigger can be viewed from the Expression Builder by expanding Objects > Triggers and selecting the desired trigger.