const
{
ExportFormat
,
app
}
=
require
(
"indesign"
);
const
{
File
}
=
require
(
'fs'
);
class
exportUtils
{
async
exportToEpub
() {
try
{
let
doc
=
app
.
activeDocument
;
let
fullName
=
await
doc
.
fullName
;
console
.
log
(
fullName
);
// Directly log the fullName
let
epubFileName
=
fullName
.
toString
().
replace
(
/
\.
[^
\.
]
+
$
/
,
".epub"
);
doc
.
exportFile
(
ExportFormat
.
FIXED_LAYOUT_EPUB
,
new
File
(
epubFileName
),
false
);
}
catch
(
error
) {
console
.
error
(
error
);
}
};
}
```
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
UXP tries to mimic the full browser experience including all security circus.
See your promise details, maybe something about PromiseState "rejected" and PromiseResult Error: Could not find an entry … ?
This could be about missing permission requests in your manifest.
If your await works in an UXP Script, the difference is described here:
https://developer.adobe.com/indesign/uxp/resources/fundamentals/manifest/
More details for plugins:
https://developer.adobe.com/indesign/uxp/plugins/concepts/manifest/
...
/t5/indesign-discussions/uxp-plugin-promises-are-forever-pending/m-p/14387419#M559617
Jan 29, 2024
Jan 29, 2024
UXP tries to mimic the full browser experience including all security circus.
See your promise details, maybe something about PromiseState "rejected" and PromiseResult Error: Could not find an entry … ?
This could be about missing permission requests in your manifest.
If your await works in an UXP Script, the difference is described here:
https://developer.adobe.com/indesign/uxp/resources/fundamentals/manifest/
More details for plugins:
https://developer.adobe.com/indesign/uxp/plugins/concepts/manifest/
Basically you need:
"requiredPermissions": {
"localFileSystem": "fullAccess"
}
General info on Files the UXP way:
https://developer.adobe.com/indesign/uxp/reference/uxp-api/reference-js/Modules/uxp/Persistent%20Fil...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
/t5/indesign-discussions/uxp-plugin-promises-are-forever-pending/m-p/14391567#M559868
Jan 31, 2024
Jan 31, 2024
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more