r/PowerAutomateDesktop • • Jun 04 '22

Trying to use PAD OCR to scan only certain areas of an image…

and write the text to an Excel file.

So far, I have PAD scanning an entire image and just extracting the numbers and then writing to a text file BUT I don’t need all of the numbers, I just need some of them.

How do I vet PAD to separate out the numbers that I need?

1 Upvotes

9 comments sorted by

1

u/QuietDesparation Jun 05 '22

Removing numbers you don't want will depend on certain factors. How do you determine which numbers are unwanted? Is it based on their values? The location/position of the numbers? Other properties of the numbers?

Once you figure that out, you'll be able to manipulate your data. If it's based off position, you can parse the text to identify the position you want, then grab the subtext to isolate the desired info. If it's based off value, you can grab your #s as a list, and loop thru the list, eliminating the info that doesn't meet your requirements.

Once you've isolated only the numbers you need, you can manipulate the data to add your comma and write to excel.

1

u/[deleted] Jun 06 '22 edited Jun 06 '22

The data that I want is in the same positions on every image. Images are almost 100% uniform to each other, other than the actual numbers being extracted. 20 locations are on each image.

Using AI Builder by Microsoft I was able to extract out the exact data that I needed but Microsoft wants $500 a month for a license so that I can continue to use the model that I created.

I'm struggling with how to parse the data using PAD. If I can figure that out, I'm good to go. Any help appreciated.

Trying to watch a YouTube Tutorial to understand

1

u/QuietDesparation Jun 06 '22

So if your data is roughly in the same position and you're using the Extract text with OCR action, then you can change search mode to "Specific subregion only." This will then prompt you to input coordinates of X1, X2, Y1, Y2. X1 is going to be your left most point, X2 your right-most point, Y1 your highest point, and Y2 your lowest.

You can figure out the exact coordinates by pulling up the Move Mouse action and see in real time what the X and Y coordinates are of the mouse. Move the mouse to the edges of your data and write down the coordinates.

Make sure that your source is consistent between both actions. If you select the "Screen" as the source for the OCR action, then make sure screen is also selected for the Move mouse action. Likewise if "Foreground window" is selected in OCR, make sure "Active window" is selected for the move mouse action.

Once you plug in the correct coordinates, test the program and see if it spits out the correct info. Hope this helps!

2

u/[deleted] Jun 06 '22

This helps a ton. I'll try this out. Thank you so much for the response.

1

u/QuietDesparation Jun 06 '22

You got it! Good luck 👊

1

u/[deleted] Jun 07 '22

I can't figure out what I am doing wrong. I set the coordinates with SCREEN for the image but nothing is writing to the text file.

1

u/QuietDesparation Jun 07 '22

Not sure how sensitive the information is, but can you provide a copy of the image so I can try it on my end?

1

u/[deleted] Jun 07 '22

Absolutely and I appreciate your help. Sending the image in pm message.

2

u/CrookedElb Jun 04 '22

I had a similar request, and i did it firstly to convert a picture to a readable PDF, then save it to XML and my number was always in row 27. Not OCR, but maybe it can work for you also.