I am trying to write a droplet that when I drop a folder or files onto it it parses them as .AI files and then launches Illustrator 10 and opens all the files I just dropped on.
Once it has done this if does the following code and then exits.
I am having trouble however getting Illustrator 10 to open the fileList which would then allow the rest of my script to work.
If anyone can solve my little problem I would be most appreciative?
The code is as follows:
Thanks in advance,
Dave.
on open fileList
tell application "Adobe Illustrator 10"
activate
tell application "Adobe Illustrator 10"
open fileList
--Get a location for the exported files
set targetFolder to choose folder with prompt "Location for exported files"
--Convert the path to a string for later use
tell application "Finder" to ¬
set targetPath to item targetFolder as string
tell application "Adobe Illustrator 10"
-- Turn off user interaction so dialogs don't cause the script to get stuck
set user interaction level to never interact
--Count the open documents
set documentCount to count documents
--Export each open document
repeat with i from 1 to documentCount
--Get the document's name to use for creating a file path to save to
set documentName to name of document i
-- Perform the save
save document i in file (targetPath & documentName) as eps ¬
with options {class:EPS save options, compatibility:Illustrator 9, include document thumbnails:true, PostScript:level 3, preview:color Macintosh, embed all fonts:true, CMYK PostScript:true}
end repeat
end tell
end tell
end tell
end open
I dont have “Illustrator 10”, but here a small suggestion :
on open fileList
--Get a location for the exported files
set targetFolder to choose folder with prompt "Location for exported files"
--Convert the path to a string for later use
set targetPath to item targetFolder as string
tell application "Adobe Illustrator® 9.0"
activate
-- Turn off user interaction so dialogs don't cause the script to get stuck
set user interaction level to never interact
--Repeat for each item in "fileList"
repeat with AiDoc in fileList
--Open document "AiDoc"
open AiDoc
--Get the document's name to use for creating a file path to save to
set AiDocName to name of document 1
--Perform the save
save document AiDocName in file (targetPath & AiDocName) as eps ¬
with options {class:EPS save options, compatibility:Illustrator 9, ¬
include document thumbnails:true, PostScript:level 3, ¬
preview:color Macintosh, embed all fonts:true, CMYK PostScript:true}
end repeat
-- Turn ON user interaction (but i dont know the correct syntax)
--set user interaction level to interact ???
end tell
end open
Hey Fredo thanks for being so helpful I just have one last request if you are ok with it
Currently I have 100 or so files I wish to do this with. The script works perfectly and I thank you for it but because it opens all the files in fileList that means that the RAM usage for Illustrator goes through the roof!
Do you any way in which I could re-write the script that for each item in fileList it opens them individually, then saves it, closes it and moves onto the next item in the fileList?
This is my final hurdle, and I appreciate your assistance in this matter. Just opening up and previewing 100 + files I think will make Illustrator have a heart attack
In this case, Illustrator opens all the documents of the list,
what can cause slownesses following a saturation of the memory.
But, in my suggestion, the loop is carried out by opening
and saving each document individually:
--Repeat for each item in "fileList"
repeat with AiDoc in fileList
--Open document "AiDoc"
open AiDoc
Perhaps that us should close each document by adding
an additional instruction.
Here, the whole structure of the loop:
--Repeat for each item in "fileList"
repeat with AiDoc in fileList
--Open document "AiDoc"
open AiDoc
--Get the document's name to use for creating a file path to save to
set AiDocName to name of document 1
--Perform the save
save document AiDocName in file (targetPath & AiDocName) as eps ¬
with options {class:EPS save options, compatibility:Illustrator 9, ¬
include document thumbnails:true, PostScript:level 3, ¬
preview:color Macintosh, embed all fonts:true, CMYK PostScript:true}
--Close document
close document AiDocName
end repeat
I do not know if it is the best way of completing this work
(I dont have Illustrator 10 to make tests), but I think that code can go now.
Sorry for my rudimentary English, I am French and does not speak
your language very well. Thank you for your indulgence.