apple script execute via do script (using javascript).
Copy link to clipboard
Copied
Hi Scripters,
Can you any one please look into this and solve my problem.
My request I want to delete the unused swatches in Illustrator, So that I used the apple script its working fine, the same code i want to execute via do script (java Script).
The below Lines I used the Apple script its working fine in the MAC.
After I save as the script file, and app file. I want to execute this from Illustrator using java script but its not working.
----------------------
tell application "Adobe Illustrator"
activate
tell current document
do script "Delete Unused Panel Items" from "Default Actions" without dialogs
end tell
end tell
--------------------
var mege_excel = File(getScriptPath().parent+ "/ILLUS.scpt");
app.doScript(mege_excel, ScriptLanguage.applescriptLanguage);
function getScriptPath() {
try {
return app.activeScript;
}catch(e) {
return File(e.fileName);
}
}
thx,
csm_phil
Explore related tutorials & articles
Copy link to clipboard
Copied
Hi csm_phil
have a look into previous discusstions regarding this issue!
http://forums.adobe.com/thread/623537
http://forums.adobe.com/message/4089876
i hope this helps
Copy link to clipboard
Copied
AI has no app.doScript() method thats an ID thing… If you are scripting CS6 then you call just call the action its a new scripting feature… If you need to execute a complied script then try the File Object execute() method…
Copy link to clipboard
Copied
Hi tech_panda and mark,
Can you please give me the sample how to process my request. I am using Illustrator CS5 Windows 7.
thx,
csm_phil
Copy link to clipboard
Copied
Not even windows 8 can do AppleScript… CS5 has no method to run an action this has been on everyones wish list for years and they only just added it… Probably vanish with the cloud too… pop()
Copy link to clipboard
Copied
Hi Mark,
any other options to acheive this.
thx,
csm_phil
Copy link to clipboard
Copied
Not with any great ease… I recall John Wundes had a remove fluff some time back… You might try that…
Copy link to clipboard
Copied
After a little testing, it seems that the Default Actions don't work too well in CS6. I tried the Delete Unused Panel Items from the Default set and it won't go beyond the first part which is selecting and deleting the unused Symbols. Yet another reason to stick with CS5.
Copy link to clipboard
Copied
Well don't that sound typical… Add scriptability n break a working app feature…
Don't tell the general forum they will come n blame us…
I always found the action needed running twice in CS2 with AppleScript or the GUI.
In CS5 it don't remove all the unused no matter how many times I run it…?
Copy link to clipboard
Copied
It's always worked for me. I even have the action assigned to an F-key.
Copy link to clipboard
Copied
Dear Mark & Larry,
In forum participant are not blamed to adobe developers, we need a solution thats all. Any way there no possibilties to achieve this fine, Atleat Illustrator forthcoming version to achieve this requirement via javascript. please notice to adobe this will take care updated version release!
Don't tell the general forum they will come n blame us…
I always found the action needed running twice in CS2 with AppleScript or the GUI.
In CS5 it don't remove all the unused no matter how many times I run it…?
Finally I ask one more thing, I want to execute the action, that is I alread created the action to delete the swatches in Illustrator I used the short cut key is F2, How I can call the action in javascript. Please advice.
thx,
csm_phil.
Copy link to clipboard
Copied
you were given the answer already, with CS5 and earlier you can only run actions via AppleScript (mac) and vbscript (windows)...Javascript does not support running actions.
Copy link to clipboard
Copied
In CS5, you can only use AppleScript or Visual Basic to run an action. The ability to do this in ExtendScript is new to CS6 and above. The only other way would be to use system events to press the F-key but I have no real experience with this.
Copy link to clipboard
Copied
it's possible using vbs, if you don't mind using it.

