Hi everyone,
I am developing a feature for my plugin that downloads remote .psjs files and executes them locally. However, I’ve run into an issue where batchPlay fails to execute the code.
Here is my current function:
JavaScript
async function runPSJS(path) {
const fs = require('uxp').storage.localFileSystem;
const token = await fs.createSessionToken(await fs.getEntryWithUrl("plugin-data:/" + path));
return await action.batchPlay([
{
"_obj": "runJavaScript",
"_target": [{ "_enum": "ordinal", "_ref": "application", "_value": "targetEnum" }],
"file": { "_kind": "local", "_path": token }
}
], {
continueOnError: true
});
};
The problem: I used the Actions Panel to record the step and converted it using the native “Copy as JavaScript” feature. The action works perfectly when played directly from the Actions Panel, but it does nothing (fails to execute) when triggered via batchPlay in my UXP code.
Environment:
-
UXP Version: 7.4.1
-
Photoshop Version: 25.9.0
Does anyone have an explanation for why batchPlay isn’t picking this up, or if there’s a specific permission/syntax I’m missing for runJavaScript in UXP?
