Copy link to clipboard
Copied
Hi,
I'm building a UXP plugin for Adobe InDesign. I want to get the full file path of the currently open document.
I tried this:
const doc = app.activeDocument;
const filePath = await doc.fullName; // fullName returns a Promise
But I get this error:
Error: Could not find an entry of 'file:///path'
at l._getEntryImpl (uxp://uxp-internal/webfs_scripts.js:2)
Even when the document is saved, it still fails.
How can I get the file path of the active document in InDesign using UXP?
Is there any working method
Thanks!
Hello Lisa,
Thank you for your response.
Just to clarify — in UXP for InDesign, doc.fullName returns a Promise. So to retrieve the file path correctly, it’s important to use await first. Once the Promise resolves, you can then access the path using .nativePath.
const doc = app.activeDocument;
const filePath = await doc.fullName; // fullName returns a Promise
console.log("filePath:", filePath);
const filePathVal = filePath.nativePath; // Get the string path
console.log("filePath:", filePathVal);
This app
...Copy link to clipboard
Copied
you may also want to post UXP-related questions here:
Copy link to clipboard
Copied
Thank you leo.r sir.,
I’ll keep that in mind for next time. The issue has been resolved now.
Copy link to clipboard
Copied
Hello,
In UXP for InDesign, use: const doc = app.activeDocument;
const filePath = doc.fullName?.fsPath;
Works only if the document is saved.
doc.fullName is not a FileSystemEntry in UXP, so use fsPath to get the string path.
Best Regard,
lisa
Copy link to clipboard
Copied
Hello Lisa,
Thank you for your response.
Just to clarify — in UXP for InDesign, doc.fullName returns a Promise. So to retrieve the file path correctly, it’s important to use await first. Once the Promise resolves, you can then access the path using .nativePath.
const doc = app.activeDocument;
const filePath = await doc.fullName; // fullName returns a Promise
console.log("filePath:", filePath);
const filePathVal = filePath.nativePath; // Get the string path
console.log("filePath:", filePathVal);
This approach successfully retrieves the file path once the document is saved.
Thank you!
Best regards,
Ashwin Lohiya
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more