This possibly a simple question. From the “Get Information” Window I can change the file type and creator. I want to create a script that will do this for me for any file I drop on it. The below script works, but DOES NOT change file type or creator. I then realized, this was most likely because my “Get Information” window is modified by Snitch, and that this information is undoubtably stored elsewhere. How do I modify the below script to actually change the type and creator:
on open theSelection
tell application "Finder"
activate
open information window of selection
set Type to "TEXT"
set Creator to "MOSS"
close information window of selection
end tell
end open
PS: The file is just converting files saved as binary because of a .php extension to text for that I can drop them on a web browser.
on open theFolder
repeat with thisItem in theFolder
setCreator(theFolder) of me
end repeat
end open
on run
tell application "Finder"
display dialog ¬
"This is a droplet. Please drop a folder of files or a folder of folders of files on me." with icon 1 buttons {"Ok"} default button 1
end tell
end run
on setCreator(theFolder)
tell application "Finder"
activate
set theseFolderItems to every item in theFolder
repeat with thisItem in theseFolderItems
if kind of thisItem is not "Folder" then
set creator type of thisItem to "MOSS"
else
my setCreator(thisItem) -- recursive
end if
end repeat
end tell
end setCreator
– Script by T.J. Mahaffey
: This possibly a simple question. From the “Get
: Information” Window I can change the file type and
: creator. I want to create a script that will do this for me
: for any file I drop on it. The below script works, but DOES
: NOT change file type or creator. I then realized, this was
: most likely because my “Get Information” window is
: modified by Snitch, and that this information is undoubtably
: stored elsewhere. How do I modify the below script to actually
: change the type and creator: on open theSelection
: tell application “Finder”
: activate
: open information window of selection
: set Type to “TEXT”
: set Creator to “MOSS”
: close information window of selection
: end tell end open
: PS: The file is just converting files saved as binary because of
: a .php extension to text for that I can drop them on a web
: browser.
You rock!
I made a one line addition to also set the file type, but this is great. Thanks so much. It worked perfectly.
The final script is:
on open theFolder
repeat with thisItem in theFolder
setCreator(theFolder) of me
end repeat
end open
on run
tell application "Finder"
display dialog ¬
"This is a droplet. Please drop a folder of files or a folder of folders of files on me." with icon 1 buttons {"Ok"} default button 1
end tell
end run
on setCreator(theFolder)
tell application "Finder"
activate
set theseFolderItems to every item in theFolder
repeat with thisItem in theseFolderItems
if kind of thisItem is not "Folder" then
set creator type of thisItem to "MOSS"
set file type of thisItem to "TEXT"
else
my setCreator(thisItem) -- recursive
end if
end repeat
end tell
end setCreator