The Mac I am currently using does not have 'Adobe Photoshop CS3' installed. However, based on [1], the code samples should work. Some editing may be needed, based on your specific requirements.
Sample code01:
-- Code starts here --
on run ()
my handle_Items(choose folder with multiple selections allowed)
end
on open (dItems)
my handle_Items(dItems)
end
on handle_Items(tItemss)
tell application "Adobe Photoshop CS3"
repeat with i in tItemss
set fList to list folder i without invisibles
repeat with j in fList
try
open file ((i as string) & j)
try
set docRef to current document
set (docWidth,docHeight) to (width of docRef,height of docRef)
set minDimension to docWidth
if docWidth > docHeight then set minDimension to docHeight
crop docRef bounds {(docWidth - minDimension) / 2, (docHeight - minDimension) / 2, (docWidth + minDimension) / 2, (docHeight + minDimension) / 2}
save current document
close current document saving no
end try
end try
end repeat
end repeat
end tell
end handle_Items
-- Code ends here --
Save the code as an application (AppleScript 'applet').
You and then either double click on the applet - and navigate to and select a desired folder (or folders), of which its / their contents will be processed; or, you can drag a folder (or folders) onto the applet, of which the folders contents will be processed.
-----
Code sample02:
-- Code starts here --
on adding folder items to tFolder after receiving tItems
tell application "Adobe Photoshop CS3"
repeat with i in tItems
try
open file (i as string)
try
set docRef to current document
set (docWidth,docHeight) to (width of docRef,height of docRef)
set minDimension to docWidth
if docWidth > docHeight then set minDimension to docHeight
crop docRef bounds {(docWidth - minDimension) / 2, (docHeight - minDimension) / 2, (docWidth + minDimension) / 2, (docHeight + minDimension) / 2}
save current document
close current document saving no
end try
end try
end repeat
end tell
end adding folder items to
-- Code ends here --
See '
Folder Actions Reference' about AppleScript Folder Actions; and, '
Running an automation when a folder is changed' for attaching an AppleScript Folder Action.
--- --- --- --- ---
[1] - Consult '
photoshopcs3_applescriptref.pdf' for Adobe Photoshop AppleScript classes and commands.