I want to realize a function of saving files. This is the code, but it won’t work. How can I make it work?
async function Test() {
var p = "C:/Users/abc/Desktop/";
localStorage.setItem("DP",p)
// console.log(localStorage.getItem("DP"));
const thePersistentFolderToken = localStorage.getItem("DP");
const thePersistentFolder = await fs.getEntryForPersistentToken(thePersistentFolderToken);
// console.log(p);
const theNewFile = await thePersistentFolder.createFile("export.psd", {
overwrite: true
});
console.log(theNewFile);
const saveFile = await fs.createSessionToken(theNewFile);
CUSTOM.AP([{
"_obj": "save",
"as": {
"_obj": "photoshop35Format"
},
"in": {
"_path": saveFile,
"_kind": "local"
},
"documentID": app.activeDocument._id,
"saveStage": {
"_enum": "saveStageType",
"_value": "saveBegin"
},
"_isCommand": false
}])
}