As you can probably tell from my current script, I am somewhat of a novice.
I am trying to create a droplet application script such that when a file types with specific named file extensions are dropped onto the script icon, their respective (previously missing) file type and creator codes are added automatically.
The current script I have compiled returns the following error when a file is dropped;
Can’t get <> of application “Finder”
Any help greatly appreciated. Note that the script was working to set the file type and creator code until I became ambitious in making the set Type actions dependent on the file extension name. I suspect the current script is over-simplistic, and there is much more to this.
Ultimately, I’d like to make the script work in Leopard, Snow Leopard and Lion (hopefully the same code can be used for all three O.S versions, but may need to be saved natively to each).
property FileType : ""
property CreatorType : ""
on open theFiles
tell application "Finder"
activate
if name extension is "paperlibrary" then
set FileType to "LBPR"
set CreatorType to "FSPC"
else if name extension is "patternlibrary" then
set FileType to "LBPT"
set CreatorType to "FSPC"
repeat with eachFile in theFiles
set the file type of eachFile to FileType
set the creator type of eachFile to CreatorType
end repeat
end if
end tell
end open
David