Search and print pdf files from each email in Outlook


I got multiple invoices in 1 order number, could workfusion assist to do it

  1. Search order number in Outlook email
  2. Print pdf file from each email

Hi @gia_my_tran as I see the other number differs

You can try to do it using “For Each” loop.

@gia_my_tran also, if you don’t know how many emails there will be in advance, you can use a While loop.

All emails in the list have different instances: 1st email - instance 1, 2nd - instance 2, etc, so you can click on all of them using the selector [CLASS:LeafRow; INSTANCE:${instance}] where ${instance} is a number variable.

So you can:

  • open outlook and search for the emails you need

  • use While loop with Boolean variable (while the bot can find the selector to click on)

  • in the loop, try to click on the selector and perform the actions to print the attachments, and the end increment instance number by 1

  • If an exception occurs, set the value of the Boolean variable to “false”, so the loop stops

Here is a script you can use as a basis and modify for your use case. (2.8 MB)