Greetings,
I have come across an issue that I don’t know how to solve. I am trying to make a plugin, that will enable me to first select a file, I will get the file path and then open the file in photoshop with that said path. I managed to make a file dialog that gives me the path to the documents I want. The part that I am struggling with is the actual opening of the files from said path. I used alchemist to get some of the code and I can’t understand why parts aren’t working. I am not getting any error. Could it be that I forgot to put something in manifest? or is it just the code?
Here is my code:
async function runModalFunction() {
console.log("start");
await selectFile();
await executeAsModal(actionCommands, {"commandName": "Action Commands"});
}
async function actionCommands() {
console.log("actionCommands")
const result = await batchPlay(
[
{
_obj: "open",
null: {
_path: startFilePath,
_kind: "local"
},
documentID: 78,
template: false,
_isCommand: true,
_options: {
dialogOptions: "dontDisplay"
}
}
],
{}
);
console.log("end of action commands")
}
As for how I get that said path:
const fs = window.require("uxp").storage.localFileSystem;
const file = await fs.getFileForOpening();
const token = await fs.createPersistentToken(file);
const fileObject = {
name: file.name,
path: file.nativePath,
token: token,
entry: file,
};
const finalPath = fileObject.path;
console.log(finalPath)
startFilePath = finalPath;
Finally, here are my permissions in manifest:
"requiredPermissions": {
"allowCodeGenerationFromStrings": true,
"launchProcess": {
"schemes": [
"http",
"https"
],
"extensions": [
".svg",
".png"
]
},
"localFileSystem" : "request",
"clipboard": "readAndWrite",
"webview": {
"allow": "yes",
"domains": [
"https://*.adobe.com",
"https://*.google.com"
]
}
},