PDF File Name in UiPath

Gurus,
I have a webpage from where I am trying to download the file. The downloaded file name will have the same name as listed on the website.

Most of the files seems to work however I noticed that when the file name is in format listed as SomeText*[MoreText]*SomeMoreText.pdf, the file is saved as SomeTextSomeMoreText.pdf. Essentially the text along with the square brackets are removed. ([MoreText] is deleted)

I am able to save the file in the desired format when directly saving from the website without using UiPath.

Question: Does UiPath perform any validations to prevent the file from being stored in the desired format.

Your timely help is much appreciated.

Regards
Kaushik

Hello @kaushiks1,

You can perform validation using regex and remove any characters that you don’t like.

Hi, how are you downloading the file? in theory uipath would not remove that, but…

@rmunro,
Yes … but it appears to me that UiPath may be doing something else with the File Name. I need to get better understanding of that before I make any further changes.

@bcorrea,
Below is the code to download the file …

so in this variable you have a text that includes a full path and those brackets? if true, then include quotes like this: """ + variable + """

@bcorrea,
Yes … Will try and keep you posted

@bcorrea,
I just tried it with no success …

humm… so uipath may be doing something indeed, try this for a test:
variable.Replace("[","-").Replace("]","-") and lets see if the text in the middle of brackets are kept

@bcorrea
That worked …

then we may have found a bug there… or a limitation at least that we cant use square brackets… even inside variables, maybe we can escape them… @loginerror do you know about this?

Ignore this comment!

there cannot be quotes in the middle of a file name…

@bcorrea - you are right!

Hi @kaushiks1

I tested it a bit and it seems like SendWindowsMessages property of the Type Into activity is the culprit. It will work if you escape the first [ with another [
So this should fix your entire filename:
.Replace("[","[[")
or just use the SimulateType option
Surprisingly, you don’t have to escape the ] the same way

1 Like

@loginerror … sure will try

1 Like

@loginerror/@bcorrea,
I am facing a weird behavior since this morning.

In the path to save I have given the full file path where I want the document to be saved. However it is not saving and it is saving in the Chrome Download location as “downloadFile.pdf” (Not the filename I gave)

I am not sure what changed but this was working as expected earlier. Thoughts on how do to overcome this are appreciated.

Regards,
Kaushik

Could you try by letting UiPath type in the path but then stop so that you can manually click the Save button?
This would allow you to see if the issue is in the path that gets typed in.

@loginerror,
I tried that yesterday and it did not work. I ended up recoding the entire thing … still not sure what happened. thanks for your help. Appreciate it much