Using Uipath to automate application installers

Hello all,

I am using UiPath to automate the installation of some apps and I am using the use application activate to automate some clicks inside the installer. The problem is that the exe path changes every time the application runs in the local appdata folder and doesn’t complete the debugging due to the change of directory path. I created a variable to use in the application path field but I don’t know the correct C# sharp expression to write in order to use a dynmaic directory path

@youssef169886

What path are you trying to get?

Could you explain

Cheers

@Anil_G

I want to use UiPath to automate the installation of Citrix receiver 4.12. The problem is that the installer always uses a variable path that changes every time you open the .exe file. I want to create a variable that resembles the random path that the .exe file takes in order to install the files, but don’t know the proper C# expression for it. What can I do?

“C:\Users\youss\AppData\Local\Temp\Ctx-9D2AB674-29EA-4A7E-A578-030CA28E8AF8\Extract\trolleyexpress.exe”

“C:\Users\youss\AppData\Local\Temp\Ctx-79018053-CEC4-419E-9073-0F29AA615617\Extract\trolleyexpress.exe”

These are examples of the paths every time the .exe file runs. Not only is the user different but the path inside the appdata folder is different

Thanks!

@youssef169886

Use Directory.GetFiles("C:\Users\youss\AppData\Local\Temp","trolleyexpress.exe",SearchOption.AllDirectories)

this get the past as a list(of String) I hope from there you can work

cheers

@Anil_G
Can you please explain more on where to use this expression. Sorry I am new to this. THis is my first project with UiPath. In addition to that I am using the Get environment activity to use a dynamic path to determine the name of the user and I am using the assign activity but I don’t know what to write in the value to save field

CHeers!

@youssef169886

Use like below in assign on the right side

Directory.GetFiles("C:\Users\youss\AppData\Local\Temp","trolleyexpress.exe",SearchOption.AllDirectories).First

Cheers

@Anil_G

It returns with this error

In C# you need to escape backward slash as \\. E.g. "C:\Test\file1.txt" should be written as "C:\\Test\\File1.txt".

In your case, you don’t need to deal with slashes since you can just use Path.Combine().

Directory.GetFiles(Path.Combine(local_appdata_Path, "Temp"), "trolleyexpress.exe", SearchOption.AllDirectories).FirstOrDefault()

where local_appdata_Path is the variable/value you get from the Get Environment Folder activity.

@youssef169886

is application_path of type string?

cheers

@ptrobot
Hello!

Thank you for pointing that out to me. I made the change you mentioned. Now it returns this error

The local_appdata_Path should be set in Get Environment Folder activity.

image

The Directory.GetFiles expression is to get the Application_path.

Application_path = Directory.GetFiles(Path.Combine(local_appdata_Path, "Temp"), "trolleyexpress.exe", SearchOption.AllDirectories).FirstOrDefault()

@ptrobot
It is resolved now Thank you.
Cheers!

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