Add count of saved attachments to txt file

Hello,

I have a process where any email with an attachment is saved and then printed, at the end there is a .txt file emailed, I would like to add a count of the saved attachments and how many got printed successfully to the txt file.

Any help is greatly appreciated

thanks,
Scott

1 Like

Hi Buddy @scotthutton

  1. Once you send the mail using any send mail activity inside a sequence, add a counter to assign activity with default value as 0 before sending mail
  2. After sending mail increment it with + 1 like
    in assign activity
    counter = counter + 1
  3. Now in your text file mention inside the file where ever you want
    total count of saved attacements : {0}

Here the {0} is the index place where your assigned final counter value is going to be entered…just like format string way…buddy

  1. then with assign activity
    out_text = out_text.Format({0},Counter)
  2. Thats all buddy you are all done with count been entered

Hope this would help you buddy

Cheers

Hi @Palaniyappan

thanks for this, do you have a file you could share with me, this is still all really new to me.

Scott

I have assumed a scenario where you have multiple mails with attachments and of different formats as docx, excel or pdf and you want to extract the data and store in text file, if this your scenario refer the below steps.

  1. Use Get outlook Mail Messages
  2. Use for each mail in collection of emails , save the attachments
  3. Take the files from the location where the files are saved
  4. Use for each file in array of files and get the extension and based on the extension read the text.
    if the extension is pdf, use read pdf text with ocr, if the extension is docx, use read text of word, if extension is excel use read range.
  5. Check if output length is greatMain.xaml (20.9 KB)
    er than 0, then use append line activity to append the data.
  6. When the append line is successful have a counter to increment.

You have to change the file path, where i have hardcoded the path

Refer the below workflow for reference

No worries buddy…
@scotthutton

Kindly refer to the below zip file that could help you sort this issue

forum.zip (9.9 KB)

Hope this would help you

Cheers…

@anil5 All are PDF, I don’t need to extract any data from the files, they get saved to a location then printed. Its the count of the saved attachments I need.

@Palaniyappan thanks for this, I will give it a check

@Palaniyappan thanks again for this, I am able to run it and get the txt file, but the value comes out as (0), it needs to be able to count the attachments. Not sure if I’m missing something

Buddy can i see assign activity screenshot were you use the string format and passing value to that {0} in your process
you are almost done buddy

Cheers.!

it’s the same file as you send me, only changes made were to the email address and the removal of the 1st “send outlook message”

Was there anything that I needed to change for it to count the saved PDF’s from the location?

buddy thats {0} didyou mention as (0)
Just a small clarification before getting to this again

Cheers

I never changed anything, sorry I’m at a total loss.

1 Like

buddy just i removed the mail activities and tried whether its printing the value at the place of {0}
Its printing buddy, see

Chers

No worries buddy, kindly rerun the same workflow that i sent you disabling or removing the first and last mail activities, you can check whether the value for {0} is passed or not in write line activity
Try this buddy lets check and sort this out

Cheers

cheers - reran the workflow - the total count = 0

haha that cheers sounds good

alright check whether the counter is assigned with counter+1, because it looks much better than before

its easy buddy better send me the one that you are using now both the text file and xaml file buddy

NO CHEERS…:):upside_down_face:

the total count is showing now 1, but the txt file shows {0}

Buddy the text file is saved to a variable and we changed the value from {0} to 1 in that variable only, use a write text activity and pass that string variable as input, with new filepath where you can see the changed value as 1

Cheers

Is that working now @scotthutton

struggling with it still @Palaniyappan

No worries buddy send the xaml that you have now buddy with the text file all in a zipped file
Lets sort this out