Copy link to clipboard
Copied
I have been using this script for a while and today it stopped working. It is calling a function from a jsx that I had loaded earlier. csInterface is a new CSInterface created earlier as well. Does anybody know why this would happen? It just stopped working and nothing was done to the code.
Copy link to clipboard
Copied
Are you getting any error? If yes, could you please post your screenshot?
Copy link to clipboard
Copied
In addition to what @Charu Rajput mentioned, if there is no error message and it just does not work silently then we need to make sure that the call is reaching the jsx method. For that the easiest way would be to add in an alert in your called jsx function definition and then test. If you get the alert when the call is triggered via csinterface then it means that the call is made but something in the code of jsx is failing, try commenting out pieces of code to figure out the culprit. If the alert is not shown then it means that the call never ended up in jsx land and you have some issues on the js end
P.S. :- Make sure you realunch Illustrator after making changes to jsx
-Manan
Copy link to clipboard
Copied
The error message is this.
This is the full code.
The php pull is going through and I am getting a correct response from it. The evalScript is what is not working. The loadJSX() is from my main.js and it is just loading the file the function is from. This code had been working up until Friday. That being said I have a function call like this in another cep extension that does work. I also tried calling a function that was just an alert as a test in this cep extension and another one I have and they both failed. That is outside of an xmlhttp pull. Here is the loadJSX() code.
Copy link to clipboard
Copied
Are you able to call other functions from this file or none of the methods from the file are accessible? It's difficult to point what needs to be looked at without having a look at the whole code and its structure. Can you remove pieces of code/file from this to create a shortest form of the extension that has this problem and does not contain anything that should not be shared publically and share that across, then I can have a look at it.
-Manan
Copy link to clipboard
Copied
On top of Manan's suggestions, the error seems to indicate that the CheckThis function couldn't be found. So at this stage, I would inspect the evalFile call. Is the file simply loaded?
try
csInterface.evalScript('$.evalFile…', function(result){
console.log(result);
});
The idea is to double check that the evalFile script did work properly. If it did cease to work, then something has changed. Either a file has been corrupted, moved or whatever.
Copy link to clipboard
Copied
Rightly said by @Loic.Aigon the key is that statement which loads the files. Having said that these issues are difficult buggers to solve, I have been in this situation myself as well and the only way I was able to get out of it was commenting out code portions and making the area to scan smaller and smaller untill the solution started staring you in the face 😛
-Manan
Copy link to clipboard
Copied
Developers who did :
alert(1);
…code
alert(2);
…code
alert(3);
…code
Copy link to clipboard
Copied
Count me in on this. This way of ancient debugging seldom fails you 🙂
-Manan