Dear Applescripters The script below worked well under Applescript 1.6. However, now that I have upgraded to Applescript 1.7 it (and many other scripts of mine) cause hangs. The Applet is designed to run in the Classic environment (9.2.2) and uses the application ‘Graphic Converter’ to open one or more images dropped onto it, convert it/them into a new format, then save it/them with .tif appended to the name. Graphic Converter opens but nothing else happens until I hit the restart button. Is this an issue relating to paths? Any suggestions on fixes gratefully received. Thanks Dave Mitchell
-- the list of file types which will be processed -- Other file types include TIFF, EPS, JPEG etc property type_list : {"TIFF"}
-- This droplet processes both files or folders of Digital Micrographs --dropped onto it.
-- main program starts here
on open these_items
tell application "GraphicConverter PPC"
activate
end tell
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
if folder of the item_info is true then
process_folder(this_item)
else if (alias of the item_info is false) and ¬
(the file type of the item_info is in the type_list) then
process_item(this_item)
end if
end repeat
tell application "GraphicConverter PPC"
quit saving no
end tell
end open
-- this sub-routine processes folders on process_folder(this_folder)
set these_items to list folder this_folder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((this_folder as text) & (item i of these_items))
set the item_info to info for this_item
if folder of the item_info is true then
process_folder(this_item)
else if (alias of the item_info is false) and ¬
(the file type of the item_info is in the type_list) then
process_item(this_item)
end if
end repeat end process_folder
-- this sub-routine processes files on process_item(this_item)
-- NOTE that the variable this_item is a file reference in alias format
tell application "GraphicConverter PPC"
open this_item
set ImageName to the name of front window as text
change colors front window to bit depth (8) with grayscale without dither
save front window in file (ImageName) as TIFF
--close window
close front window saving no
end tell
tell application "Finder"
set creator type of file (this_item) to "8BIM"
set fileName to name of this_item
if (length of fileName) > 27 then
set fileName to (characters 1 thru (27) of fileName) as text
end if
try
set name of this_item to (fileName & ".tif")
on error m number n
if n is -48 then
display dialog "More than one file's name would resolve to " & ¬
fileName & ".tif" & ". This is not allowed." buttons {"OK"} default button 1 with icon note
else
display dialog (n as text) & " " & m
end if
end try
end tell
end process_item