Copy link to clipboard
Copied
Hi,
So I know where I want to go, but I'm missing one piece.
I'm creating an extension for AI and it's going great. The Javascript portion is done, and it exports out the files needed, but I have Python code that I wrote that I want to run. The Extension is going to be shipped to people, therefore the Python code needs to be inside of the extension so it can know where it's at. I want to place it beside of the javascript, so it's not going to need to go through any directories to find it.
In Python, I could do this with my eyes closed. In Javascript, I'm very much new.
I want to do this by running a shell script(or Applescript) that is run inside of the Javascript that will be able to find the current path of the running script(the javascript) and append the Python filename to it so it knows which one to use.
What I need:
I don't know how to do relative paths in Javascript and everything I find online is about web browser stuff.
I don't know how to correctly shell out from inside of the Javascript for Illustrator, I can't seem to get that to work.
Thanks!
Edit: Let me also state that we're on CC, not CC2014 so I can't use any of the node.js stuff that was implemented in CC2014.
Copy link to clipboard
Copied
Relative paths from JS are not a problem.
var thisFile = new File($.fileName);
var baseFolder = thisFile.path;
alert(baseFolder);
not sure if this is what you want,
this is from the ESTK Object Model Viewer
File.execute (): Boolean
Core JavaScript Classes
Executes or opens this file using the appropriate application, as if it had been double-clicked in a file browser.
You can use this method to run scripts, launch applications, and so on.
Returns true immediately if the application launch was successful.
Copy link to clipboard
Copied
Thanks for that, that definitely helps
We found a solution, but it's a little more difficult.
Creating a term file within the javascript:
exec-term/create_and_execute_term.jsx at master · fabiantheblind/exec-term · GitHub
Apparently, Illustrator javascript doesn't have a way of communicating with the system, so this was a workaround for it.
Thanks to the person who messaged me and the person who replied.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more