"Parallel" activity

Created by akaBot Support, Modified on Thu, 12 Sep, 2024 at 3:39 PM by akaBot Support

1. Activity Program Name

System.Activities.Statements.Parallel

2. Description

  • Studio Version ~2.0.2.0
    • Quick Access: "Toolbox" > "Control Flow" > "Parallel"
  • Studio Version 2.0.3.0~
    • Quick Access: "Toolbox" > "System" > "Control Flow" > "Parallel"

The Parallel activity allows independent execution of child activities after the parent activity runs. Once executed, separate jobs are created for each process. If a child process is called but not found, an error containing the child process's name is logged. If an error occurs after the child process is called, the parent process continues execution without being affected.

3. Properties

Property Category
Property Name
Input Field
Description
Others
Public
Checkbox
Logs the variables and arguments inside the activity to the log file and pushes it to the Center (Refer to "Public Property" for details).
Completion Condition
Input (Boolean)
Condition required to execute subsequent activities.

Display Name
Input (String)
Reflected as the activity name in the designer panel.

4. Usage

We'll explain the usage of the "Parallel" activity using an example.

Example: Open Notepad, save with a name, and overwrite if a file with the same name exists

In this example, we will follow these steps:

  1. Open Notepad.
  2. Use the shortcut (Ctrl+S) to save with a name.
  3. Use the Parallel activity to handle:
    • Save if the file "test.txt" doesn’t exist.
    • Overwrite the file if "test.txt" already exists.
  4. Display a message box.

Step 1: Open Notepad

To open Notepad, drag and drop the "Window Application" > "Open Window" activity into the designer panel.

We will open Notepad by specifying the file path. In the "Input > File Name" property, input "C:\Windows\system32\notepad.exe".

Step 2: Send the Save Hot Key

Next, drag and drop the "Send Hot Key" activity from "Window Application" into the designer panel.

To send the hot key for saving, check the "Others > Ctrl Key" property and input "S" in the "Others > Key Argument" property.

Step 3: Enter the File Name

Next, drag and drop the "Input Text" activity from "Window Application" into the designer panel.

After placing it, proceed with "Pick target element" within the activity and select the text area element for "File Name". (At this point, manually open Notepad and display the "Save As" popup. Make sure to delete the default file name before selecting the element.)

To input the file name, enter "test.txt" in the "Input > Text" property.

Step 4: Use the Parallel Activity

Next, drag and drop the "Parallel" activity from "System" > "Control Flow" into the designer panel.

Step 4.1: Configure the New Save Action

First, configure the action for saving as a new file. Drag and drop the "Click" activity from "Window Application" into the "Parallel" activity.

Once placed, proceed by selecting " Pick target element" and choose the "Save" button. After selecting it, save the file as "test.txt" and close Notepad.

After specifying the element, manually save the file as "test.txt" and close Notepad.

Step 4.2: Configure the Overwrite Action

Next, configure the action for overwriting if the file with the same name already exists. Drag and drop another "Click" activity from "Window Application" into the "Parallel" activity, placing it to the right of the previously placed "Click" activity.

At this point, reopen Notepad, name the file "test.txt," and click the "Save" button. Since "test.txt" already exists, a confirmation popup will appear. Proceed as before by selecting 

"Pick target element" and choose the "Yes" button. After selecting the element, close Notepad.

Step 5: Set the Continue on Error Property

Once the element is specified, set the "Common > Continue On Error" property to True.

Step 6: Add a Message Box

Next, drag and drop the "Message Box" activity into the designer panel.

In the "Input > Text" property, enter "End".


Completion

The workflow is now complete. Before running it, make sure to delete the "test.txt" file you created earlier.

Once deleted, click "Home > Start" or press the F5 key to execute the workflow.

  • First Execution: Since the file doesn’t exist, it will be saved as a new file, and a message will be displayed.
  • Second Execution: Immediately after the first execution, if you close "test.txt" and run the workflow again, the file will be overwritten since "test.txt" already exists, and the message box will be displayed.

Instead of manually closing "test.txt," you can place a "Close Window" activity either above or below the "Message Box" to handle this.

If the workflow runs too fast to observe, consider adding a "Wait" activity between steps to delay execution by a few seconds.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article