File Picker not working in Windows

I have a plug-in that I developed on a Mac, and I’m installing it now onto a Windows machine. I can’t get the file picker from getFileForOpening to work on Windows.

To illustrate the issue, here’s a bit of code I ran in a UXP debug console on both machines:

const fsProvider = require('uxp').storage.localFileSystem;
async function getPath() {
  selection = await fsProvider.getFileForOpening();
  console.log(selection.nativePath);
}
getPath();

On the Mac, the system file picker opens, and, after I select a file, it prints the file’s path to the console.

On the Windows machine, the file picker never opens. getPath() returns a pending promise that never resolves.

The manifest file for my plugin has "localFileSystem": "fullAccess".

The code is the same in the Mac and Windows plug-ins. On the Mac, I can get getFileForOpening to work both from an in-progress plug-in in UXP Developer Tools and from a finalized, packaged plug-in in InDesign.

Do any Windows devs here know of any OS-level security setting that may be causing an issue? The OS version is Windows Server 2022 Standard.

Maybe there’s something else I’m missing?

1 Like

Would adding await to getPath() improve it?

await getPath();

Strange, my InDesign plugin has similar code for opening a file and works fine on windows. I have the flag set in my manifest like this (do you have the requiredPermissions part?):

  "requiredPermissions": {
    "localFileSystem": "fullAccess"
  },

Okay, I figured it out. It was an issue with the OS settings.

I had similar issues when installing InDesign on the machine, and I had followed this advice: CC Installer: JavaScript is disabled. Please enable JavaScript and try to sign in again

To fix this particular issue, I opened Control Panel > Network and Internet > Internet Options > Security > Custom Level... > Scripting, and set all of the options to Enable.

Now the file picker opens up just fine in my plug-in.

Hope this helps someone else!

2 Likes