UiARD question: "A developer wants to monitor three buttons using a Trigger Scope activity and three Click Trigger activities"

and

grafik

I know that the only possible answer can be args.TriggerName.

But maybe someone has explanations about all the others and why those options are not working. I also debugged it and had a look in the args-Object.

Strange thing was when I used args.TriggerName I did not get a proper ID value and instead some Browser generated String. So this is depending on the clickable item itself, that is being used, right?

Thanks.

Hi @kwoxer,

That is correct.
Option 3 args.TriggerName is the one which would be a string and can be used in a switch statement. The other three examples can be eliminated because

But why?

The easiest option to eliminate is Option 2 args.Equals()
Would not even be parsed by the expression in switch activity as .Equals requires a parameter and will fail if left empty as shown in the question.
image

Option 4 args.EventInfo
This object returns quite a lot of rich info such as position of the click on the window. However when such EventInfo is obtained from other than a browser, it is next to impossible to get to know the position of the cursor as the window you have a trigger can be moved and there are no communication between mouse events and relative position of click on the target window. Ok I digress.
image

Option 3 args.TriggerName
This is the the only object which a developer can pre determine the value for as this is the exact same as the Display Name of the trigger activity being used in the Trigger Scope.

For example :
image

image

When you identified your target element, may be it did not have accurate selectors so the Display Name of your trigger activity choose a value from the selector. This is automatically parsed by the UiExplorer+Studio. A way to fix this is by ensuring you change the display name of the Trigger event. Lets say, I change the Display name of my Click Trigger activity.
image

All I did was change the DisplayName of that activity
image

Now when the activity is triggered, I get a easy human readable text when using args.TriggerName
image

Option 1 args.TriggerType.FullName
This returns the activity namespaces including its root. UiPath.Core.Activitires.ClickTriggerVersionNumber. So in the question above if three Click Triggers are used each one of them will result in the same value, which will not allow a developer to make a differentiation between which of the click was for Case 1: Bank or others. In short, all you have is apples and no oranges to utilize the switch statement.
image

2 Likes

Thanks so much. Indeed that Activity name was it that confused me when I tried that. I didn’t know that it return the name of it. But now makes sense :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.