How to set the download path?

Hi All,

I am currently working on a project.
In this project after login to the web application I need to download the excel files.
after downloading the downloaded excel will save in my current local system path like,
E:/Users/Naveen/Download.

Now I need to run the code in bot machines,
so the default download path will be change i.e.
E:/Users/BOT1/Download
E:/Users/BOT2/Download
E:/Users/BOT3/Download
E:/Users/BOT4/Download
etc
I mean that the download path is dynamic so I need your help to handle this scenario, please do the needful.

@vishal.kp
@ushu
@ppr
@yoichi
@Gokul001

Hey @Vrishchik ,
Give a try to this


Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads"

Regards,

5 Likes

Hi @Vrishchik

Have you tried with Path Exist activity

Path Exists activity is used to check whether a file or folder exists in a specified path.

This activity returns a Boolean value of “True” or “False” based on whether the specified path exists or not

Regards
Gokul

1 Like

@Vrishchik

In the chrome you can set it up

Or else try with this expression for dynamic

Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads"

3 Likes

Hi @Vrishchik ,

Greetings,

May I know, on what criteria you are saving in the BOT1,BOT2 etc?

Regards,

1 Like

I mean I am currently running the code in UAT environment till now I was working in my local system.
In my local system it is default download path is C:/Users/Naveen/Download.
Which I am mentioned the same in asset as well i.e(C:/Users/Naveen/Download.)
But when I run the code in UAT environment the default download path will be change because it is not my local system, so the download path will be differ In UAT environment. I am running the multiple bots.for example bot1,bot2 etc

so the download path should be C:/Users/BOT1/Download
C:/Users/BOT2/Download
etc

Hi @Vrishchik - There are different ways to maintain these folder paths. Let’s see the first two easier methods

Method1

  • Sounds like multiple bots are trying to read the same folder path, then you can use Assets in Orchestrator to maintain the folder paths, which provides the feasibility to share the data across the bots

Note: The Asset value has to be changes based on the environment. If this is not possible, then take a look at the 2nd method

Method2

  • You can use the below exp within your code
Variable of type String Output = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) & "\Downloads"
1 Like

OK @Vrishchik ,

In this scenario it won’t be good choice to store it in the assets because it is dynamic, hence you need to declare it in the code only.

The below expression will give you the relative path related to the current user logged into the system(User name will change accordingly), in your case it might be BOT1, BOT2 etc.

Assign a variable with the below expression in the init state/beginning and pass it across the process.

Eg:-

Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads"

image

Regards,

1 Like

@Vrishchik - Did you try using the above expression. Let us know if you face any issues.

1 Like

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