File Type & Creator Repair (Resource Fork Restore)--Droplet Version

This is the Droplet Version of Clorox File Repair, a script I wrote for my employer (Clorox) which deals with the following problem:

How do I restore the Resoruce Fork of a Macintosh file if a Windows-based system strips it from my graphics files?

This droplet will accept any combination of files and folders dropped onto it and try to repair the damage. What many folks don’t realize is that the Finder is loust at guessing the proper file type, creator, or extension if any of these items are missing or wrong. We found out too late that our new Asset Manager strips the resource fork from our Mac files, and occassionally adds/changes the file extension based on it’s own bad guessing.

What the script does is use GREP to parse through the innards of the files looking for key strings in order to retore Type/Creator information properly. It will also use Photoshop to restore lost Previews (important for Photoshop files placed into Illustrator). It can also tell the difference between a PDF and a native Illustrator file.

HOW IT WORKS: It starts by using the Finder to label all the files red, then one by one parses and tries to fix them. Comments will be left in the Get Info comments. If the script fails to detect what kind of file it is, then the file will stay labelled red, else it will go back to “none.” Some script fixes are “patrial” and you’d need to enable logging to see the details. As best as I can tell, this script causes no damage and won’t make anything worse. It does assume you want all pixel-based imagery to be opened in Photoshop, but that’s harmless.

PLEASE NOTE: Following the script are two JavaScripts…you’ll need those in order for the Photoshop Preview handler to run.

FUTURE: I am currently working on a FaceSpan version that has a nice GUI, like the last version of this script. Progress bars and feedback make the user experience less tedious and doesn’t leave you wondering what it’s doing or if it got stuck.

REPLACES: A previous Code Exchange post, essentially “V1” of this script.

MAIN SCRIPT:

--
-- DECLARE PROPERTIES
--
-- debugging on?
property g_debug : true

--basic file path and names
property g_home_folder_path : path to home folder
property g_log_file_name : "Clorox File Repair Log.txt"


--Native Illustrator and PDF files (need to be checked against together due to nearly exact header structure)
property g_extensions_illustrator_native : {"none", ".ai", ".eps", ".pdf"} --CCM sometimes adds ".eps" or PDF when it doesn't see an extension...doh!
property g_headers_illustrator_native_version : {"Creator:Adobe Illustrator(TM) 3.2", "Creator: Adobe Illustrator(R) 8", "Creator: Adobe Illustrator(R) 9", "Creator: Adobe Illustrator(R) 10", "Creator: Adobe Illustrator(R) 11", "Creator: Adobe Illustrator(R) 12"}

property g_extensions_pdf : {".pdf"}
property g_headers_pdf_version : {"%PDF-1.3.%", "%PDF-1.4.%", "%PDF-1.5.%", "%PDF-1.6.%"} --PDF versions 4, 5, 6, and 7 in that order
property g_headers_pdf_valid : {"AIPDFPrivateData"} --true Illustrator files will not contain this string or use "AIPrivateData" for versions 9 and above

--Illustrator EPS files
property g_extensions_illustrator_eps : {".eps", ".epsf"}
property g_headers_illustrator_eps : {"PS-Adobe-2.0 EPSF-", "PS-Adobe-3.0 EPSF-", "PS-Adobe-3.1 EPSF-"} --valid Illustrator EPS files have this additional header info
property g_headers_illustrator_eps_version : {"Creator:Adobe Illustrator(TM) 3.2", "Creator: Adobe Illustrator(R) 8", "Creator: Adobe Illustrator(R) 9", "Creator: Adobe Illustrator(R) X", "Creator: Adobe Illustrator(R) 11", "Creator: Adobe Illustrator(R) 12"}

--Freehand EPS files
property g_extensions_freehand_eps : {".eps"}
property g_headers_freehand_eps : {"PS-Adobe-2.0 EPSF-"} --valid Freehand EPS files have this additional header info
property g_headers_freehand_version : {"Creator: FreeHand 8", "Creator: FreeHand 7", "Creator: FreeHand MX 11"}

--Photoshop EPS files
property g_extensions_photoshop_eps : {".eps", ".epsf", ".dcs", ".eps_lr", ".eps_hr", ".dcs_lr", ".dcs_hr"}
property g_headers_photoshop_eps : {"Creator: Adobe Photoshop Version 6", "Creator: Adobe Photoshop Version 7", "Creator: Adobe Photoshop Version 8", "Creator: Adobe Photoshop Version 9", "Creator: MediaBin"}

--Photoshop PSD files
property g_extensions_photoshop_psd : {".psd", ".psd_lr", ".psd_hr"}
property g_headers_photoshop_psd : {"Adobe Photoshop 7", "Adobe Photoshop CS Macintosh", "Adobe Photoshop CS2 Macintosh", "8BIM"} -- "8BIM" in header all Photoshop headers 6+...check last since 7 through CS2 detection can be specific

--Photoshop TIF files
property g_extensions_photoshop_tif : {".tif", ".tiff", ".tif_lr", ".tif_hr"}
property g_headers_photoshop_tif : {"Adobe Photoshop 7", "Adobe Photoshop CS Macintosh", "Adobe Photoshop CS2 Macintosh"}

--Photoshop JPG files
property g_extensions_photoshop_jpg : {".jpg", ".jpeg"}
property g_headers_photoshop_jpg : {"Adobe Photoshop 7", "Adobe Photoshop CS Macintosh", "Adobe Photoshop CS2 Macintosh"}

--Photoshop PNG files
property g_extensions_photoshop_png : {".png"}

--Photoshop GIF files
property g_extensions_photoshop_gif : {".gif"}

--InDesign files
property g_extensions_indesign : {"none", ".indd"}
property g_headers_indesign : {"CreatorTool>Adobe InDesign 3", "CreatorTool>Adobe InDesign 4", "Adobe InDesign"} --InDesign 2 header overlaps versions 3 and 4, so check for it last

--Quark Xpress files
property g_extensions_quark : {"none", ".qxd", ".qxp"}
property g_headers_quark : {"MMXPR3.A.AD", "MMXPR3.B.BD", "MMXPR3.C.CX", "MMXPR3 D DX"} --Quark 4, 5, 6, and 7 in that order

--Freehand files
property g_extensions_freehand : {"none", ".fh3", ".fh4", ".fh5", ".fh7", ".fh8", ".fh9", ".fh10", ".fh11"}
property g_headers_freehand : {"AGD1", "AGD2", "AGD3", "FreeHand10", "FreeHand11"}

--Pagemaker files (no unique headers available)
property g_extensions_pagemaker : {".pm5", ".pm6", ".p65"}

--UNIX executables
property g_extensions_unix : {"none"}
property g_headers_unix : {"PAGEZERO"}

--
-- UTILITY HANDLERS
--

--Log Entry Generation
-- With help from StephanK of MacScripter
-- http://bbs.applescript.net/viewtopic.php?pid=76607#p76607
--
on logMe(log_string, indent_level)
	if g_debug is true then --allows turning the debugger on and off so my logMe's can be left in final version
		set log_target to (g_home_folder_path & "Library:Logs:" & g_log_file_name) as text
		try
			set log_file_ref to open for access file log_target with write permission
			repeat indent_level times
				write tab to log_file_ref starting at eof
			end repeat
			write ((log_string as text) & return) to log_file_ref starting at eof
			close access log_file_ref
			return true
		on error
			try
				close access file log_target
			end try
			return false
		end try
	end if
end logMe

-- Finder comment editor
--
on finderCommenter(path_to_file, add_this_text)
	tell application "Finder"
		set existing_comments to (comment of path_to_file)
		
		--check for existing comments
		if existing_comments = "" then
			set new_comments to add_this_text
		else
			set new_comments to existing_comments & return & add_this_text
		end if
		
		--write updated comments
		set comment of path_to_file to new_comments
	end tell
end finderCommenter


-- Date stamp generator
-- with help from StefanK of MacScripter
-- http://bbs.applescript.net/viewtopic.php?id=20420
--
on dateStamp()
	-- Load date components from system
	tell (current date)
		set dayStamp to day
		set monthStamp to (its month as integer)
		set yearStamp to year
	end tell
	
	--coerce components to two-digit form
	set dayStamp to (text -2 thru -1 of ("0" & dayStamp as string))
	set monthStamp to (text -2 thru -1 of ("0" & monthStamp as string))
	set yearStamp to (text 3 thru 4 of (yearStamp as string))
	
	--Assemble datestamp
	return yearStamp & monthStamp & dayStamp as text
	
end dateStamp


--
-- INFORMATION GATHERING HANDLERS
--

-- Determines "real" extension
-- with help from Jacques of MacScripter
-- http://bbs.applescript.net/viewtopic.php?pid=76649#p76649
--
on extensionFinder(file_path)
	--default finder info
	tell (info for file_path without size) to set {file_name, file_extension} to {name, name extension}
	
	if file_extension is not missing value then
		--the finder recognizes the _lr/_hr style extensions just fine,
		--use that to get the name without the extension the Finder sees
		set file_name to text 1 thru -((count file_extension) + 2) of file_name
		
		--check the file name to see if it still contains a CADS extension and
		--the one the Finder saw was the false one added by MediaBin
		tell file_name
			if length > 6 and character -7 is "." then
				if it ends with "_lr" or it ends with "_hr" then
					set file_extension to text -6 thru -1
					set file_name to text 1 thru -8
				end if
			end if
		end tell
		
		return {"." & file_extension, file_name}
	else
		set file_extension to "none"
		return {file_extension, file_name}
	end if
	
end extensionFinder


-- revised GREP routine courtesy of
-- Bruce Phillips of MacScripter
-- http://bbs.applescript.net/viewtopic.php?pid=83871#p83871

on grepForString(path_to_grep, search_list)
	my logMe("BEGIN grepForString Handler", 3)
	
	repeat with current_grep_item in search_list
		try --known bug between AppleScript and GREP where if GREP finds nothing, AppleScript errors-out
			do shell script "/usr/bin/grep --count " & quoted form of current_grep_item & " " & quoted form of POSIX path of path_to_grep
			set grep_result to result
			exit repeat
		on error error_message number error_number
			if error_message is "0" then
				-- grep didn't find anything
				set grep_result to 0
			else
				-- pass on the error
				error error_message number error_number
			end if
		end try
	end repeat
	
	if grep_result is 0 then set current_grep_item to "<nothing found>"
	
	my logMe("¢ RETURN: " & grep_result & "x | " & current_grep_item, 3)
	my logMe("END grepForString Handler", 3)
	
	return {grep_result, contents of current_grep_item}
end grepForString


--
-- FILE DETECTION SUB-HANDLERS
--

-- Am I a native Illustrator or an Acrobat PDF file?
--
on amI_AIorPDF(file_path, file_extension)
	my logMe("BEGIN amI_AIorPDF handler", 2)
	
	--Is it even possible I am an Illustrator of PDF at all?
	if (file_extension is in g_extensions_illustrator_native) or (file_extension is in g_extensions_pdf) then
		
		--I'm either Illustrator or PDF, which am I? (based on AIPDF search)
		set header_grep to grepForString(file_path, g_headers_pdf_valid)
		if item 1 of header_grep is greater than 0 then
			
			--I'm a PDF file
			my logMe("¢ PDF file found", 2)
			
			--what version?
			set header_grep to grepForString(file_path, g_headers_pdf_version)
			if item 2 of header_grep is "%PDF-1.6.%" then
				my logMe("¢ Version: 7", 2)
			else if item 2 of header_grep is "%PDF-1.5.%" then
				my logMe("¢ Version: 6", 2)
			else if item 2 of header_grep is "%PDF-1.4.%" then
				my logMe("¢ Version: 5", 2)
			else if item 2 of header_grep is "%PDF-1.3.%" then
				my logMe("¢ Version: 6", 2)
			end if
			
			--all PDF files use the same File Type, File Creator, and Extension
			set file_type to "PDF " -- note the trailing space...File Type must always be exactly four characters long
			set file_creator to "CARO"
			set file_extension to ".pdf"
			
			my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
			my logMe("END amI_AIorPDF handler", 2)
			return {file_type, file_creator, file_extension}
			
		else
			--Am I a native Illustrator file or an EPS file? (MediaBin sometimes adds ".eps" to end of native Illustrator files)
			set header_grep to grepForString(file_path, g_headers_illustrator_eps)
			if item 1 of header_grep is 0 then
				
				--Am I native Illustrator file?
				set header_grep to grepForString(file_path, g_headers_illustrator_native_version)
				if item 1 of header_grep is greater than 0 then
					my logMe("¢ Illustrator file found", 2)
					
					--what version?
					--these checks are out of numerical order because we didn't use Illustrator 9 or 10 much, so the versions we used more are checked first
					if item 2 of header_grep is "Creator: Adobe Illustrator(R) 12" then
						my logMe("¢ Version: 12 (CS2)", 2)
						set file_type to "PDF " -- note the trailing space...File Type must always be exactly four characters long
					else if item 2 of header_grep is "Creator: Adobe Illustrator(R) 11" then
						my logMe("¢ Version: 11 (CS2)", 2)
						set file_type to "PDF " -- note the trailing space...File Type must always be exactly four characters long
					else if item 2 of header_grep is "Creator: Adobe Illustrator(R) 8" then
						my logMe("¢ Version: 8", 2)
						set file_type to "TEXT"
					else if item 2 of header_grep is "Creator:Adobe Illustrator(TM) 3.2" then
						my logMe("¢ Version: 3.2", 2)
						set file_type to "TEXT"
					else if item 2 of header_grep is "Creator: Adobe Illustrator(R) 9" then
						my logMe("¢ Version: 9", 2)
						set file_type to "PDF " -- note the trailing space...File Type must always be exactly four characters long
					else if item 2 of header_grep is "Creator: Adobe Illustrator(R) 10" then
						my logMe("¢ Version: 10", 2)
						set file_type to "PDF " -- note the trailing space...File Type must always be exactly four characters long
					end if
					
					--all Illustrator files have the same Creator and Extension
					set file_creator to "ART5"
					set file_extension to ".ai"
					
					my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
					my logMe("END amI_AIorPDF handler", 2)
					return {file_type, file_creator, file_extension}
				else
					--not an Illustrator or PDF file (no extension clause)
					my logMe("¢ Not a native Illustrator or PDF file", 2)
					my logMe("END amI_AIorPDF handler", 2)
					return {}
				end if
			else
				--I'm probably an EPS file, not Illustrator
				my logMe("¢ This is probably an EPS file.", 2)
				my logMe("END amI_AIorPDF handler", 2)
				return {}
			end if
		end if
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_AIorPDF handler", 2)
		return {}
	end if
	
end amI_AIorPDF

-- Am I an Illustrator EPS file?
--
on amI_AIeps(file_path, file_extension)
	my logMe("BEGIN amI_AIeps handler", 2)
	
	--Is it even possible I am an Illustrator EPS at all (extension check)?
	if file_extension is in g_extensions_illustrator_eps then
		
		--The proper extension does not necessarily mean it's an Illustrator EPS, check basic header info
		set header_grep to grepForString(file_path, g_headers_illustrator_eps)
		if item 1 of header_grep is greater than 0 then
			
			--May or may not be an EPS file generated by Illustrator (could be FreeHand or Photoshop, for example)
			set header_grep to grepForString(file_path, g_headers_illustrator_eps_version)
			if item 1 of header_grep is greater than 0 then
				
				--what version?
				--these checks are our of numerical order because we didn't use Illustrator 9 or 10 much, so the versions we used more are checked first
				if item 2 of header_grep is "Creator: Adobe Illustrator(R) 12" then
					my logMe("¢ Version: 12 (CS2)", 2)
				else if item 2 of header_grep is "Creator: Adobe Illustrator(R) 11" then
					my logMe("¢ Version: 11 (CS1)", 2)
				else if item 2 of header_grep is "Creator: Adobe Illustrator(R) 8" then
					my logMe("¢ Version: 8", 2)
				else if item 2 of header_grep is "Creator:Adobe Illustrator(TM) 3.2" then
					my logMe("¢ Version: 3.2", 2)
				else if item 2 of header_grep is "Creator: Adobe Illustrator(R) 9" then
					my logMe("¢ Version: 9", 2)
				else if item 2 of header_grep is "Creator: Adobe Illustrator(R) X" then --note how "X" is used instead of "10" for EPS files
					my logMe("¢ Version: 10", 2)
				end if
				
				--all Illustrator EPS files use the same File Type, File Creator, and Extension
				set file_type to "EPSF"
				set file_creator to "ART5"
				set file_extension to ".eps"
				
				my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
				my logMe("END amI_AIeps handler", 2)
				return {file_type, file_creator, file_extension}
			else
				--not an Illustrator EPS file
				my logMe("¢ Not an Illustrator EPS file (version check)", 2)
				my logMe("END amI_AIeps handler", 2)
				return {}
			end if
		else
			--not an Illustrator EPS file
			my logMe("¢ Not an Illustrator EPS file (%PDF check)", 2)
			my logMe("END amI_AIeps handler", 2)
			return {}
		end if
		
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_AIeps handler", 2)
		return {}
	end if
	
end amI_AIeps


-- Am I an Freehand EPS file?
-- (checking these after the AI EPS, even though they are rare, to get all the EPS checks out of the way)
--
on amI_FHeps(file_path, file_extension)
	my logMe("BEGIN amI_FHeps handler", 2)
	
	--Is it even possible I am an Illustrator EPS at all (extension check)?
	if file_extension is in g_extensions_freehand_eps then
		
		--No extension does not necessarily mean it's an Freehand EPS, check header
		set header_grep to grepForString(file_path, g_headers_freehand_eps)
		if item 1 of header_grep is greater than 0 then
			my logMe("¢ Freehand EPS file found", 2)
			
			--May or may not be an EPS file generated by Freehand (could be Photoshop for example)
			set header_grep to grepForString(file_path, g_headers_freehand_version)
			if item 1 of header_grep is greater than 0 then
				
				--version detection
				if item 2 of header_grep is "Creator: FreeHand 7" then
					my logMe("¢ Version: 7", 2)
					set file_creator to "FH70"
				else if item 2 of header_grep is "Creator: FreeHand 8" then
					my logMe("¢ Version: 8", 2)
					set file_creator to "FH80"
				else if item 2 of header_grep is "Creator: FreeHand MX 11" then
					my logMe("¢ Version: MX 11", 2)
					set file_creator to "FH11"
				end if
				
				--all Freehand EPS files use the same file type and extension
				set file_type to "EPSF"
				set file_extension to ".eps"
				
				my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
				my logMe("END amI_FHeps handler", 2)
				return {file_type, file_creator, file_extension}
			else
				--not an Illustrator EPS file
				my logMe("¢ Not an Freehand EPS file (version check)", 2)
				my logMe("END amI_FHeps handler", 2)
				return {}
			end if
		else
			--not an Freehand EPS file
			my logMe("¢ Not a Freehand EPS file (header check)", 2)
			my logMe("END amI_FHeps handler", 2)
			return {}
		end if
		
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_FHeps handler", 2)
		return {}
	end if
end amI_FHeps

-- Am I an Photoshop (bitmap) EPS file?
-- (default all bitmapped EPS files to open in Photoshop)
--
on amI_PhotoshopEPS(file_path, file_extension)
	my logMe("BEGIN amI_PhotoshopEPS handler", 2)
	
	--Is it even possible I am a Photoshop EPS at all (extension check)?
	if file_extension is in g_extensions_photoshop_eps then
		
		--Proper extension does not necessarily mean it's a Photoshop EPS, check header
		set header_grep to grepForString(file_path, g_headers_photoshop_eps)
		if item 1 of header_grep is greater than 0 then
			my logMe("¢ Photoshop EPS file found", 2)
			
			--version detection
			if item 2 of header_grep is "Creator: Adobe Photoshop Version 6" then
				my logMe("¢ Version: 6", 2)
			else if item 2 of header_grep is "Creator: Adobe Photoshop Version 7" then
				my logMe("¢ Version: 7", 2)
			else if item 2 of header_grep is "Creator: Adobe Photoshop Version 8" then
				my logMe("¢ Version: 8 (CS1)", 2)
			else if item 2 of header_grep is "Creator: Adobe Photoshop Version 9" then
				my logMe("¢ Version: 9 (CS2)", 2)
			end if
			
			--all Photoshop EPS files use the same file type and creator type
			set file_type to "EPSF"
			set file_creator to "8BIM"
			
			my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
			my logMe("END amI_PhotoshopEPS handler", 2)
			return {file_type, file_creator, file_extension}
		else
			--not a Photoshop EPS file
			my logMe("¢ Not a Photoshop EPS file ", 2)
			my logMe("END amI_PhotoshopEPS handler", 2)
			return {}
		end if
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_PhotoshopEPS handler", 2)
		return {}
	end if
end amI_PhotoshopEPS

-- Am I an Photoshop PSD file?
--
on amI_PhotoshopPSD(file_path, file_extension)
	my logMe("BEGIN amI_PhotoshopPSD handler", 2)
	
	--Is it even possible I am a Photoshop PSD at all (extension check)?
	if file_extension is in g_extensions_photoshop_psd then
		
		--Proper extension does not necessarily mean it's a Photoshop PSD, check header
		set header_grep to grepForString(file_path, g_headers_photoshop_psd)
		if item 1 of header_grep is greater than 0 then
			my logMe("¢ Photoshop PSD file found", 2)
			
			--version detection
			if item 2 of header_grep is "Adobe Photoshop 7" then
				my logMe("¢ Version: 7", 2)
			else if item 2 of header_grep is "Adobe Photoshop CS Macintosh" then
				my logMe("¢ Version: 8 (CS1)", 2)
			else if item 2 of header_grep is "Adobe Photoshop CS2 Macintosh" then
				my logMe("¢ Version: 9 (CS2)", 2)
			else if item 2 of header_grep is "8BIM" then --must check last since all versions have "8BIM" in header
				my logMe("¢ Version: pre-7", 2)
			end if
			
			--all Photoshop PSD files use the same file type and creator type
			set file_type to "8BPS"
			set file_creator to "8BIM"
			
			my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
			my logMe("END amI_PhotoshopPSD handler", 2)
			return {file_type, file_creator, file_extension}
		else
			--not a Photoshop PSD file
			my logMe("¢ Not a Photoshop PSD file ", 2)
			my logMe("END amI_PhotoshopPSD handler", 2)
			return {}
		end if
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_PhotoshopPSD handler", 2)
		return {}
	end if
end amI_PhotoshopPSD

-- Am I an Photoshop TIF file?
--
on amI_PhotoshopTIF(file_path, file_extension)
	my logMe("BEGIN amI_PhotoshopTIF handler", 2)
	
	--Is it even possible I am a Photoshop TIF at all (extension check)?
	if file_extension is in g_extensions_photoshop_tif then
		
		--Proper extension does not necessarily mean it's a Photoshop TIF, check header
		set header_grep to grepForString(file_path, g_headers_photoshop_tif)
		if item 1 of header_grep is greater than 0 then
			my logMe("¢ Photoshop TIF file found", 2)
			
			--version detection
			if item 2 of header_grep is "Adobe Photoshop 7" then
				my logMe("¢ Version: 7", 2)
			else if item 2 of header_grep is "Adobe Photoshop CS Macintosh" then
				my logMe("¢ Version: 8 (CS1)", 2)
			else if item 2 of header_grep is "Adobe Photoshop CS2 Macintosh" then
				my logMe("¢ Version: 9 (CS2)", 2)
			end if
			
			--all Photoshop TIF files use the same file type and creator type
			set file_type to "TIFF"
			set file_creator to "8BIM"
			
			my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
			my logMe("END amI_PhotoshopTIF handler", 2)
			return {file_type, file_creator, file_extension}
		else
			--not a Photoshop TIF file
			my logMe("¢ Not a Photoshop TIF file ", 2)
			my logMe("END amI_PhotoshopTIF handler", 2)
			return {}
		end if
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_PhotoshopTIF handler", 2)
		return {}
	end if
end amI_PhotoshopTIF

-- Am I an Photoshop JPG file?
--
on amI_PhotoshopJPG(file_path, file_extension)
	my logMe("BEGIN amI_PhotoshopJPG handler", 2)
	
	--Is it even possible I am a Photoshop JPG at all (extension check)?
	if file_extension is in g_extensions_photoshop_jpg then
		
		--Proper extension does not necessarily mean it's a Photoshop JPG, check header
		set header_grep to grepForString(file_path, g_headers_photoshop_jpg)
		if item 1 of header_grep is greater than 0 then
			my logMe("¢ Photoshop JPG file found", 2)
			
			--version detection
			if item 2 of header_grep is "Adobe Photoshop 7" then
				my logMe("¢ Version: 7", 2)
			else if item 2 of header_grep is "Adobe Photoshop CS Macintosh" then
				my logMe("¢ Version: 8 (CS1)", 2)
			else if item 2 of header_grep is "Adobe Photoshop CS2 Macintosh" then
				my logMe("¢ Version: 9 (CS2)", 2)
			end if
			
			--all Photoshop JPG files use the same file type and creator type
			set file_type to "JPEG"
			set file_creator to "8BIM"
			
			my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
			my logMe("END amI_PhotoshopJPG handler", 2)
			return {file_type, file_creator, file_extension}
		else
			--not a Photoshop JPG file
			my logMe("¢ Not a Photoshop JPG file ", 2)
			my logMe("END amI_PhotoshopJPG handler", 2)
			return {}
		end if
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_PhotoshopJPG handler", 2)
		return {}
	end if
end amI_PhotoshopJPG

-- Am I a Photoshop PNG file?
--
on amI_PhotoshopPNG(file_path, file_extension)
	my logMe("BEGIN amI_PhotoshopPNG handler", 2)
	
	--Is it even possible I am a Photoshop PNG at all (extension check)?
	if file_extension is in g_extensions_photoshop_png then
		
		--all Photoshop PNG files use the same file type and creator type
		set file_type to "PNGf"
		set file_creator to "8BIM"
		
		my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
		my logMe("END amI_PhotoshopPNG handler", 2)
		return {file_type, file_creator, file_extension}
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_PhotoshopPNG handler", 2)
		return {}
	end if
end amI_PhotoshopPNG

-- Am I an Photoshop GIF file?
--
on amI_PhotoshopGIF(file_path, file_extension)
	my logMe("BEGIN amI_PhotoshopGIF handler", 2)
	
	--Is it even possible I am a Photoshop GIF at all (extension check)?
	if file_extension is in g_extensions_photoshop_gif then
		
		--all Photoshop GIF files use the same file type and creator type
		set file_type to "GIFf"
		set file_creator to "8BIM"
		
		my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
		my logMe("END amI_PhotoshopGIF handler", 2)
		return {file_type, file_creator, file_extension}
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_PhotoshopGIF handler", 2)
		return {}
	end if
end amI_PhotoshopGIF

-- Am I an InDesign file?
--
on amI_InDesign(file_path, file_extension)
	my logMe("BEGIN amI_InDesign handler", 2)
	
	--Is it even possible I am an InDesign file at all (extension check)?
	if file_extension is in g_extensions_indesign then
		
		--Proper extension does not necessarily mean it's a InDesign, check header
		set header_grep to grepForString(file_path, g_headers_indesign)
		if item 1 of header_grep is greater than 0 then
			my logMe("¢ InDesign file found", 2)
			
			--version detection
			if item 2 of header_grep is "CreatorTool>Adobe InDesign 3" then
				my logMe("¢ Version: 3 (CS1)", 2)
				set file_type to "IDd3"
			else if item 2 of header_grep is "CreatorTool>Adobe InDesign 4" then
				my logMe("¢ Version: 4 (CS2)", 2)
				set file_type to "IDd4"
			else if item 2 of header_grep is "Adobe InDesign" then
				my logMe("¢ Version: 2", 2)
				set file_type to "InDd"
			end if
			
			--all InDesign files use the same creator type and extension
			set file_creator to "InDn"
			set file_extension to ".indd"
			
			my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
			my logMe("END amI_InDesign handler", 2)
			return {file_type, file_creator, file_extension}
		else
			--not an InDesign file
			my logMe("¢ Not an InDesign file ", 2)
			my logMe("END amI_InDesign handler", 2)
			return {}
		end if
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_InDesign handler", 2)
		return {}
	end if
end amI_InDesign

-- Am I a Quark XPress file?
--
on amI_Quark(file_path, file_extension)
	my logMe("BEGIN amI_Quark handler", 2)
	
	--Is it even possible I am an Quark XPress file at all (extension check)?
	if file_extension is in g_extensions_quark then
		
		--Proper extension does not necessarily mean it's a Quark XPress, check header
		set header_grep to grepForString(file_path, g_headers_quark)
		if item 1 of header_grep is greater than 0 then
			my logMe("¢ Quark XPress file found", 2)
			
			--version detection
			if item 2 of header_grep is "MMXPR3.A.AD" then
				my logMe("¢ Version: 4", 2)
				set file_type to "XDOC"
			else if item 2 of header_grep is "MMXPR3.B.BD" then
				my logMe("¢ Version: 5", 2)
				set file_type to "XDOC"
			else if item 2 of header_grep is "MMXPR3.C.CX" then
				my logMe("¢ Version: 6", 2)
				set file_type to "XPRJ"
			else if item 2 of header_grep is "MMXPR3 D DX" then
				my logMe("¢ Version: 7", 2)
				set file_type to "XPRJ"
			end if
			
			--all Quark XPress files use the same creator type
			set file_creator to "XPR3"
			
			my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
			my logMe("END amI_Quark handler", 2)
			return {file_type, file_creator, file_extension}
		else
			--not an Quark XPress file
			my logMe("¢ Not an Quark XPress file ", 2)
			my logMe("END amI_Quark handler", 2)
			return {}
		end if
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_Quark handler", 2)
		return {}
	end if
end amI_Quark

-- Am I a Freehand file?
--
on amI_Freehand(file_path, file_extension)
	my logMe("BEGIN amI_FreeHand handler", 2)
	
	--Is it even possible I am an Freehand file at all (extension check)?
	if file_extension is in g_extensions_freehand then
		set header_grep to grepForString(file_path, g_headers_freehand)
		
		--version detection
		if (file_extension is ".fh11") or (item 2 of header_grep is "FreeHand11") then
			my logMe("¢ Version: 11", 2)
			set file_type to "AGD6"
			set file_creator to "FH11"
			set file_extension to ".fh11"
		else if (file_extension is ".fh10") or (item 2 of header_grep is "FreeHand10") then
			my logMe("¢ Version: 10 (X)", 2)
			set file_type to "AGD5"
			set file_creator to "FH10"
			set file_extension to ".fh10"
		else if (file_extension is ".fh9") then
			my logMe("¢ Version: 9", 2)
			set file_type to "AGD4"
			set file_creator to "FH90"
			set file_extension to ".fh9"
		else if (file_extension is ".fh8") or (item 2 of header_grep is "AGD3") then
			my logMe("¢ Version: 8", 2)
			set file_type to "AGD3"
			set file_creator to "FH80"
			set file_extension to ".fh8"
		else if (file_extension is ".fh7") or (item 2 of header_grep is "AGD2") then
			my logMe("¢ Version: 7", 2)
			set file_type to "AGD2"
			set file_creator to "FH70"
			set file_extension to ".fh7"
		else if (file_extension is ".fh5") or (item 2 of header_grep is "AGD1") then
			my logMe("¢ Version: 5", 2)
			set file_type to "AGD1"
			set file_creator to "FH50"
			set file_extension to ".fh5"
		else if (file_extension is ".fh4") then
			my logMe("¢ Version: 4", 2)
			set file_type to "AGD1"
			set file_creator to "FH40"
			set file_extension to ".fh4"
		else if (file_extension is ".fh3") then
			my logMe("¢ Version: 3", 2)
			set file_type to "FHD3"
			set file_creator to "FHA3"
			set file_extension to ".fh3"
		else
			--not a Freehand file
			my logMe("¢ Not a Freehand file ", 2)
			my logMe("END amI_Freehand handler", 2)
			return {}
		end if
		
		my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
		my logMe("END amI_FreeHannd handler", 2)
		return {file_type, file_creator, file_extension}
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_FreeHand handler", 2)
		return {}
	end if
end amI_Freehand

-- Am I a Pagemaker file?
--
on amI_Pagemaker(file_path, file_extension)
	my logMe("BEGIN amI_Pagemaker handler", 2)
	
	--Is it even possible I am an Pagemaker file at all (extension check)?
	if file_extension is in g_extensions_pagemaker then
		
		--version detection
		if file_extension is ".pm5" then
			my logMe("¢ Version: 5", 2)
			set file_type to "ALB5"
			set file_creator to "ALD5"
			set file_extension to ".pm5"
		else if file_extension is ".pm6" then
			my logMe("¢ Version: 6", 2)
			set file_type to "ALB6"
			set file_creator to "ALD6"
			set file_extension to ".pm6"
		else if file_extension is ".p65" then
			my logMe("¢ Version: 6.5", 2)
			set file_type to "AB65"
			set file_creator to "AD65"
			set file_extension to ".p65"
		else
			--not a Pagemaker file
			my logMe("¢ Not a Pagemaker file ", 2)
			my logMe("END amI_Pagemaker handler", 2)
			return {}
		end if
		
		my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
		my logMe("END amI_Pagemaker handler", 2)
		return {file_type, file_creator, file_extension}
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_Pagemaker handler", 2)
		return {}
	end if
end amI_Pagemaker

-- Am I a real UNIX executable?
-- Courtesy of Adam Bell of Macscripter
-- http://bbs.applescript.net/viewtopic.php?pid=71705#p71705
--
on amI_UNIX(file_path, file_extension)
	my logMe("BEGIN amI_UNIX handler", 2)
	
	--Is it even possible I am a UNIX executable at all (extension check)?
	if file_extension is in g_extensions_unix then
		
		--No extension does not necessarily mean it's a UNIX executable, check header
		set header_grep to grepForString(file_path, g_headers_unix)
		if item 1 of header_grep is greater than 0 then
			my logMe("¢ UNIX executable found", 2)
			
			--don't touch the file any further
			set file_type to "<ignore>"
			set file_creator to "<ignore>"
			set file_extension to "<ignore>"
			
			--remove red file label to show something was done
			tell application "Finder" to set label index of path_to_fix to "0" as text
			
			my logMe("¢ RETURN: " & file_type & " | " & file_creator & " | " & file_extension, 2)
			my logMe("END amI_UNIX handler", 2)
			return {file_type, file_creator, file_extension}
		else
			--not an Illustrator or EPS file (no extension clause)
			my logMe("¢ Not a UNIX executable file", 2)
			my logMe("END amI_UNIX handler", 2)
			return {}
		end if
	else
		my logMe("¢ No valid extensions.", 2)
		my logMe("END amI_UNIX handler", 2)
		return {}
	end if
end amI_UNIX

-- what kind of file is it?
--
on fileDetective(path_to_check)
	my logMe("BEGIN fileDetective handler", 1)
	
	set file_info to {} --file type, file creator, proper file extension, proper file name
	set file_extension to (item 1 of extensionFinder(path_to_check)) --get correct extension
	
	--
	--START DETECTIVE WORK
	--	
	--is it a native Illustrator file? (including CCM-added ".eps" extensions)
	if file_info is {} then
		set file_info to amI_AIorPDF(path_to_check, file_extension)
	end if
	
	--is it an Illustrator EPS file?
	if file_info is {} then
		set file_info to amI_AIeps(path_to_check, file_extension)
	end if
	
	--is it a FreeHand EPS document?
	if file_info is {} then
		set file_info to amI_FHeps(path_to_check, file_extension)
	end if
	
	--is it a bitmapped EPS (or DCS)  document (default to Photoshop)?
	if file_info is {} then
		set file_info to amI_PhotoshopEPS(path_to_check, file_extension)
	end if
	
	--is it a Photoshop PSD document?
	if file_info is {} then
		set file_info to amI_PhotoshopPSD(path_to_check, file_extension)
	end if
	
	--is it a Photoshop TIF document?
	if file_info is {} then
		set file_info to amI_PhotoshopTIF(path_to_check, file_extension)
	end if
	
	--is it a JPEG document (default to Photoshop)?
	if file_info is {} then
		set file_info to amI_PhotoshopJPG(path_to_check, file_extension)
	end if
	
	--is it a PNG document (default to Photoshop)?
	if file_info is {} then
		set file_info to amI_PhotoshopPNG(path_to_check, file_extension)
	end if
	
	--Is it a GIF document (default to Photoshop)?
	if file_info is {} then
		set file_info to amI_PhotoshopGIF(path_to_check, file_extension)
	end if
	
	--is it an InDesign document?
	if file_info is {} then
		set file_info to amI_InDesign(path_to_check, file_extension)
	end if
	
	--is it a Quark Xpress document? (add Quark 7?)
	if file_info is {} then
		set file_info to amI_Quark(path_to_check, file_extension)
	end if
	
	--is it a FreeHand document?
	if file_info is {} then
		set file_info to amI_Freehand(path_to_check, file_extension)
	end if
	
	--is it a PageMaker document?
	if file_info is {} then
		set file_info to amI_Pagemaker(path_to_check, file_extension)
	end if
	
	--is it a real UNIX executable?
	if file_info is {} then
		set file_info to amI_UNIX(path_to_check, file_extension)
	end if
	
	--have all checks failed?
	if file_info is {} then
		my logMe("¢ ERROR: file not recognized", 1)
	end if
	
	my logMe("END fileDetective handler", 1)
	return file_info
end fileDetective

--
-- FILE REPAIR HANDLERS
--

-- Fixes file type and creator
--
on tcRepair(path_to_fix, file_info)
	my logMe("BEGIN tcRepair handler", 1)
	
	if file_info is not {} then
		tell application "Finder"
			set file type of path_to_fix to (item 1 of file_info) as text
			set creator type of path_to_fix to (item 2 of file_info) as text
			
			--remove red file label to show something was done
			set label index of path_to_fix to "0" as text
			
			my logMe("¢ File Type and File Creator repaired.", 1)
		end tell
		
		my finderCommenter(path_to_fix, "¢ File info repaired")
	else
		my logMe("¢ ERROR: File Type or File Creator was not available", 1)
		my logMe("¢ No changes were made", 1)
	end if
	
	my logMe("END tcRepair handler", 1)
end tcRepair

-- Fixes file extension
--
on nameRepair(path_to_fix, file_info)
	my logMe("BEGIN nameRepair handler", 1)
	
	tell application "Finder"
		if (item 3 of file_info) is not "none" then
			set new_name to (item 4 of file_info) & (item 3 of file_info)
		else
			set new_name to name of path_to_fix
		end if
		
		my logMe("¢ Current Finder Name: " & name of path_to_fix, 1)
		my logMe("¢ Proposed New Name: " & new_name, 1)
		
		if name of path_to_fix is not equal to new_name then
			set name of path_to_fix to new_name
			my logMe("¢ Name repaired", 1)
		else
			my logMe("¢ File name doesn't require repair", 1)
		end if
		
		--remove red file label to show something was done
		set label index of path_to_fix to "0" as text
	end tell
	
	my logMe("END nameRepair handler", 1)
end nameRepair

--Restore bitmap file preview
on restorePreview(path_to_fix, file_info)
	my logMe("BEGIN restorePreview handler", 1)
	
	if item 3 of file_info is not ".gif" then
		my logMe("¢ General preview needed", 1)
		
		set script_location to (((path to desktop) as text) & "Create_General_Preview.js") --remove this when switching back to FaceSpan
		(*
		--locate JavaScript for Photoshop (FaceSpan, Mac OS X 10.3 or earlier)
		set where_is_this_app to path to me
		set package_contents to "Contents:Resources:Create_General_Preview.js"
		set script_location to (where_is_this_app & package_contents) as string
		*)
		
	else
		my logMe("¢ GIF file preview needed", 1)
		
		set script_location to (((path to desktop) as text) & "Create_GIF_Preview.js") --remove this when switching back to FaceSpan
		(*
		--locate JavaScript for Photoshop (FaceSpan, Mac OS X 10.3 or earlier)
		set where_is_this_app to path to me
		set package_contents to "Contents:Resources:Create_GIF_Preview.js"
		set script_location to (where_is_this_app & package_contents) as string
		*)
	end if
	
	tell application "Adobe Photoshop CS2"
		open (path_to_fix as alias)
		
		--execute JavaScript control of Photoshop
		--acquired with ScriptingListener plugin per Adobe guidelines
		do javascript (script_location as alias)
	end tell
	my logMe("¢ Photoshop file preview restored", 1)
	
	--remove red file label to show something was done
	tell application "Finder"
		set label index of path_to_fix to "0" as text
	end tell
	
	my logMe("END restorePreview handler", 1)
end restorePreview

--
-- MAIN SCRIPT
--
on open actionItems
	set dropped_items to {}
	set cfr_version to "test" --remove when back in FaceSpan
	
	--remove folders from list
	--
	-- courtesy of Adam Bell of MacScripter
	-- http://bbs.applescript.net/viewtopic.php?pid=77739#p77739
	--
	repeat with current_actionItem in actionItems
		tell application "Finder"
			if (contents of current_actionItem as string) ends with ":" then
				try
					set dropped_items to dropped_items & (files of (entire contents of current_actionItem) as alias list)
				on error -- only one file inside (works around bug)
					set dropped_items to dropped_items & (files of (entire contents of current_actionItem) as alias as list)
				end try
			else
				set dropped_items to dropped_items & current_actionItem
			end if
		end tell
	end repeat
	
	--start main script
	my logMe("--------------------------------------------------", 0)
	my logMe("Clorox File Repair Started", 0)
	my logMe("Debugging Mode = " & g_debug, 0)
	my logMe("--------------------------------------------------", 0)
	
	--mark all files red first, so it's visually obvious what files got touched during the script
	my logMe("Scanning provided files...", 0)
	repeat with currently_coloring in dropped_items
		tell application "Finder"
			set label index of currently_coloring to "2"
		end tell
		my finderCommenter(currently_coloring, "Scanned by Clorox File Repair v" & cfr_version & " on " & dateStamp())
	end repeat
	
	--loop through file list
	repeat with current_item in dropped_items
		
		tell application "Finder" to set name_to_fix to current_item's name as string
		my logMe(return & "Current File Being Fixed, name_to_fix: " & name_to_fix, 0)
		
		--what kind of file is it?
		set file_info to fileDetective(current_item)
		
		--repair file type and creator?
		if (file_info is not {}) and (item 1 of file_info is not "<ignore>") and (item 2 of file_info is not "<ignore>") then
			tcRepair(current_item, file_info)
		end if
		
		--repair file name?
		if (file_info is not {}) and (item 3 of file_info is not "<ignore>") then
			set file_info to (file_info & item 2 of my extensionFinder(current_item)) --add "real" file name to file_info
			tell (info for current_item without size) to set actual_name to name --get current Finder name
			set proper_name to (item 4 of file_info & item 3 of file_info) --construct "real" name and "real" extension
			nameRepair(current_item, file_info) --fix the file name
		end if
		
		--restore preview image? (pixel-based images only)
		--
		--check for null set (file not identified)
		if file_info is not {} then
			--check that file was identified as a Photoshop file
			if (item 2 of file_info is "8BIM") then
				restorePreview(current_item, file_info)
			end if
		end if
		
	end repeat
	
	my logMe("--------------------------------------------------", 0)
	my logMe("Clorox File Repair Finished", 0)
	my logMe("--------------------------------------------------", 0)
	
	quit
end open

Name this one Create_General_Preview.js:

// =======================================================
var id20 = charIDToTypeID( "Mk  " );
    var desc3 = new ActionDescriptor();
    var id21 = charIDToTypeID( "null" );
        var ref1 = new ActionReference();
        var id22 = charIDToTypeID( "Lyr " );
        ref1.putClass( id22 );
    desc3.putReference( id21, ref1 );
    var id23 = charIDToTypeID( "Usng" );
        var desc4 = new ActionDescriptor();
        var id24 = charIDToTypeID( "Nm  " );
        desc4.putString( id24, "SCRIPT_TEMP" );
    var id25 = charIDToTypeID( "Lyr " );
    desc3.putObject( id23, id25, desc4 );
executeAction( id20, desc3, DialogModes.NO );

// =======================================================
var id26 = charIDToTypeID( "Dlt " );
    var desc5 = new ActionDescriptor();
    var id27 = charIDToTypeID( "null" );
        var ref2 = new ActionReference();
        var id28 = charIDToTypeID( "Lyr " );
        var id29 = charIDToTypeID( "Ordn" );
        var id30 = charIDToTypeID( "Trgt" );
        ref2.putEnumerated( id28, id29, id30 );
    desc5.putReference( id27, ref2 );
executeAction( id26, desc5, DialogModes.NO );

// =======================================================
var id31 = charIDToTypeID( "save" );
executeAction( id31, undefined, DialogModes.NO );

// =======================================================
var id32 = charIDToTypeID( "Cls " );
executeAction( id32, undefined, DialogModes.NO );

Name this one Create_GIF_Preview.js:

// =======================================================
var id87 = charIDToTypeID( "CnvM" );
    var desc19 = new ActionDescriptor();
    var id88 = charIDToTypeID( "T   " );
    var id89 = charIDToTypeID( "Grys" );
    desc19.putClass( id88, id89 );
executeAction( id87, desc19, DialogModes.NO );

// =======================================================
var id90 = charIDToTypeID( "FltI" );
executeAction( id90, undefined, DialogModes.NO );

// =======================================================
var id91 = charIDToTypeID( "save" );
executeAction( id91, undefined, DialogModes.NO );

// =======================================================
try
{
var id92 = charIDToTypeID( "slct" );
    var desc20 = new ActionDescriptor();
    var id93 = charIDToTypeID( "null" );
        var ref8 = new ActionReference();
        var id94 = charIDToTypeID( "HstS" );
        ref8.putOffset( id94, -2 );
    desc20.putReference( id93, ref8 );
executeAction( id92, desc20, DialogModes.NO );
}
catch(e)
{
var id92 = charIDToTypeID( "slct" );
    var desc20 = new ActionDescriptor();
    var id93 = charIDToTypeID( "null" );
        var ref8 = new ActionReference();
        var id94 = charIDToTypeID( "HstS" );
        ref8.putOffset( id94, -1 );
    desc20.putReference( id93, ref8 );
executeAction( id92, desc20, DialogModes.NO );
}

// =======================================================
var id95 = charIDToTypeID( "save" );
executeAction( id95, undefined, DialogModes.NO );

// =======================================================
var id96 = charIDToTypeID( "Cls " );
executeAction( id96, undefined, DialogModes.NO );


that is possibly the longest single applescript i have ever seen

LOL…and it’s shorter than Version 1 was thanks to the help of the folks here at MacScripter. :wink:

Glad it worked on the Quark files. We don’t use Quark here, but I wanted to try and cover my bases for the odd Quark file submitted by an outside agency. I didn’t have many sample files to go on. The XPress detection is not as robust as it could be, likely, but glad it worked for you!

I am currently doing testing internally of the application version (created with Facespan), if anyone is interested in testing it. Send me a private message with your e-mail and I’ll send it along.

I’ve made some tweaks from the script provided here, some issues came-up (some FaceSpan related, some were errors on my part), but I don’t have the time right now to back-out the changes from FaceSpan.

–The FreeHand routines above will mis-detect things like text files because I forgot an “if” nest to test against the GREP results against the header info.
–Due to a Finder bug with renaming that hits the FaceSpan app harder than the Droplet, I’ve changed the rename routine to use the command line rename instead.
–I’ve done some fine-tuning around our older internal name scheme (doesn’t affect you folks really).
–Fine-tuned some typos in the logMe routines, should anyone decide to turn them on.

If anyone wants the AppleScript out of FaceSpan, let me know. It would still work as a droplet if you went through and eliminated all the FaceSpan-specific code. I can try to do it quickly myself, but can’t make any promises.

The updated (includes some minor bug fixes) version of this script, in it’s FaceSpan-augmented final form, is available here. I’ve posted the compiled application to ScriptBuilders.

Clorox File Repair 3.x is currently under development. Adding CS3 support (but not Acrobat 8 unfortunately), Barcode Pro 6 support, tweaking AI/EPS discernment, adding bitmap-mode TIFFs, fixing the hangs with Photoshop files under Leopard.

Clorox File Repair 3.0.3 is finished! Now adds CS3 and Leopard compatability, among other things. Just uploaded it to ScriptBuilders, so give it 24 hour or so to update. 2.0.6 got alot of downloads and some decent kudos. Our Digital Asset Manager is still misbehaving with Mac resource forks, so I was given the time to upgrade Clorox File Repair.

Of course CS4 is now out, so I’m already behind. ;-p

If anyone wants to see the revised AppleScript (as it comes out of FaceSpan), let me know. I made alot of improvements in the code based on file handling advice from forum members, especially necessary for Leopard-friendliness.