Output text from Microsoft Vision Handwritten Text Activity

Hi all- I am experimenting with the Microsoft Vision activities and need some help with how to output the data. Specifically, I am using the Handwritten Text activity to read an image of a time card and extract the text.

The output variable is of the type ‘UiPath.MicrosoftVision.TextLine’. I attempted to use a For Each loop with type ‘UiPath.MicrosoftVision.TextLine’ as the argument type and Write Line ‘item.ToString’ but I am getting the following error:

Unable to cast object of type ‘UiPath.MicrosoftVision.TextLine’ to type ‘UiPath.MicrosoftVision.TextLine[]’

I have checked and confirmed that the array variable is set to ‘UiPath.MicrosoftVision.TextLine’ as well as the argument type for the array.

Any suggestions on how to see the output from this variable type?

@bsylvester

change the TypeArgument in for each activity to UiPath.MicrosoftVision.TextLine

1 Like

Thank you @Sreelatha278. This worked somewhat…but it only printed out UiPath.MicrosoftVision.TextLine for each line of text.

I am wondering if I need to parse the JSON file. This post seems to point in that direction. I am not entirely sure how to apply it though. How to achieve a neat output using Microsoft Cloud Vision API

@bsylvester

To get the text use
item.text

You can also get the position where the text was found using
item.Position.X.ToString +", "+ item.Position.Y.ToString

1 Like

Thanks @StuP - that worked perfectly :grinning:

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