You will have to excuse me, I am totally out of my depth here! This is how far I have got with my project:
I have been creating an applescript that is attached to a folder action (script attached to the bottom of this posting). It basically opens (in Adobe Illustrator CS) any EPS file dropped in the folder. Once open in Illustrator an Illustrator Action is used to convert the file into the format I need and then that is where I get stuck! At the moment my file is saved using the Illustrator Action but I wish to save it using Applescript because I need to append a letter ‘c’ to the beginning of the file name when IllustratorCS exports the file as an Illustrator 8.0 EPS file and I also wish for it to be saved to another folder.
Any help would be great.
Many thanks
Andy.
My script so far:
property dialog_timeout : 30 –
on adding folder items to this_folder after receiving added_items
tell application “Illsutrator CS” to open added_items
front window
tell application “Illustrator CS”
do script “Prep Cutter Guide File” from “ZUND Cutter”
end tell
end adding folder items to
Maybe you can duplicate or move the file first, delete the original (if dupe is created), do the conversion on the moved/duped file, and then rename it. Something like this (uncompiled or tested because I lack Illustrator).
on adding folder items to this_folder after receiving added_items
repeat with item_ in added_items
tell app "Finder"
set dupe_ to (duplicate item_ to folder "path:to:other folder") as alias
delete item_
end tell
tell application "Illustrator CS"
open dupe_
front window
do script "Prep Cutter Guide File" from "ZUND Cutter"
end tell
tell app "Finder" to set name of dupe_ to "c" & name of dupe_
end repeat
end adding folder items to
You have to capture the name of the file added to the folder. This way, you can modify the name and save the file with the modified name.
Check the folder action scripts that came with the OS for examples. Here is one way (without any error catching):
on adding folder items to this_folder after receiving added_items
repeat with i from 1 to number of items in added_items
set this_item to item i of the item_list
set this_info to info for this_item
set the current_name to the name of this_info
set the_new_file_name to "c" & current_name
set file_path to "build:file:path:"
tell application "Adobe Illustrator 10.0.3" to open this_item
front window
tell application "Adobe Illustrator 10.0.3"
do script "Prep Cutter Guide File" from "ZUND Cutter"
save document 1 in file file_path & the_new_file_name
end tell
end repeat
end adding folder items to
I’m not sure that I have the save line quite correct, since I don’t script Illustrator. And you may need to wait for the “do script” to finish, but perhaps this will give you a start.