# ActionInstall code Helpe?

**URL:** <https://forums.creativeclouddeveloper.com/t/actioninstall-code-helpe/6178>\
**Category:** Photoshop\
**Created:** [April 13, 2023, 9:36pm UTC](https://forums.creativeclouddeveloper.com/t/actioninstall-code-helpe/6178 "2023-04-13T21:36:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohamad](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/mohamad/32/2334_2.png) [@Mohamad](https://forums.creativeclouddeveloper.com/u/Mohamad)\
**Post date:** [April 13, 2023, 9:36pm UTC](https://forums.creativeclouddeveloper.com/t/actioninstall-code-helpe/6178/1 "2023-04-13T21:36:00Z")

</div>

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:

```auto
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…
