(*
some additional info can be found on the orginal page for this file type and creator type script. this one works in panther (os x 10.3).
it will display the file type and creator of the first file in your selection, and display it asking what to change it to. if all you wanted to do is find out what type some file was, hit cancel. a lot of files in OS X will not have a file type and/or creator, so it will say "missing value" for those. if you enter file type and creator values (always four characters each), it will change ALL FILES that you've dropped in to those values, so be careful which files you drop into it. here are some possible values:
PhotoShop JPEG:
JPEG 8BIM
PhotoShop GIF:
GIFf 8BIM
Simpletext Text:
TEXT ttxt
Picture Viewer JPEG:
JPEG ogle
BBEdit Text:
TEXT R*ch
*)
global folderList
on open fileList
-- display dialog (item 1 of fileList as string)
set folderList to {}
set typesReturn to typecreator(fileList) of me
set newFileType to item 1 of typesReturn
set newCreatorType to item 2 of typesReturn
activate
display dialog ("Will set all files to file type: '" & newFileType & "'
creator type: '" & newCreatorType & "'")
stepthru(fileList, newFileType, newCreatorType) of me
repeat until folderList = {}
tell application "Finder"
set fileListfolders to every item of item 1 of folderList
end tell
set folderCount to the number of items in folderList
if folderCount < 2 then
set folderList to {}
else
set folderList to items 2 through folderCount of folderList
end if
stepthru(fileListfolders, newFileType, newCreatorType) of me
end repeat
delay 0.5
beep
say "ok"
end open
on stepthru(fileList, newFileType, newCreatorType)
if newFileType = "" then
set theNewNewFileType to missing value
else
set theNewNewFileType to ""
repeat with eachLetter in newFileType
set thenum to ASCII number of eachLetter
set theNewNewFileType to theNewNewFileType & (ASCII character thenum) as string
end repeat
end if
if newCreatorType = "" then
set theNewnewCreatorType to missing value
else
set theNewnewCreatorType to ""
repeat with eachLetter in newCreatorType
set thenum to ASCII number of eachLetter
set theNewnewCreatorType to theNewnewCreatorType & (ASCII character thenum) as string
end repeat
end if
repeat with iFile in fileList
tell application "Finder"
set iFileInfo to iFile as string
-- set iFileInfoFolder to file creator of iFileInfo
if the last character of iFileInfo = ":" then
set folderList to folderList & iFile
-- display dialog iFileInfo
else
--display dialog newFileType & ":" & newCreatorType
set file type of iFile to theNewNewFileType
set creator type of iFile to theNewnewCreatorType
end if
end tell
end repeat
end stepthru
on typecreator(fileList)
repeat with iFile in fileList
tell application "Finder"
set iFile to iFile as alias
set iFileInfo to iFile as string
-- set iFileInfoFolder to file creator of iFileInfo
--display dialog iFileInfo
if the last character of iFileInfo = ":" then
--set folderList to folderList & iFile
--set filesInFolder to the files in iFile
set filesInFolder to files in (iFile)
--display dialog filesInFolder
set fileList2 to filesInFolder
-- display dialog iFileInfo
else
set theFIletype to file type of iFile
set theCreatortype to creator type of iFile
if theFIletype = missing value then
set theFileTypeStr to ""
else
set theFileTypeStr to theFIletype as string
end if
if theCreatortype = missing value then
set theCreatortypeStr to ""
else
set theCreatortypeStr to theCreatortype as string
end if
set typesReturnType to text returned of (display dialog "Current Type & Creator: " & theFIletype & ":" & theCreatortype & return & "Set File Type to:" default answer theFileTypeStr)
set typesReturnCreator to text returned of (display dialog "Current Type & Creator: " & theFIletype & ":" & theCreatortype & return & "Set Creator Type to:" default answer theCreatortypeStr)
set typesReturn to {typesReturnType, typesReturnCreator}
return typesReturn
end if
end tell
end repeat
set Type2 to typecreator(fileList2) of me
return Type2
--display dialog "huh"
end typecreator
-- applescript page