# How to load PS Actions through UXP

**URL:** <https://forums.creativeclouddeveloper.com/t/how-to-load-ps-actions-through-uxp/6491>\
**Category:** UXP Developer Tool\
**Tags:** javascript\
**Created:** [July 11, 2023, 9:58am UTC](https://forums.creativeclouddeveloper.com/t/how-to-load-ps-actions-through-uxp/6491 "2023-07-11T09:58:00Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![sttk3](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sttk3](https://forums.creativeclouddeveloper.com/u/sttk3)\
**Post date:** [July 11, 2023, 11:37am UTC](https://forums.creativeclouddeveloper.com/t/how-to-load-ps-actions-through-uxp/6491/2 "2023-07-11T11:37:53Z")

</div>

If you want the UXP script, you cannot get the path automatically as you say. It will be roughly the same code on this page.

- [What are the real possibilities of loading an action.atn file in the Action palette with UXP?](http://forums.creativeclouddeveloper.com/t/what-are-the-real-possibilities-of-loading-an-action-atn-file-in-the-action-palette-with-uxp/6040)

If it is a UXP plugin, you can specify the path as you like, so it can load an atn file in the same folder as the document you have open, for example.

```auto
const { localFileSystem } = require('uxp').storage ;
const { action, app, core } = require('photoshop') ;

const main = async () => {
  try {
    await core.executeAsModal(
      async (control) => {
        const doc = app.activeDocument ;
        if(doc == null) {
          app.showAlert(`Please execute with the document open.`) ;
          return ;
        }

        const docPath = doc.path ;
        if(docPath === '') {
          app.showAlert(`Please save the document and then execute it.`) ;
          return ;
        }

        // get atn file in same folder as active document
        const parentPath = path.dirname(docPath) ;
        const atnName = 'set1.atn' ;
        const atnPath = path.join(parentPath, atnName) ;
        const atnEntry = await localFileSystem.getEntryWithUrl(atnPath) ;

        // load an action set with the same name if it does not exist
        const actionSetName = path.basename(atnPath, '.atn') ;
        const whetherExistsActionSet = action.validateReference({_ref: 'actionSet', _name: actionSetName}) ;
        if(whetherExistsActionSet) {
          await app.showAlert(`No action set was loaded since it already exists.`) ;
          return ;
        } else {
          await app.open(atnEntry) ;
          await app.showAlert(`ActionSet '${actionSetName}' has been loaded.`) ;
        }
      }, 

      {'commandName': 'Load Action Set'}
    ) ;
  } catch(e) {
    await app.showAlert(e) ;
  }
} ;

```

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/how-to-load-ps-actions-through-uxp/6491)._
