Using a local file in different computers with possible folder differences

Hi all,

If we have a bot that we want to scale in different machines that would use, for example, a Excel file, we need it to be in catchable address for all of them.

We would like to have a variable like “$installationpath$” that would give us something like “C:/programfiles/whatever” ou “D:/whatever” for each computer that would be a starting point to make a pattern to start.

How can I do that?

Best regards,
Daniel

@Daniel_Reche You want to save variables in excel file and bots can be using those variables. Is my understanding correct?

if you want to use path as variable. You need to select ‘calculate a value’(refer the screenshot below)

1 Like

Yes, but my problem is that I want this bot to run in different computers.

Maybe computer 1 is in the “C://programfiles//whatever” but computer 2 has “D://programfiles//whatever”.

What is the best option to make it good for any computer?

Hello @Daniel_Reche I assume that these two paths in different computers are static:
For example: For computer 1, it is C://programfiles//whatever
For computer 2, it is D://programfiles//whatever

One instant solution I can think of now is, You should have ‘File found activity’ to check if file exists in “C://programfiles//whatever” (It will be true if bot is running in computer 1)else you continue to check in “D://programfiles//whatever”
Find below screenshots for better understanding.

1 Like

I think that is a good solution when we have some clear patterns.

I was considering more flexibility basing the search on the Electroneek Bot Runner installation folder, because everyone using the bot would have that.

Because we don’t have a “global variable” $Systempath$, I was trying to search in command prompt for that folder, filter the result to get the windows drive and create a folder from the start.

Still working on it, I’ll probably use your solution now.

@Daniel_Reche, I’m using the following workflow:
image

In the “Command Prompt” activity I’m using echo %HOMEPATH%.

This will give you the user´s folder and you can use it to construct your path from there.

2 Likes

Diego, thank you for your reply.

How are you dealing with cases where the local drive is not the C:/ one, because CMD answer for this command doesn’t tell me the letter of the drive?

Best regards,
Daniel

@Daniel_Reche, if you need to specify the letter you can use also: echo %HOMEDRIVE% to get the drive letter and then concatenate with %HOMEPATH% to build the full path.

2 Likes

Thank you, Diego, this will be a great solution for our problems. With this I can map whatever new computers we will have in our automations and improve resiliency.

2 Likes