Re: Questions from Newbie
Re: Questions from Newbie
- Subject: Re: Questions from Newbie
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 28 Feb 2001 09:41:51 -0800
On 2/28/01 9:20 AM, I wrote:
>
Save this as an Application (droplet).
>
I included by mistake a line that I was using to test on my own machine, as
I'm sure you noticed. Without that line (and watch out for the one long
line: you'll have to remove the carriage return that the mail server inserts
if you copy and paste this):
on open theSelection -- any group of files or folders
repeat with theItem in theSelection
my FileOrFolder(theItem) -- do the handler to find out
end repeat
beep
display dialog "All done!"
end open
on FileOrFolder(theItem)
set itemInfo to (info for theItem)
if folder of itemInfo then -- if it's a folder
tell application "Finder" to set folderContents to every item of
theItem -- one line
repeat with i from 1 to (count folderContents)
set innerItem to item i of folderContents
my FileOrFolder(innerItem) -- recursive
end repeat
else if visible of itemInfo then -- if it's a file (omit invisibles)
my Rename(theItem)
end if
end FileOrFolder
on Rename(theItem)
tell application "Finder"
set itemComments to comment of theItem
set commentLength to (count itemComments)
if commentLength > 34 then
set itemComments to text -35 thru -5 of itemComments
else if commentLength > 4 then
set itemComments to text commentLength thru -5 of itemComments
end if
if commentLength > 4 then set name of theItem to itemComments
end tell
end Rename
--
Paul Berkowitz