Copy link to clipboard
Copied
Hi,
Is it possible to include/require another file in a .psjs script?
I'm not talking about a plugin, but a stand-alone .psjs script.
If not, I believe this is possible with plugins?
Can I put a script in a plugin and use it without an UI interface, that is, use the plugin just like a script?
Thanks in advance,
Erik.
Copy link to clipboard
Copied
Non credo di aver capito bene la domanda.
Purtroppo la traduzione è un po' confusa.
Non puoi usare un'azione per chiamare il file psjs?
O vuoi un pannello con pulsanti che chiami il file psjs?
Se potessi essere più chiaro, sarò felice di aiutarti.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
UXP Script (psjs) can import external files in CommonJS format.
// main.psjs
const { alert } = require('./external.js') ;
alert('hello') ;
// external.js
const { app } = require('photoshop') ;
const alert = async (message) => {
await app.showAlert(message) ;
} ;
module.exports = {
alert
} ;
In UXP Plugin, you can develop a plugin without panel by specifying command in the entrypoints of manifest.json and not specifying panel.