Hello,
I'm new to Node.js and I'm trying to develop a Node.js-Script that runs AppleScript which then runs a JSX-Script. That works just fine. The Problem is, that I need to use $outfolder inside of that JSX-Script, so I need to read it via Node to pass it on. I can't seem to find a way to get that Outfolder-Path in Node. Can someone help? Am I missing something obvious?
Use $outfolder in Node.js
Re: Use $outfolder in Node.js
Seems like I've found a solution to my Problem. I just create a temporary folder with:
And pass it on to AppleScript and JSX. Seems to work.
A new problem that occured, is that I also need to pass the Job to AppleScript and JSX so that Photoshop can use a JSX Script to process and save that Job File.
I pass the job (and the outfolder and many more variables) to AppleScript with this variable:
AppleScript then runs a JSX Script that processes the File via Photoshop and saves it at that outfolder path.
After that I receive back the path to that file as a return in my Node.js-Script.
So how can I use
on that exact file instead of my "primary" job?
I've tried this:
but as soon as I try to send the primary job to null, it crashes saying:
Can anyone help?
Code: Select all
let outfolder = tmp.dirSync().name;
A new problem that occured, is that I also need to pass the Job to AppleScript and JSX so that Photoshop can use a JSX Script to process and save that Job File.
I pass the job (and the outfolder and many more variables) to AppleScript with this variable:
Code: Select all
let jobPathString = await job.get(AccessLevel.ReadWrite);
After that I receive back the path to that file as a return in my Node.js-Script.
So how can I use
Code: Select all
job.sendToData(Connection.Level.Success)
I've tried this:
Code: Select all
let newJob = await job.createChild(outfiles[0]);
await newJob.sendToData(Connection.Level.Success);
await job.log(LogLevel.Info, "newJob sent to data");
await job.sendToNull();
await job.log(LogLevel.Info, "job sent to null");
fs.unlinkSync(outfiles[0]);
If I don't send it to null, the new Job is sent to success, but the primary job of course doesn't get deleted.Method is not allowed at this time. Have you called any sendTo method already? Error: Method is not allowed at this time. Have you called any sendTo method already?
Can anyone help?