Applescript to add img border -- need help doing it to multiple images

I found this applescript that will help me put borders on images. I am trying to adjust it so that when i select multiple images it does them all at the same time. This apple script originally was created to process one img file at a time.

Please help.

Here’s the applescript:

set this_file to choose file with prompt “Select the Image files to put borders on” with multiple selections allowed
set the frame_TH to 9
try
tell application “Image Events”
– start the Image Events application
launch
– open the image file
set this_image to open this_file
– get dimensions of the image
copy dimensions of this_image to {W, H}
– perform action
pad this_image to dimensions {W + frame_TH, H + frame_TH}
– save the changes
save this_image with icon
– purge the open image data
close this_image
end tell
on error error_message
display dialog error_message
end try

Hi,

try this


set theFiles to choose file with prompt "Select the Image files to put borders on" with multiple selections allowed
set the frame_TH to 9

tell application "Image Events"
	-- start the Image Events application
	launch
	repeat with aFile in theFiles
		try
			-- open the image file
			set this_image to open aFile
			-- get dimensions of the image
			copy dimensions of this_image to {W, H}
			-- perform action
			pad this_image to dimensions {W + frame_TH, H + frame_TH}
			-- save the changes
			save this_image with icon
			-- purge the open image data
			close this_image
		on error error_message
			display dialog error_message
			try
				close this_image
			end try
		end try
	end repeat
end tell

Stefan, it worked!!! Thanks a lot! :smiley: