I want to set my current directory to whereever my main workflow is located.
I was going to use invoke method SetCurrentDirectory but I’m not sure how to do it or if that is the right way (I thought if I just ran the invoke method from within the main workflow it would pick up the path to the current workflow and change the but it doesn’t do anything so obvioulsly this is the wrong approach)
Any ideas please?
I want to save a file in a relative path but because my current directory is not what I want it to be (lets say downloads directory) I can’t do a relative save.
You can use the Environment.CurrentDirectory property to get the runtime location of your process (Main.xaml). Then, you can concatenate the relative path with the current directory to save the file.
For your activities you can use also relative paths. For example, if you want to read an excel file stored in the same folder as the main.xaml, you can just specify the excel file name (the relative path) in the Read Range activity. But, if you want to download a file in IE, you need to use the absolute path in the Save As dialog (as the relative refers to IE application and not to UiPath process).
Your workflows is running fine on my computer.
Where do you have the Main.xaml file? Is in the same project with the others? Because I saw that in the Invoke Workflow activities you use the full path, which is an indication that the workflow is in a separate project.
I checked in this Screenshot, There is no any project.json file.
Can you please check in your desktop location, There must be any project.json file available.
CurrentDirectory will return you the Path of where project.json file is located in your parent folder. So just create new project or move your project.json file to your project location.