State of arbitrary file access and shell command support

First of all thanks @justin2taylor for the pointer. And thank you Adobe for UXP Hybrid Plugins!! They certainly give us the flexibility to solve this on our end. With the help of the SDK’s readme and example plugin it’s fairly straight forward to get started, provided you’re familiar with C/C++. It took me about a day to implement a basic execSync() (like @justin2taylor had suggested) and bundle it all up. For people who are not comfortable with getting their hands dirty in some C/C++ it might not be suitable, but on the flip side you get a lot of flexibility and the freedom to do stuff that may not be possible just through Javascript. However: I would say, with great freedom comes great responsibility. You can certainly do a lot but also break a lot (and I don’t mean that in a malicious sense), don’t attempt this if you don’t know C/C++! For folks who may want to try UXP Hybrid Plugins as well, here are a few things I found on the way:

  • The SDK’s example plugin uses a ‘main.js’ as entrypoint. I found it straight forward to just use my existing ‘index.js’ that gets built out of various modules, using npm/webpack, etc.
  • If you’re using webpack, don’t forget to add your add-on under ‘externals’ in the webpack config. Like so:
externals: {
    photoshop: 'commonjs2 photoshop',
    uxp: 'commonjs2 uxp',
    ...
    'YOUR_ADDON_NAME.uxpaddon': 'commonjs2 YOUR_ADDON_NAME.uxpaddon'
    ...
  }
  • Don’t forget to add the required entry for add-ons to the permissions section in the manifest. In fact the manifest needs a few changes, including listing the add-on. Read the SDK’s readme carefully, it goes over the different things you need to add.