Open file explorer window

Hello!
In extendScript to open the file explorer in a specific directory is possible with:

Folder("~/Desktop/scanner").execute();

Is there any possibility to do this with UXP?
If anyone knows any commands, please share.
Thanks.

You can pass optional parameter to getFolder() API.
For more on the getFolder() API refer getfolder(options)

However, in your case you want to directly access ~/Desktop/scanner . Directly passing this string as param is not supported. However, UXP’s domains api supports several options like domains.userDesktop, domains.userDocuments which can be passed into the getfolder() as shown below.

const fs = require('uxp').storage.localFileSystem;
let domains = require("uxp").storage.domains;
let entry = await fs.getFolder({initialDomain:domains.userDocuments});
3 Likes

@kareemmyk Thanks for sharing! Seems like a good approach, I’ll have a look around here. @thanks for sharing! Seems like a good approach, I’ll take a look here.

It appears that domains is bugged, at least in PS 24.1.0

Here are all the options available in the ‘domains’ object
userDesktop
userDocuments
userPictures
userVideos
userMusic
appLocalData
appLocalLibrary
appLocalCache
appLocalShared
appLocalTemporary
appRoamingData
appRoamingLibrary

I’ve tried a few of these, and no folder browser appears. When I use “userDesktop”, though, I get a folder browser that opens at the last location a folder browser used, not my desktop. That is the same behavior as not using any args.

Even more strange, when you import ‘domain’ using ‘let’ instead of ‘const’, then domains.userDesktop DOES work, but still none of the other options do.

Here is my code

// these do not work
const lfs = require('uxp').storage.localFileSystem
const domains = require('uxp').storage.domains

let fold = await lfs.getFolder({ initialDomain: domains.userVideos })
let fold = await lfs.getFolder({ initialDomain: domains.userDesktop})
let fold = await lfs.getFolder({ initialDomain: domains.appRoamingData})

// this DOES work
const lfs = require('uxp').storage.localFileSystem
let domains = require('uxp').storage.domains

let fold = await lfs.getFolder({ initialDomain: domains.userDesktop})
1 Like

Hi @Zob , thanks for replying, I used this example from the seed desktop video as an example, but I need this feature to be possible with any directory, like, a subfolder in the root directory of the active document whenever I export to the subfolder with I already do with jsx. @Jarda , @Karmalakas , @tomzag, @Erin_Finnegan How can we request this feature for new UXP updates?

Feature requests can go to @pkrishna. For Photoshop I’m CCing: @samgannaway

I’ve tried your code, and got the "Call fs.supportedDomains() to get a list of supported domains." error (fs is lfs in this context).

On my Mac, the supported domains returned are [userDesktop, userDocuments, userPictures], and they seem to work with either let or const.

1 Like

Hi @DavideBarranca , the same domains that work for you will work for me in windows 10 too, this would be a good alternative, for a feature that I’ve been looking for months for my use case, like opening the file explorer in the folder that contains the content generated by my plugin at the end of the event.
I found out in the link below that this feature exists and it works almost perfectly.

manifest.json

   "requiredPermissions": {
     "localFileSystem": "fullAccess",
     "launchProcess": {
       "extensions": [
         ""
       ]
     }

index.js

shell.openPath("C:/myPath")

However, I am not able to find a key in the manifest or any other method that prevents the display of the “Request For Permission” window, whenever the directory is different.
Captura de tela 2023-05-10 084215

Is there any way to avoid this window? Thanks.