welcome everybody.
I want to install the action of my plug-in, but it cannot be loaded with Photoshop.
but in the console run well !!!
Please Help.
This is the complete code I used:
///////////////////////////////////////////////////////////////////////////////////
///////// MY WORKE MOHAMAD FATHI ActionInstall
/////////
/////////////////////////////////////////////////////////////////////////////////////
///// js code:
const ActionInstall_ = async () => {
async function ActionInstall () {
const df = await fs.getPluginFolder();
let actionToken = await df.getEntry("atn/ACTIONS_MOHAMMAD(UXP).atn");
let actionGetToken = await fs.createSessionToken(actionToken);
let importAction = [
{
"_obj": "set",
"_target": [{"_property": "action", "_ref": "property"}, {"_ref": "application"}],
"append": true,
"to": {"_kind": "local", "_path": actionGetToken}
}
]
await require("photoshop").action.batchPlay(importAction, {"synchronousExecution": true, "modalBehavior": "execute"})
}
await require("photoshop").core.executeAsModal(ActionInstall)
setActionSetting(2)
console.log("Action Now saved")
}
if (getSavedActionSetting() === 1) {
console.log("No Action found - lets install one")
ActionInstall_()
}
else if (getSavedActionSetting() === 2) {
console.log("Do nothing - Action found")
}
else if (getSavedActionSetting() === 0 || null || undefined){
ActionInstall_()
}
else {
app.showAlert("Error loading Action settings")
}
function getSavedActionSetting () {
const savedPreference = localStorage.getItem("actionStatus");
return (savedPreference === undefined) ? 10 : Number(savedPreference);
}
function setActionSetting (value) {
localStorage.setItem("actionStatus", value.toString());
}
//////////// //////////// //////////// ////////////
Regards
Mohamed Fathyβ¦