Skip to main content
Participant
September 19, 2008
Question

Script execute Action?

  • September 19, 2008
  • 6 replies
  • 2848 views
How in gods name do you execute a Action with a script?

I found this is sometimes easier than trying to script my copy paste crazyness. The illustrator script docs say, oh you can call a action, but they don't say how! I am going crazy...
This topic has been closed for replies.

6 replies

Larry G. Schneider
Community Expert
Community Expert
December 4, 2008
This works

--get a sourceFolder that holds the files to print
set sourceFolder to (choose folder with prompt "Choose a folder with files to process:") as text

-- get a list of files of the files to be printed in the sourceFolder
tell application "Finder" to set workingFiles to (every file of folder sourceFolder) as alias list

repeat with aFile in workingFiles
tell application "Adobe Illustrator"
open aFile

set currentFile to front document

tell application "Adobe Illustrator"
do script "Delete Unused Palette Items" from "Default Actions" without dialogs

end tell
close currentFile with saving

end tell
end repeat
Participant
December 4, 2008
What about the doScript method in the Application object??
I was going to try this in a second because I also am trying to execute an Action within my script.
However, the method's "what it does" notes that you should only use this command when running the script external to Illustrator or unexpected results may ensue. Don't ask me what that means.
I'm going to try it anyway and if anybody knows why I shouldn't, or if they have other suggestions please let me know.
thanks
Known Participant
September 22, 2008
ScriptListener Plug-In for Illustrator would be a great idea. I looked but could find no such thing. If only the people at Adobe could get together once in a while and get some cohesion between scripting these apps Its more common for me to have to do javascript to obtain something thats not available to AppleScript. Why would this command not exist?
Participant
September 20, 2008
Yeah not sure, doing my script with JS. In photoshop this is much easier, and the script listener really helps. Does AI have any sort of listener to help code? I feel the docs and arranment for all this is really weak..
try67
Community Expert
Community Expert
September 19, 2008
I didn't try this, but maybe you can run it using app.open() ?
Known Participant
September 19, 2008
Michael, Im new to learning JavaScript but I can't find any reference to this in the guide. In AppleScript its the "do script" command. You supply 2 strings one the name string of the action second name string of the containing set with a dialog boolean. Sorry but I don't know enough to try translate this or even if its not possible. Example is like this:

tell application "Adobe Illustrator"
set Doc_Ref to the current document
tell Doc_Ref
repeat with i from (count of group items) to 1 by -1
set selection to group item i of layer 1
do script "UnGroup" from "Marks" without dialogs
end repeat
set selection to {}
end tell
end tell