howdy all,
i wrote this script in Leopard, but i didn’t think i was using any language that wasn’t already established in Tiger, but it’s not working in Tiger for some reason and i can’t find any reference for anything different. it seems to break at the line “set cpPath to the entire path of every path item of current document”
can someone tell me what i’m doing wrong?
thanks!
ray
property type_list : {"TIFF", "JPEG"}
property extension_list : {"tif", "jpg"}
on run
-- save old TID
set oldDelims to AppleScript's text item delimiters
-- declare new TID
set AppleScript's text item delimiters to "."
tell application "Finder"
--find the content folders
set jpeg_folder to (choose folder with prompt "Choose the folder containing the JPEG images:") as string
set jpeg_files to every file of folder jpeg_folder whose ¬
file type is in the type_list and name extension is in the extension_list
set tiff_folder to (choose folder with prompt "Choose the folder containing the tiff images:") as string
set tiff_files to every file of folder tiff_folder whose ¬
file type is in the type_list and name extension is in the extension_list
set end_folder to (choose folder with prompt "Choose a destination folder for your new images:") as string
--start the process
try
--work from the jpeg files
repeat with jpeg_files in the jpeg_files
--strip the file name of the suffix
set {name:n} to properties of jpeg_files
set fName to n's text 1 thru text item -2
--find the files with the same name
set cpJpeg to jpeg_folder & fName & ".jpg"
set hiresTiff to tiff_folder & fName & ".tif"
--open JPEG
tell application "Adobe Photoshop CS3"
activate
open file cpJpeg
--get the paths
set cpPath to the entire path of every path item of current document
set cpName to the name of every path item of current document
close current document
end tell
--open TIFF
if exists hiresTiff then
tell application "Adobe Photoshop CS3"
activate
open file hiresTiff
--add the paths
repeat with i from 1 to count cpPath
set newCP to item i of cpPath
set newName to item i of cpName
set newpath to make path item of current document with properties {name:newName, entire path:newCP, kind:clipping}
end repeat
--save new file as tiff in separate folder
save current document as TIFF in file end_folder without copying
close current document
end tell
end if
end repeat
end try
--tidy up
set AppleScript's text item delimiters to oldDelims
end tell
end run