I have searched around a bit, and experimented - but I can’t figure out the proper syntax in order to get this script to work correctly. I want to drop PDFs into a folder, and have Acrobat convert them to EPS, then save to a specified directory. The script is basic, and opens the file into acrobat - then nothing, I must have the syntax entirely incorrect. Any experts out there?
Here’s the script so far:
on adding folder items to this_folder after receiving these_items
tell application "Adobe Acrobat 7.0 Pr#12A694"
open these_items
save these_items using EPS Conversion "volumes:vol1:fixed pdfs:in:"
end tell
end adding folder items to
I’m not positive, but I think you have to do it on a per-file basis. The variable “these_items” is a list, since there could be more than 1 item added at a time to the watched folder.
Ok, I decided to create a droplet instead of doing a folder action. However, the current script yields an error… “Can’t continue save”
Here is the current script:
on open myfile
tell application "Adobe Acrobat 7.0 Pr#12A694"
open myfile
end tell
set mydest to "volumes:Mac HD:users:andy:desktop:eps export tests:test:" as string
tell application "Adobe Acrobat 7.0 Pr#12A694"
save to mydest using EPS Conversion with binary, embedded fonts, images, preview and TrueType
end tell
end open
Ok… now I am really close. I need to learn how to have the name of the original file simply appended, when it saves. I wish to add “_fixed.eps” to the end of each processed file. The script as it stands now, does what it should. However, I need to retain the original filename and simply add to it. My “mydest” clause likely needs some manipulation…
on open myfile
tell application "Adobe Acrobat 7.0 Pr#12A694"
open myfile
end tell
set mydest to "Mac HD:users:andy:desktop:eps export tests:untitled folder:In:myfile +1.eps"
tell application "Adobe Acrobat 7.0 Pr#12A694"
save front document to mydest using EPS Conversion with binary, embedded fonts, images, preview and TrueType
close front document
end tell
end open
Thank you for the reply. I looked into the batch processing stuff - but a major influnce in scripting is that I want user interaction to be a little as possible. I want the whole process automated, only requiring the user to drop a file in one place (droplet) and pick up the “fixed” file at a specified location.
Now all I need is to figure out what to add to my script to retain the original file’s name, with a “_fixed” appended to the name.
If anyone can shed some light - I’ll hook them up a nice tuna sandwich
My script as is works, but I am using a REPEAT clause that goes haywire. I need a better way to itemize the files being put into my folder. Right now, my script creates a new file in the same folder. this folder, having a fodler action attached, runs the script against every file that is added. So, being that my script creates new files into this folder, it cycles endlessly. Anyone care to comment?
on adding folder items to this_folder after receiving added_items
repeat with i from 1 to the count of added_items
set this_item to (item i of added_items)
tell application "Adobe Acrobat 7.0 Pr#12A694"
set fileExtension to {".eps"}
set originalName to (name of (info for (this_item as alias)))
if originalName ends with ".pdf" then
tell application "Finder" to set name of (this_item as alias) to ((characters 1 through 7 of originalName) as text) & ".eps"
end if
set newName to (this_item as string) & "_fixed"
open this_item
save front document using EPS Conversion to file newName with binary, embedded fonts, images, preview and TrueType
close front document
end tell
end repeat
set mydest to "Mac HD:users:andy:desktop:eps export tests:untitled folder:In"
tell application "Finder"
move newName to mydest
end tell
end adding folder items to
I think the solution is to move both the eps and pdf to a new location, one that doesn’t have the folder action attached to it. Try this script:
property old_extension : ".pdf" --type of files to process
property new_extension : ".eps" -- new file extension
property my_destination : "Webcard:Users:Shared:" --where to save the eps file
property new_suffix : "_fixed" --suffix to append to processed eps
on adding folder items to this_folder after receiving added_items
try
repeat with this_item in added_items
set file_name to name of (info for (this_item as alias))
if file_name contains old_extension then
--create destination path without old extension and with suffix and new extension
set new_file_path to (my_destination & (characters 1 thru ((offset of old_extension in file_name) - 1) of file_name) & new_suffix & new_extension)
--convert the file and save it to new destination
tell application "Acrobat 6.0 Professional"
open this_item
save front document using EPS Conversion to file new_file_path with binary, embedded fonts, images, preview and TrueType
close front document
end tell
--move the orginal file to the destination folder
move this_item to my_destination
end if
end repeat
on error err
display dialog err
end try
end adding folder items to