Copy link to clipboard
Copied
I am running a separate node server as described in this tutorial to create a plugin with generator-core. http://tomkrcha.com/?p=3896
I am in a situation where I need to send a lot of JS to photoshop via generator.evaluateJSXString(). But this can get out of hand easily as you can only send a string. So for any complicated functionality it becomes difficult to maintain. Is it possible define a bunch of functions in a extend script file and then call those functions from the node app?
So i could send:
generator.evaluateJSXString('doSomeStuff()');
And in a script somewhere (I don't know where this script should go)
I have that function defined which can do some stuff
function doSomeStuff(){
for(var i = 0; i < 10; i++){
doc.artLayers.add();
}
}
Where would the Extend Script File go in this instance? OR is there a better way to achieve this sort of thing.
Just a mixed collection of thoughts:
Copy link to clipboard
Copied
I'm moving this post to the scripting forum.
Copy link to clipboard
Copied
Just a mixed collection of thoughts:
Copy link to clipboard
Copied
Thanks for this, thats cleared up everything! It's pretty annoying that you cant pass params to a function, do you think this is a limitation due to generator-core being such a new tech, or a purpose made design decision?
Copy link to clipboard
Copied
Well, it's relatively complex. Even though "it's all javascript", you really three totally separate things with "ESTK/Photoshop DOM", Photoshop panels/Chrome and Node.js running that javascript. So it's not just calling a function but more "let me send a message to that program and ask them to call a function". Also since the browser roots, there is no "inter-script-communications", so no standard way of sending a script data.