Getting a specific reference format using JXA
Posted: Tue Feb 28, 2023 10:44 am
Hi everyone,
I'm trying to integrate Bookends and DEVONthink using Javascript for Automation. I've managed to convert the item fields in BE to custom metadata in DT, but I'm struggling with getting a reference in a specific format, which I want to use for renaming the file in DT.
This little script does give me the default reference format, but I don't know how to specify a format within the `.format()` method. Unfortunately the details and examples in the Scripting Dictionary are all AppleScript-specific.
I'm trying to integrate Bookends and DEVONthink using Javascript for Automation. I've managed to convert the item fields in BE to custom metadata in DT, but I'm struggling with getting a reference in a specific format, which I want to use for renaming the file in DT.
This little script does give me the default reference format, but I don't know how to specify a format within the `.format()` method. Unfortunately the details and examples in the Scripting Dictionary are all AppleScript-specific.
Code: Select all
const bookends = Application("Bookends");
const devonthink = Application("DEVONthink 3");
devonthink.includeStandardAdditions = true;
let items = bookends.libraryWindows[0].selectedPublicationItems();
let item = items[0];
let shortRef = item.format();
console.log(`${shortRef}`);