Right click as a hotkey

I’m sending tabs as hotkeys to navigate a webpage and every X number of tabs I want to perform a right click.

I’m not sure how to do this but I figured there must be a way to send a right click as a hotkey because that would be a great solution to my problem. Is this possible?

Or if not what alternative do I have?.. is there a way to get a ui element based on what is currently being selected on screen (i.e. what I have [k(tab)]'d to on the webpage)?

UPDATE:

I figured out that SHIFT + F10 is a universal way to say “right click” with a keyboard in Windows so that works. I’d still be curious though if there is a more UIPath-centric way of right clicking without a click activity.

The Click activity has a property where you can choose “Left” or “Right”. That’s usually the UiPath way.
image

Sorry, I slightly misunderstood your question.
You would want to probably use Enumerable.Repeat() to send X number of tabs, followed by the Click activity using no selector or one that is inside the window. Then, place those 2 activities in a Retry Scope (preferably) or Do While loop.

Here is a screenie to better explain:

You will need to set the Retry properties and/or place a condition activity (like “Is True”).

Well that’s just an idea anyway, and depending on your requirement, you may take a slightly different approach using a Do While or something like that.

Regards.

1 Like

Thanks was not aware of Retry Scope. What makes it different than a While activity?

Also is your Type into basically doing a Send hotkeys (i.e. same result and you don’t need to specify a selector or element for the Type into?)? Didn’t know I could do that! Is one more preferable to the other?

Actually, just to be crystal clear: neither your Type into or your Click have a selector or element entered, right? They’re both blank… and thus just act on whatever space is currently selected/active?

The difference is that the Retry is intended to perform tasks multiple times if an error occurs or a condition is not met, and you avoid infinite loops. While loops risk that you get stuck in an infinite loop. There’s really a case to use either one, so just depends on your intent. For you, either one would work I think, but if you do use a Retry scope, and an error occurs then it will do the tab keys again, which might be a bad thing in that case.

TypeInto let’s you perform multiple keystrokes all in a chain and very fast. You could also use one Send Hotkey inside a loop or something but make sure you change the DelayBefore and After to 0 or it will be sluggish. To use TypeInto you could do something like this: "[k(tab)][k(tab)]abcdef[k(enter)]"

Just make sure you set the DelayBetweenKeys to about 20 milliseconds. However, sometimes you do need to break it up between actions (more than one activity) to be more organized and if a slight delay is needed.

You can leave the selector blank, but it will execute the action on the entire environment where the robot runs regardless of which window is active. Unless the activities are inside a scope (ie Attach Window or something), then it will perform the actions within that scope.

So yeah, hope that answers your questions.

Regards.

1 Like

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