Hi all,
can someone please help..the attached script is suppose to crop an image and save it as a new photoshop file in a particular folder.. now this use to work in CS3 but has stopped working in CS4... unfortunately I'm very new to scripting for adobe apps so any suggestion will be very welcomed.
thanks
set HomeSpot to (path to desktop) as Unicode text
tell application "Finder"
try
make new folder in HomeSpot with properties {name:"Cropped Images"}
end try
set TheFolder to folder "Cropped Images" as Unicode text
end tell
tell application "Adobe InDesign CS3.app"
tell document 1
tell selection
set {Fx1, Fy1, Fx2, Fy2} to «class gbnd»
set the_image to item 1 of every «class imag»
tell the_image
set {Ix1, Iy1, Ix2, Iy2} to «class gbnd»
set the_scale to «class phzs»
«event K2LKedto» of «class plnk»
end tell
end tell
end tell
end tell
set the_scale_factor to (the_scale / 100)
--return the_scale_factor
set {Cx1, Cy1, Cx2, Cy2} to {((Fx1 - Ix1) / the_scale_factor), ((Fy1 - Iy1) / the_scale_factor), ((Ix2 - Fx2) / the_scale_factor), ((Iy2 - Fy2) / the_scale_factor)} --as Unicode text
--set image_data to {Cx1, Cy1, Cx2, Cy2}
tell application "Adobe Photoshop CS3.app"
try
set SaveEPSOptions to {class:«class cSSP», «class pSEP»:true, «class EnCd»:«constant e290e264», «class HfTn»:false, «class ImIP»:false, «class PsCM»:false, «class PwTp»:«constant e250e254», «class Tsfr»:false, «class TpWh»:false, «class VcDt»:false}
set DisplaySaveEPSOptions to SaveEPSOptions as list as Unicode text
on error
display dialog "SaveEPSOptions Error"
end try
tell document 1
set the_height to «class Hght»
set the_width to «class Wdth»
set crop_data to {Cy1, Cx1, (the_width - Cy2), (the_height - Cx2)}
--set Jaosn to bounds of selection
«event 8BIMCrop» given «class Bnds»:crop_data
set Current_TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
--try
set ThedocName to name as Unicode text
set DocName to text item 1 of ThedocName as Unicode text
--on error
-- display dialog "File Name Error"
--end try
set AppleScript's text item delimiters to Current_TID
set SaveTypes to "Saving " & ThedocName & " as a PhotoShop EPS with the following settings:" & return & return
set SaveNote to "PLEASE NOTE: If these settings are not suitable, you will need to see Jason to change them in the script coding."
--display dialog SaveTypes & "" & "• Embed Color Profile: true" & return & "• Encoding: Maximum Quality JPEG" & return & "• Halftone Screen: false" & return & "• Image interpolation: false" & return & "• PostScript Color Management: false" & return & "• Preview Type: eight bit Mac OS" & return & "• Transfer Function: false" & return & "• Transparent Whites: false" & return & "• Vector Data: false" & return & return & SaveNote with icon 1 giving up after 20
try
set SaveName to TheFolder & DocName & ".eps" as Unicode text
on error e
activate
«event PsCSclos» given «class savo»:no
display dialog "Save Name Error" & return & return & e
error number -128
end try
try
«event PsCSsave» with «class SaCp» given «class kfil»:SaveName, «class fltp»:«constant SvFme004», «class FmOp»:SaveEPSOptions, «class DcXt»:«constant e300e301»
on error e
activate
«event PsCSclos» given «class savo»:no
display dialog "Save Error" & return & return & e
error number -128
end try
«event PsCSclos» given «class savo»:no
end tell
end tell
--return image_data & return & crop_data & return & Jaosn
