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)?
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.
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.
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.