SetText activity, Specified cast is not invalid

Hi all,

When I use the SetText activity in the Outlook To field, An error has occurred “The specified cast is invalid”.
We used the IndicateElement of the SetText activity to select the To field. Actually selector is valid.
The selector is as follows.

<wnd app='outlook.exe' cls='rctrl_renwnd32' title='無題 - 会議 ' />
<uia automationid='4109' cls='RichEdit20WPT' name='必須' />

To resolve the error, I edited the selector as follows, without using IndicateElement.

<wnd app='outlook.exe' cls='rctrl_renwnd32' title='無題 - 会議  ' idx='*' />
<wnd ctrlid='4109' />

It’s strange that a cast Exception occurs in the set text activity.
The error has been resolved, but I feel that there is an error in the IndicateElement.
It is inconvenient that the function cannot be used.

Studio version is v21.10.0.0

Welcome to the UiPath Forum @hirokichi!

Firstly, there’s was a known issues that indicate elements works on the second time only. Can you confirm other parts you are able to detect at once? And I see the elements in selector got reduced, so that was simply by indicate element of you altered the selector?

The type cast error comes while we convert the one data variable to another incorrectly. i assume the Set Value was putting a value that is not as a correct string, check if that string has any special character?

Secondly, i wonder why are you using UI automation on Outlook? You can use the Get email ans send email activity from UiPath.Mail.Activities

Also you can use Copy to clipboard activity and then paste using hoktkey (ctrl +v), to avoid any language related issues

Below knowledge base will help

Hi,

The matter can be reproduced in my environment. It seems you use UiAutomation Package 21.10.0-preview, right? As it’s preview version, it might be better to use stable version (UiAutomation Package 21.4.4), if you have trouble.
Or you can also use explicit AA mode (Click F4 to change AA mode as the following) It will probably work.

img20211011-2

Hope this helps you.

Regards,

Hi

Welcome to uipath forum

Did we try directly with OUTLOOK or EXCHANGE based activities to pass the field value

Or

Instead of set text we can try with TYPE INTO activity as well

Or

We can use SET TO CLIPBOARD where pass the input value and paste it with SEND HOT KEY activity using keys ctrl+v

Pls give a try with these simple methods and let know for further queries or clarification

Cheers @hirokichi

Thank you for your response and advice.

there’s was a known issues that indicate elements works on the second time only.

I would like to know more about the above issue. Is it possible to provide a link?

check if that string has any special character?

The target string does not contain any special strings.

Also you can use Copy to clipboard activity and then paste using hoktkey (ctrl +v), to avoid any language related issues

I will definitely give it a try.
Since hotkey also uses IndicateElement, I guess that the error will occur.

Best regards,

Thank you for your response and advice.
Could you share a link about AA mode knowledge?

Thank you for your response and advice.

I will give it a try.
However, I’m wonder of the functionality of the IndicateElement.

1 Like

Hi,

AA is Active Accessibility. If you want to know it deeper, the following helps you.

Regards,

Once you open a new window to send an email

You will have a structured screen. You can use attach browser/window and then simply send sufficient HotKey to reach the desired TO field and then use ctrl + v to paste the address (you can load the address in clipboard using Set to clipboard)

Also can you please let us know ehy you are not using the Mail.Activities package? We have outlook, exchange already configured via API in there.

Regarding this

That issue is raised by us at enterprise level to technical support team and they confirmed it is common behavior on few applications.

As far aa best practices are concerned, never go for UI automation on Microsoft’s Desktop applications. Already UiPath covered a lot and if not then you can always create custom activity.

Regarding your case, I think you should go for Outlook activities

We created UiPath hands-on materials to educate beginners. In the UiAutomation chapter, to operate the Outlook screen. So far, we haven’t had any problems with the material, but this time I’m having trouble with such an error.
Yes, I know that MailAcitivty should be used for Outlook operations.

If the error depends on a version of UiPath, We will update the material not to use that version.

Thank you for your help.
We will check the link!

Best regards,

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