Hi - I would like help with renaming a file, depending on the rule I set, regarding searching for specific words in the same specific place in every PDF. To clarify I have two examples below:
For example, the PDF shows a name in the 2nd line after the word “Name” within the PDF, is there a formula to make it extract the words after “Name” and rename the file with that result?
Date: 24/03/2022
Name: Amenoufy
Subject: Thank you
In this case the file will be renamed “Amenoufy”
Can I set rules to say, if after “Subject” it says “Thank you”, name the file with the words after
“name” & add the result “Thank you”. In this example it will rename the file: AmenoufyThankyou
Hope you are already using PDF Activities to read the PDF file as a String. Then you could make use of Regex Expressions to get the value of Name like Below :
Here pdfTextStr variable is the Output String from Read PDF Text Activity.
As per the Condition mentioned, we could also do the same using Regex by Checking if the two words are present in the Output String using Expression as Below :
Thank you for this supermanPunch. I am still quite lost this is my first ever automation. I downloaded the PDF reader and now i have my first step:
1 - Read DF text which I connected to the PDF sample I have.
Could you please tell me where I can enter that Regex formula?
Apologies for the wrong tag. I have successfully changed to Studio
What should I put in the “To” Tab for the VB expression provided:
System.Text.RegularExpressions.Regex.Match(pdfTextStr,“(Name:).*”,RegexOptions.IgnoreCase).Value.ToString.Trim
2)How can I add the pdfTextStr as a variable output string and where should I add it?
How can I rename the file with the output provided?
I would very much appreciate it if you can walk me through the solution to get the output please. Maybe by perhaps creating the actual workflow so i can see it successfully made.
I am now trying to extract a series of numbers from a PDF text that are in this format:
20220101_1234
They will always be 8 digits + “_” + 4 digits (different in each PDF)
After I retrieve that number, I will need to look for that number in an excel, where it will be under “ColumnA”. From there I need to get the data that is in “ColumnB” and rename the file with that.
For example:
Step 1: Retrieve the 8digits_4digits from PDF - In this example: 20220101_1234 from the PDF
Step 2: Search this number in the Excel under column name “ColumnA” (the excel is constant) to retrieve the numbers from “ColumnB”: In this example I find numbers 0002 under “ColumnB”
Step3: Rename the file with the numbers retrieved from “ColumnB”: In this example the file will be renamed 0002