Trigger Activities
Triggers define actions to be executed at any instance of the configured events. IntelliBuddies supports two ways of defining triggers.
- Action to instantiate a specific job on specific event using our Control Room Triggers and Assistant Buddy Triggers
- Action to execute a body of activities inside a process on a specific event using our Trigger Activities
This tutorial section concentrates on the second part of Triggers using Activities. IntelliBuddies support the following three types of trigger activities.
1. File System Trigger
Create a File System Trigger activity to monitor various file actions such as creation, modification, deletion, or renaming.
Here is an example process that monitors the My Documents folder and catches all file events. This is done by checking the events using TriggerEventArgs and specific FSEventArgs parameters within the context of the Trigger Context activity. The trigger event is checked with switch and the change file information is displayed using write line activities. It exits the trigger using Break Trigger after it triggers for five times by checking the counter.
2. Hot Key Trigger
Use this Activity to check the key(s) pressing, and on pressing the appropriate key(s), the Trigger Context executes the sequence of activities in its Body.
Here is an example process that monitors the key(s) pressing (Alt-B, Shift-W, and Ctrl-End). In the body section of Trigger Context Activity, the events are checked with the help of TriggerEventArgs and specific HotkeyEventArgs parameters. Checks the event using switch and displays the key press information using write line activities. It exits the trigger when user presses the Ctrl(key modifier)-End(key) using Break Trigger activity.
3. Process Trigger
Use this Activity to monitor whether a particular process is opened or closed in the Scope (Machine and User) chosen. The Trigger Context executes the sequence of activities in its Body by checking the type.
Here is an example process that monitors the opening and closing of notepad.exe
application. In the body section of Trigger Context Activity, the events are checked with the help of TriggerEventArgs and specific HotkeyEventArgs parameters. Checks the event change type using switch and displays opening and closing of notepad application information using write line activities.
Come, let's create all the above three types of triggers process in Process Designer:
Step#1
Launch and create a new process in Process Designer
- Launch Process Designer from the Windows Start menu located under IntelliBuddies Enterprise
Step#2
Create New Process
Click on New Process and fill in the new process details
Step#3
- In Activity panel search for Trigger Context, drag and drop activity to main panel.
Step#4
Drag and drop File System Trigger inside the Trigger section of Trigger Context activity.
Set the folder path for monitoring. Here it is set to My Documents folder.
Set the Filter property with the file type. For example: Setting the file type to ".txt" triggers only text file action events.
Drag and drop Hot Key Trigger inside the Trigger section of Trigger Context activity and check the keys mentioned in below screenshot.
Drag and drop Process Trigger inside the Trigger section of Trigger Context activity.
Set the process name as `notepad.exe' for Process To Monitor.
Step#5
- Add Sequence activity one each to check three types of trigger actions in Trigger Context body section.
- Drag and drop If Else in each Sequence added above.
- Add condition to check appropriate trigger type in each If Else
- In the File System Trigger, a counter variable is added to keep the count of trigger and exit after the fifth execution.
- In Hot Key Trigger Break Trigger Context is added for keypress Ctrl-End to exit from the trigger
Step#6
In Activity panel search and drag and drop Switch Case activity one each to check three types of trigger change type in If Else block.
Check ChangeType in Switch expression and add a case for each action type File System(Created, Deleted, Changed, and Renamed), Hot Key(check for keys mentioned in trigger section, which are Alt-B, Shift-W, Ctrl-End), Process(Start, End)
Step#7
Save the process
- From the Design tab ribbon, click on Save
Step#8
Run the process
- From the Design tab ribbon, click on Run
Step#9
Ensure the process executes and waits for appropriate trigger actions
File System: Captures file action in the configured folder (My Documents) and displays the appropriate message as per the trigger.
Hot Key: Captures Hotkey pressed and displays appropriate message.
Process Trigger: Captures process open and close and displays an appropriate message.