Need help to exclude a condition

Hello there,

Let me explain a little bit of my code. Bot goes to a website to download files under attachment and under image scan, here are the scenarios that can happen:
Scenario 1: Attachment 1 exists, Attachment 2 exists, Image Scan exists
Scenario 2: Attachment 1 does not exist, Attachment 2 does not exist, Image Scan exists
Scenario 3: Attachment 1 exists, Attachment 2 does not exists, Image Scan does not exists
Scenario 4: Attachment 1 exists, Attachment 2 exists, Image Scan does not exists
Scenario 5: Attachment 1 exists, Attachment 2 does not exists, Image Scan exists
Scenario 6: Attachment 1 does not exist, Attachment 2 does not exist, Image Scan does not exist

Scenario 6, the bot needs to save the whole page as PDF, since there is no file to download. Scenario 2 is what I need help. If the file is a jpg, I need the bot to save the page as PDF, instead of saving the jpg file, but the code I have, the bot keeps downloading the jpg file. This is the condition I have

If there is no attachment but there is an image scan that does not contain .jpg, save the file
image

If there is no attachment and the image scan contains .jpg, save as pdf
image

Any ideas what I am doing wrong? This is my first automation

@NathaliaFawcett

Just use

image_scan.ToLower.Contains(".jpg")

Cheers

It didn’t work, still tried to download the attachment.

@NathaliaFawcett

May I know what do you mean not working?

Did you happen to pront imagescan variable

Cheers

If the attachment is jpg, I want to save the page as PDF, not click and download the file. Right now, the bot is downloading the file instead of saving the page as PDF.
So one scenario is image scan is anything besides jpg (pdf, excel, email) than we download the file. The other scenario is image scan is jpg, so we save page as pdf.

What do you mean by pront imagescan variable?

@NathaliaFawcett

You are checking image_scan contains .jpg or not right…may be the value coming in it is completely wrong

May be get text is failing or so or is not getting extension

Cheers

Hi @NathaliaFawcett

Try this:

If
  Not imageScanFileType.ToLower().EndsWith(".jpg")
Then
    process to save as PDF
End If

Hope it helps!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.