Newbie here needs help on this:
There are 6 pdf files (can be up to 200) in this folder - C:\1
Their files names are:
ABC_123A.pdf, DFE_578B.pdf, SDF_246Z.pdf, GFD_578B.pdf, XYZ_123A.pdf, COP_246Z.pdf
I need to create a bot to do this:
Create 3 draft emails, each email with 2 of the above-mentioned pdf files attached.
The pdf files to attach must have filenames ending with the same last 4 characters.
For example, one email will have DFE_578B.pdf and GFD_578B.pdf and similarly for the other 2 emails.
Thank you in anticipation
use directory.getfiles(mainfolder) this will give array of all files
Now extract the end values using system.text.regularexpressions.regex.match(string.join(“,”,arrayoffiles),”_*.pdf”)
This will give all the matches. Get the unique matches from this and use a loop and inside loop use direct.getfiles(mainfolder,”item”) will give you all files with same ending
Use the email in the same loop to attach and send
as I am a newbie,
I have completed the directory.getfiles(“c:\1”) by assigning to a variable: Filenames (Array of String)
for the 2nd part of extract end values, how to do? what activity do I use?:
arrayoffiles - I replace with my Filenames variable?
string - I replace with what?
Note: the last 4 characters of the pdf files is not fixed but there will always be a pair of pdf files with the same last 4 characters
You are on right path… give this in another assign with variable of type match collection(resultMatch) =
String you needed not replace in the above…only replace arrayoffiles as you said
Initialize a string variable (str1)with string.empty
Now use a loop with type argument as match And give the in argument as resultMatch
This will loop through all the results.
Have a if condition like str1.contains(item.value)
In true write nothing in false do getfiles with match.value as pattern and do your emails and alao use assign to add the string to str1
Str1 = str1 + match.value
Thanks for the encouragement, Anil
Can only have time to try out the other parts in the evening.
Anytime…happy to hep and guide…try it and reachout if you have issues… happy automation
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.