Creator & Type Droplet

This script creates a droplet which allows the creator & type of a file to be changed, either by typing in a 4-letter code or by browsing to a file/application whose code you want to use.

OS version: Any

on open fileList
	try
		set the_type to text returned of ¬
			(display dialog ("Please Enter File Type to Change to," & return & "e.g. JPEG, TEXT, PICT, WDBN (MS-Word)" & return & return ¬
				& "Or Browse for a File Whose Type and Creator" & return & "You Wish to Copy...") ¬
				default answer ("") buttons {"Cancel", "Browse...", "OK"} default button ("OK"))
	on error
		beep
		display dialog ("Program has terminated (code #1)") with icon stop
	end try
	if the_type is "" then
		try
			set the_chosen to info for (choose file with prompt ("Browse for a File Whose Type and Creator You Wish to Copy..."))
			set the_type to the file type of the_chosen
			set the_creator to the file creator of the_chosen
			set the_name to the name of the_chosen
		on error
			beep
			display dialog ("Program has terminated (code #2)") with icon stop
		end try
	else
		try
			set the_creator to text returned of ¬
				(display dialog ("Please Enter Creator Type to Change to:" & return & return & "e.g. 8BIM (Photoshop), MSWD (MS-Word)" & return ¬
					& "or ttxt (Simpletext)") default answer (""))
		on error
			beep
			display dialog ("Program has terminated (code #3)") with icon stop
		end try
	end if
	
	repeat with i from 1 to the count of fileList
		try
			set this_item to item i of fileList
			set the item_info to info for this_item
			if (folder of the item_info is false) and (alias of the item_info is false) then
				process_file(this_item, the_type, the_creator)
			end if
		on error
			beep
			display dialog ("Program has terminated (code #4)") with icon stop
		end try
	end repeat
	beep
	if the_type != "APPL" then
		try
			display dialog ("File Type(s) Now Changed To: " & the_type & return & return & "Creator Type(s) Now Changed To: " & the_creator) with icon note
		on error
			beep
			display dialog ("Program has terminated (code #5)") with icon stop
		end try
	else
		try
			display dialog ("Creator Type(s) Now Changed To: " & the_creator & ", The Code For " & the_name) with icon note
		on error
			beep
			display dialog ("Program has terminated (code #6)") with icon stop
		end try
	end if
end open

on process_file(this_item, the_type, the_creator)
	try
		tell application "Finder"
			if the_type != "APPL" then
				try
					set the file type of this_item to (the_type)
				on error
					beep
					display dialog ("Program has terminated (code #7)") with icon stop
				end try
			end if
			try
				set the creator type of this_item to (the_creator)
			on error
				beep
				display dialog ("Program has terminated (code #8)") with icon stop
			end try
		end tell
	on error
		beep
		display dialog ("Program has terminated (code #9)") with icon stop
	end try
end process_file

on run
	display dialog ("Drag and Drop File(s) to this Icon to Change Their File and Creator Types...") with icon note buttons ("OK") default button ("OK")
end run

OMG I wrote this and in an unfortunate filing disaster lost my source code :slight_smile:
Still had the compiled application but it’s PPC only and wouldn’t run
Thank goodness I’d had the sense to share it!