You are not logged in.
I am extremely new to scripting but see how many hours of my day I could free up by automating repetitive tasks.
I've managed to cobble together a script that I can drag an Illustrator file to, that will rasterize the file in Photoshop and rename with the file extension "_lowres"
However, it seems to save over the native Illustrator file and I want to keep the original files untouched. Any advice on how to do this?
Here is what I have:
Applescript:
on open some_items
repeat with this_item in some_items
try
rescale_and_save(this_item)
end try
end repeat
end open
to rescale_and_save(this_item)
tell application "Adobe Photoshop CS3"
set myOpenOptions to {class:PDF open options, resolution:150, mode:RGB}
open this_item as PDF with options myOpenOptions
set mySaveOptions to {class:PDF save options, JPEG quality:10}
flatten current document
save current document in this_item as Photoshop PDF with options mySaveOptions appending lowercase extension
end tell
tell application "Finder"
set name of this_item to (name of this_item) & "_lowres"
end tell
end rescale_and_save
Model: iMac
Browser: Safari 535.1
Operating System: Mac OS X (10.7)
Offline
Hi,
first of all, please post your questions in the OS X section of MacScripter.
CodeExchange is for sharing complete solutions.
Your script is written to overwrite and rename the document
Try this
Applescript:
on open some_items
repeat with this_item in some_items
rescale_and_save(this_item)
end repeat
end open
to rescale_and_save(this_item)
tell application "Finder" to set parentFolder to container of this_item as text
set {name:fileName, name extension:fileExtension} to info for this_item
if fileExtension is missing value then set fileExtension to ""
if fileExtension is not "" then set fileName to text 1 thru ((count fileName) - (count fileExtension) - 1) of fileName
try
tell application "Adobe Photoshop CS3"
set myOpenOptions to {class:PDF open options, resolution:150, mode:RGB}
open this_item as PDF with options myOpenOptions
set mySaveOptions to {class:PDF save options, JPEG quality:10}
flatten current document
save current document in (parentFolder & fileName & "_lowres." & fileExtension) as Photoshop PDF with options mySaveOptions appending lowercase extension
end tell
on error e
display dialog "An error occured: " & e
end try
end rescale_and_save
Offline