No working directory in Use Application/Browser, output variable wrong type for Open Application

I’m opening a Windows application via .exe that requires the working directory set. There is no working directory property for Use Application/Browser. This is a major oversight.

So I figured I’d just use the classic Open Application just to open it and pass it out as a variable. Except the Open Application Application Window property is type UiPath.Core.Window, but the Input Element on Use Application/Browser is UiPath.Core.UiElement so you cannot pass it from one to the other.

2 Likes

Hi @postwick ,

Is it the Application Field that you were referring to?

image

image

Kind Regards,
Ashwin A.K

No. Look at the classic Open Application activity. It has three properties: application path, arguments, and working directory. Use Application/Browser only has application path and arguments.

Oh! Alright I got it.

Yep, its not present.

Kind Regards,
Ashwin A.K

You workaround works fine if you put a Find Element inside the Open Application scope (no need to set a target) and then pass found element to Use Application/Browser.

image

Another workaround is to use Directory.SetCurrentWorkingDirectory() with Invoke Method before invoking Use Application/Browser. Remember to backup the current working directory and restore it though.

Assign: oldDir = Directory.GetCurrentDirectory()
Invoke Method: Directory.SetCurrentDirectory("C:\NewDir")
Use Application/Browser
Invoke Method: Directory.SetCurrentDirectory(oldDir)

image

2 Likes

Thank you for pointing it out. It sounds like it needs an improvement.

@postwick, the Window object is a UiElement, so you can pass it on to the UseApplication browser as an input element without issues.

Regarding the working directory, I will take improvement into the backlog.

Ty,
Gheorghe

The object output by Open Application is not UIElement, it’s Window. I just tried again and it seems to allow it as the input to Use Application/Browser. I got an error before. Could be a dependency version issue.

@postwick, which application(s) require a specific working directory?

Many. That’s why Windows has the property for shortcuts etc.

1 Like

@loginerror Do you have updates on this? Open application is still used (instead of Use Application/Browser), 'cause user settings to application is loaded only with working directory option.

Something that can function as a work around on this to allow to use the “use application/process” activity

Open the application you want with the “Run Process” Activity. Run Process allows you to set a working directory. Then you can set the “Use Application/Browser” to attach to that window once it’s open.

Bit of a wonky work around but it does allow you to then use modern activities.

It’s two years later, I don’t suppose there’s a fix for this Working Directory issue about to drop? Because all the workarounds in this thread require classic activities, which seem to be gone in the current version of studio.

Or might there be another workaround for applications that require your working directory to be set explicitly?

Classic activities shouldn’t be gone. Go to the Activities pane and click the filter icon at the top. Check Classic:

image

You can freely mix classic and modern activities in your project.

2 Likes

Thanks for the suggestion! But I’m not seeing that same filter menu in StudioX Desktop Community Edition 2024.2.1:

Screenshot 2024-03-04 212838

Is there something about Community edition or, I dunno, a project type that would limit my access to classic activities? I’m new to the UiPath ecosystem so there could be something really simple I don’t understand.

It’s because you’re in StudioX. You don’t even have the same activities as regular Studio. If you’re on community edition why not just use regular Studio?

I have no idea how to install or run Studio instead of StudioX, tbh.

I signed up and downloaded UiPathStudioCommunity.msi via the one Download Studio button in the web portal and did the default install.

I ended up with a UiPath Studio shortcut on my desktop that executes C:\Users\whoever\AppData\Local\Programs\UiPath\Studio\UiPath.Studio.exe, which opens Studio X. That’s not what’s described in the install documentation, and the installer itself still says it’s going to install both Studio and StudioX, so maybe it’s something they changed recently?

Screenshot 2024-03-05 084743

There are many posts in the forums on how to switch.

Ha, thanks, I thought it was a change in licensing so I didn’t even think of doing another forum search. You’re not kidding about there being “many posts” … what a dumpster fire.

As it turns out, I had signed up using the default form UiPath wants you to use, which grants you a Free License, and the free license provides you with a nifty package including orchestrator, but doesn’t give you access to studio. So I created a new admin account in that tenant, nuked my old admin account, and re-signed-up for a Community License using the sneaky little community license link.

Now I’ve reinstalled and hey! I get to choose the Studio profile and there are all the Classic activities. I still think that UiPath needs a Working Directory setting on the App/Browser Activity, especially if they’re pushing folks toward StudioX, but it looks like changing my license and using Studio will allow me to finish this particular automation. Thanks so much @postwick !

1 Like