I am trying to create a temporary document and convert it to grayscale. It seems this does not work, and so far, I have not been able to find a single editing feature that does work. Does createTemporaryDocument support anything at all, is there a place to see what is supported? This feature would be super nice to utilize, and I’ve spent hours now trying to get it work, but coming to the conclusion that these features just might not be supported.
Bump… I’d also love to use this feature. Same here - spent a few hours trying. I’ve been able to confirm the creation of a temp doc and get its id, but that’s about it.
So, are you able to edit or export? I’m currently using duplicate documents but the progress shows up in the front of my eye. But in the doc, the temporary doc can do things in background
No, I haven’t had any success editing or moving things to or from the temp doc at all.
Once created, any operations I try to perform get applied to the activeDcoument, even if targeting the tempDoc id. Here’s how I’ve created a temp doc if anyone wants to tinker:
const currentDocID = app.activeDocument._id;
console.log(`Current document ID: ${currentDocID}`);
// Get the list of document IDs before creating the temporary document
const initialDocs = app.documents.map(doc => ({ id: doc._id, doc }));
console.log("Initial document IDs:", initialDocs.map(d => d.id));
console.log("Creating a temporary document");
// Create a temporary document inside a modal scope
await require('photoshop').core.executeAsModal(async () => {
await require('photoshop').core.createTemporaryDocument({ documentID: currentDocID });
}, { "commandName": "Create Temporary Document" });
console.log("Temporary document created");
// Get the list of document IDs after creating the temporary document
const newDocs = app.documents.map(doc => ({ id: doc._id, doc }));
console.log("New document IDs:", newDocs.map(d => d.id));
// Find the newly added document
const tempDoc = newDocs.find(d => !initialDocs.map(doc => doc.id).includes(d.id)).doc;
if (tempDoc) {
console.log(`Temporary document ID: ${tempDoc._id}`);
// Perform operations on the temporary document (no success here so far)
// Delete the temporary document
await require('photoshop').core.deleteTemporaryDocument({ documentID: tempDoc._id });
console.log("Temporary document deleted");
} else {
console.log("Temporary document not found");
}