This script allows you to view and set file type and file creator information from Mac OS X.
It works on a single file or multiple files. To use, drop the file(s) on it. The program will show you the file type and creator type of the first file as well as what it is currently set to change the type/creator to.
The buttons “Cancel” will cause quit with no changes, “Change” will allow you to change the creator or file type, and “Convert” will convert the dragged file to the currently mentioned file creator and types.
OS version: OS X
-- Thomas Myers
-- ITA,Inc.
-- [email]tMyers@itainc.com[/email]
--
-- Free to all, share and learn!
property gFileType : "MooV"
property gCreatorType : "????"
global gFileCount
on ProcessAFile(theFile)
set gFileCount to gFileCount + 1
set theFileInfo to info for theFile
if folder of theFileInfo then
ScanAFolder(theFile)
else
ignoring application responses
tell application "Finder"
set file type of theFile to gFileType
set creator type of theFile to gCreatorType
end tell
end ignoring
end if
end ProcessAFile
on open of fileList
DoList(fileList)
end open
on DoList(fileList)
set gFileCount to 0
repeat
set theFile to item 1 of fileList
tell application "Finder"
set curFileType to file type of theFile
set curCreatorType to creator type of theFile
end tell
set theButton to button returned of (display dialog "Free from: Tom Myers, ITA,Inc (tmyers@itainc.com) v1.2" & return & return & "Convert FileType: '" & curFileType & " '-> '" & gFileType & "'" & return & "Convert Creator: '" & curCreatorType & " '-> '" & gCreatorType & "'" & return buttons {"Cancel", "Change", "Convert"})
if (theButton is "Change") then
select {curFileType, curCreatorType}
if (theButton is "Set") then
set gFileType to curFileType
set gCreatorType to curCreatorType
end if
else
exit repeat
end if
end repeat
set startTime to current date
repeat with aFile in fileList
ProcessAFile(contents of aFile)
end repeat
set endtime to current date
if (count of fileList) > 1 then
display dialog "Completed " & gFileCount & " files: " & endtime - startTime & " seconds"
end if
end DoList
on ScanAFolder(theFolder)
set fileNames to list folder theFolder
repeat with aFile in fileNames
set theFile to (theFolder as string) & contents of aFile
ProcessAFile(alias theFile)
end repeat
end ScanAFolder
on select {curFileType, curCreatorType}
set theButton to button returned of (display dialog "Convert File Type to: " & gFileType & return & "Convert Creator Type to: " & gCreatorType buttons {"File Type", "Creator Type", "Choose 'Like this file'"})
try
if (theButton is "Choose 'Like this file'") then
set theFile to choose file "Select file of same type/Creator"
tell application "Finder"
set gFileType to file type of theFile
copy creator type of theFile to gCreatorType
end tell
else if (theButton is "File Type") then
set gFileType to text returned of (display dialog "Instead of converting File Type to (" & gFileType & "), convert to " default answer curFileType)
else
set gCreatorType to text returned of (display dialog "Instead of converting Creator Type to (" & gCreatorType & "), convert to " default answer curCreatorType)
end if
on error theErr
end try
end select
on run
DoList({choose folder "Select folder to use"})
end run