The Power of AutoMate Triggers

by Marjo Martinez, in Tech Talk, posted 11/24/10

Overview

In AutoMate 7, Triggers are are closely correlated with system, application and network events that transpire on an AutoMate server. They are objects that monitor the occurrence of specific system events or conditions and cause a task to execute automatically as a result. You can set a trigger to run a task based on a particular schedule, when a change occurs on the file system (such as when a file is added or removed), when a particular window opens or closes, when an entry is written to the system event log or upon the occurrence of a variety of other events or conditions. When a task is "triggered" the steps of that task (comprised of AutoMate actions) are executed. In short, triggers are the objects that make AutoMate tasks entirely automated.

Adding Triggers to a Task

A trigger can be easily added to a task via the Triggers tab of the Managed Task Propertieswindow.

  1. From the Task Administrator, right-click the task you wish to add a trigger to and select Propertiesfrom the right-click menu that appears.
  2. Navigate to the Triggers tab and select Add. A window appears titled Triggers.
  3. Select the type of trigger you wish to add and click OKor simply double-click the desired trigger.
  4. The properties dialog of that trigger appears where you can enter specific settings. After doing so, click OKto save changes and close the properties dialog, completing the process.

Multiple triggers of the same or differing types may be attached to a single task. For example, if a task should run once daily, add a Schedule trigger. If it should also run when a certain file is added to a specific folder, simply add a File System trigger as well. Attaching multiple triggers acts as an "OR" condition (as opposed to "AND") whereby either of the trigger events that occur will launch the task.

All Available Triggers

AutoMate encompasses a total of 12 triggers, each with the ability to monitor for specific system occurrences. The table below lists each trigger (in alphabetical order) along with a brief description.

Name Description
Event Log Trigger Launches a task when the monitored event is added to the Windows Event Log.
File System Trigger Launches a task when one or more files are added, modified or deleted in the folder specified. It can also trigger execution when a number of files exceed the amount specified, when one file size exceeds the amount specified or when the total size of the folder exceeds the amount specified.
Idle Trigger Launches a task when no keyboard or mouse input occurs for the specified period of time (i.e. the system is idle).
Key Trigger Launches a task when a hot-key combination is pressed or a specific word is typed on the keyboard.
Performance Trigger Launches a task when a system or process threshold (i.e. CPU or memory usage) is met.
Process Trigger Launches a task when the specified process starts, ends or stops responding.
Schedule Trigger Launches a task at the date, time or interval specified. This trigger can be used for scheduling tasks to run at night or at the end of every work-day, week, month or other time frame.
Service Trigger Launches a task when the specified service starts, stops, pauses, resumes or stops responding.
SNMP Trap Trigger Launches a task when a SNMP (Simple Network Management Protocol) trap is received.
Startup Trigger Launches a task when the AutoMate task service starts or when a user logs onto the system.
Window Trigger Launches a task when the specified window opens, closes, is focused or loses focus.
WMI Trigger Launches a task when a WQL (WMI Query Language) query executed on the agent machine returns true or more than 0 rows. Queries built using WQL are used to manage and control the WMI Service.

AMTrigger

The functionality of triggers does not end after they fire off a task. When a task is triggered, it automatically creates a dataset called “AMTrigger”. This dataset can be used within the steps of the triggered task to determine specific system states or examine particular characteristics about the trigger that initially launched the task. This includes information such as the type of trigger that launched the task, the date and time when the trigger transpired, which machine the trigger occurred on, whether that machine was currently in a locked or logged off state during the occurrence and other pertinent information.

AMTrigger is a standard AutoMate dataset which can be used much like the datasets created by the SQL Query or Get E-Mail actions. Conceptually, the data in a dataset is laid out like a table and is accessed in much the same way (i.e. by specifying the column and row where the data resides). The fields of AMTrigger can be used to examine properties of the specific trigger that caused the task to launch. For example, using a 'Message Box' activity with the Message to displayparameter set to:

%AmTrigger.Trigger%

would display a message dialog during task execution that shows the name of the trigger that launched the task.

Common AMTrigger Parameters

Each trigger contains its own set of unique AMTrigger values. Therefore, the total number of fields that AMTrigger creates during runtime and what they are named depends largely on the type of trigger that launched the task. However, every instance of AMTrigger is populated with a list of common fields. They are listed in the table below:

Name Data Type Return Value
AMTrigger.Trigger Text Returns the name of the trigger that fired off the task. Each trigger contains a unique name. They are listed as follows: AMEVENTLOGTRIGGER– Event Log Trigger AMFILETRIGGER– File System Trigger AMIDLETRIGGER– Idle Trigger AMKEYTRIGGER– Key Trigger AMPERFORMANCETRIGGER– Performance Trigger AMPROCESSTRIGGER– Process Trigger AMSCHEDULETRIGGER– Schedule Trigger AMSERVICETRIGGER– Service Trigger AMSNMPTRIGGER– SNMP Trap Trigger AMSTARTUPTRIGGER– Startup Trigger AMWINDOWTRIGGER– Window Trigger AMWMITRIGGER – WMI Trigger
AMTrigger.TaskName Text Returns the name of the managed task that the trigger was attached to. Useful to determine the responsible task when two managed tasks point to the same AML file.
AMTrigger.TriggerredDateTime Date Returns the date and time when the triggered event occurred.
AMTrigger.TriggeredOn Text Returns the machine name where the triggered event occurred.
AMTrigger.WasLocked Boolean If the workstation was locked when the trigger occurred, the value returned is 1. Otherwise, it will return 0.
AMTrigger.WasLoggedOff Boolean If the workstation was logged off when the trigger occurred, the value returned is 1. Otherwise, it will return 0.
AMTrigger.AML Text Returns a verbose set of information about the triggered event or condition in AML (AutoMate Markup Language) format.

NOTE: A full directory of AMTrigger objects exclusive to each trigger can be viewed from the AutoMate Task Builder by accessing the Expression Builder, expanding Objects -> Triggers and selecting the desired trigger.

Conclusion

AutoMate is a powerful software platform that primarily focuses on supplying a complete, all-in-one system for the development, deployment, management and automation of simple to elaborate business and IT processes. Its intuitive, drag-and-drop based graphical interface provides businesses of all sizes with a true rapid-development platform for streamlining business operations executed on the desktop that requires no programming knowledge to use and maintain. The fact that it encompasses a variety of intelligent triggers that can provide important information even after it launches a task makes AutoMate an even more powerful tool to completely automate elaborate tasks and activities, altogether eliminating the need to write code.