Doing with which gives more accurate results? Send Hotkey or Click?

I am develop a project that contains many excel activities.

In some cases; I can do the same with both Send Hotkey and Click. (For example, make the title line bold. I can do it with send hotkey - ctrl+b or click bold button.)

I hav noticed that both of them may getting errors some time. Which would be more accurate if I use it?

1 Like

What error it gives?
Sometimes your ribbon gets unpinned then robot may not get Copy button or any from ribbon then it will give you error
You can use Invoke VBA For excel automation

Hi
Both has its own advantages buddy
That is if we are trying to do in a normal PC or in our local machine then we can use CLICK activity
Or
If it’s a VDI or any other Citrix environment then we can surely use SEND HOT KEY ACTIVITY instead of CLICK activity as Send hot key is more reliable in Citrix environment

But in both cases we need to ensure that background running property like Simulate click in click activity and sendwindowmessage property in send hot key must be enabled

Cheers @mazlumkacar

1 Like

I got that error many times. This error occurs sometimes because of it try to make ctrl+g in excel.

@ImPratham45

That’s weird,
what error getting in click activity?

Hi @mazlumkacar

Do one thing use excel application scope and do use select range and mention the range and then try using send hot key as ctrl+b with the excel

Thanks
Ashwin S

Hi @mazlumkacar,

Eg : I have to save a Excel file. we can have 2 approaches :

  1. using Selector (click) -
    image

Click on file , Then Save : If selectors are invalid - The process breaks.

  1. Send Hotkey (Ctrl +S )

image .

Now here - If I do not specify container / selector by clicking on Indicate on Screen , and I just pass Ctrl +S . If send hotkey fails now - You won’t get exception.

I believe Its Okay to get exception and Break the Process instead of continuing and wrong Processing.

A way can be using the selector in try -and in catch if it breaks because of SelectorNotFound exception - then use hotkeys.


Mukesh

1 Like