Droplet Script used to work fine in Tiger and Leopard, now doesn't
I'd like to apologize in advance, I'm not really good with AppleScript and was only able to create my droplet in the first place by changing little bits of a Droplet example script I found on the internet (I forgot where I found it, but it might even have been here at Apple).
The script worked perfectly fine in Tiger and Leopard but throws an error in Snow Leopard. The error says "Can't make alias "...filepath... "into type file."
The problem is that I can't find the problem in my script. I don't get any indication which line it may be and I hope someone here will be able to help me.
I also tried Script Debugger, but the script works there! So that doesn't help either...
I'd appreciate any help, here is the script:
-- QuickTime supported image formats
property type_list : {"JPEG", "TIFF", "PNGf", "8BPS", "BMPf", "GIFf", "PDF ", "PICT"}
property extension_list : {"jpg", "jpeg", "tif", "tiff", "png", "psd", "bmp", "gif", "jp2", "pdf", "pict", "pct", "sgi", "tga"}
property typeIDs_list : {"public.jpeg", "public.tiff", "public.png", "com.adobe.photoshop-image", "com.microsoft.bmp", "com.compuserve.gif", "public.jpeg-2000", "com.adobe.pdf", "com.apple.pict", "com.sgi.sgi-image", "com.truevision.tga-image"}
-- This droplet processes files dropped onto the applet
on open these_items
repeat with i from 1 to the count of these_items
set this_item to item i of these_items
set the item_info to info for this_item
try
set this_extension to the name extension of item_info
on error
set this_extension to ""
end try
try
set this_filetype to the file type of item_info
on error
set this_filetype to ""
end try
try
set this_typeID to the type identifier of item_info
on error
set this_typeID to ""
end try
if (folder of the item_info is false) and (alias of the item_info is false) and ((this_filetype is in the type_list) or (this_extension is in the extension_list) or (this_typeID is in typeIDs_list)) then
process item(thisitem)
end if
end repeat
end open
-- this sub-routine processes files
on process item(thisfile)
-- NOTE that the variable this_item is a file reference in alias format
-- FILE PROCESSING STATEMENTS GOES HERE
tell application "Image Events"
launch
-- get the parent folder of the image file
set the parent_folder to the container of this_file
-- derive new name for the new image file
set the new_name to my add extension(thisfile, "png")
-- look for an existing file
if (exists file new_name of the parent_folder) then
error "A file named \"" & new_name & "\" already exists."
end if
-- open the image file
set this_image to open this_file
-- save in new file. The result is a file ref to the new file
set the new_image to save this_image as PNG in file new_name of the parent_folder with icon
-- purge the open image data
close this_image
end tell
end process_item
on add extension(thisfile, new_extension)
set this_info to the info for this_file
set this_name to the name of this_info
set this_extension to the name extension of this_info
if this_extension is missing value then
set the default_name to this_name
else
set the default_name to text 1 thru -((length of this_extension) + 2) of this_name
end if
return (the default_name & "." & the new_extension)
end add_extension
MacBookPro, Mac OS X (10.6.1), 4 GB Ram