Copy link to clipboard
Copied
I have done this before and for the life of me I can't get why it's not working this time around.
I create two variables which have the root path and file to a jsx script:
const root = decodeURI(csiRun.getSystemPath("extension")).replace(/file\:\/{1,}/, "");
const createArtBuild = `${root}/jsx/buildArt.jsx`;
Inside of buildArt.jsx I have a function with alert:
function buildArtwork() {
alert('this is running')
}
I then evaluate the file and run the method:
csiRun.evalScript(`$.evalFile('${createArtBuild}')`);
// execucte jsx in illustrator
csiRun.evalScript(`buildArtwork(${'test'})`, async (returnVal) => {
console.log('this hit?')
})
I do get console.log "this hit" but the function never alerts.
I've set the correct settings in terminal for the CEP.
defaults write com.adobe.CSXS.11 PlayerDebugMode 1
Any idea what I'm doing wrong?
Hi @OhmsG , By looking at your file structure and method, I have written extra line above your hit console line
console.log(returnVal);
to see whether I am getting any error or not. So there is an error when which is mentioned below
Error 2: test is undefined.Line: 1-> buildArtwork(test)
So correct way will be
csiRun.evalScript(`buildArtwork(${JSON.stringify('test')})`, async (returnVal) => {
console.log(returnVal);
console.log('this hit?')
})
Copy link to clipboard
Copied
Hi @OhmsG , By looking at your file structure and method, I have written extra line above your hit console line
console.log(returnVal);
to see whether I am getting any error or not. So there is an error when which is mentioned below
Error 2: test is undefined.Line: 1-> buildArtwork(test)
So correct way will be
csiRun.evalScript(`buildArtwork(${JSON.stringify('test')})`, async (returnVal) => {
console.log(returnVal);
console.log('this hit?')
})
Copy link to clipboard
Copied
You're awesome and thank you!