call/run applescript from javascript
Copy link to clipboard
Copied
Hi,
How to call applescript code from javascript..
I want to run some applescript code via javascript in illustrator
pls help
Explore related tutorials & articles
Copy link to clipboard
Copied
The only way that I know (only tested with photoshop)
Save your *.scpt as app and then try this snippet:
// save your scpt as app befeore testing!!!
var appleScript = new File('~/Desktop/Test.app');
if (appleScript.exists) {
appleScript.execute();
}
Please give a feedback if this works for you. (I haven't a Mac for testing)
Copy link to clipboard
Copied
no i have already tried that.. but it did not worked
Copy link to clipboard
Copied
Only for interest:
And …
… works that snippet in Photoshop for you?
Copy link to clipboard
Copied
This kind of method works for me. To take it up a power level, it is possible to create an "ApplescriptExecutor.app" whose sole purpose is to run a sample file that is always called something like "MyScript.scpt". When a .jsx file dynamically writes the scpt in that location and follows with an .execute() on the .app, it effectively runs a custom-made applescript which can be different every time!
Copy link to clipboard
Copied
can you pls send the sample script?
Copy link to clipboard
Copied
It would be the same as pixxxel's snippet , if your .app contains a basic display alert it should work when you do .execute() on your .app from inside your .jsx.

