Re: Renaming files in Finder: why so slow?
Re: Renaming files in Finder: why so slow?
- Subject: Re: Renaming files in Finder: why so slow?
- From: Michelle Steiner <email@hidden>
- Date: Sat, 30 Aug 2003 17:24:25 -0700
On Saturday, August 30, 2003, at 05:29 PM, Bob.Kalbaugh wrote:
set name of thisFile to newName
end repeat
set fContents to (every item of theList)
setfContents to (every folder of thelist)
Thanks for your response, Michelle.
Yes, that is what I had originally wrote but for some reason it didn't
do
what I had intended.
Duh! Of course. thelist is a list, not a folder; lists contain items.
set fContents to (every item of theList)
Shouldn't be needed. It's the same as setfContents to thelist.
repeat with anItem in fContents
repeat with anItem in thelist
if kind of anItem is "Folder" then
my doUnderScore(anItem)
end if
end repeat
So you can simplify the script as follows:
on doUnderScore(theList)
set oldTIDs to AppleScript's text item delimiters
tell application "Finder"
repeat with thisFile in theList
set AppleScript's text item delimiters to {" "}
set oldName to text items of (get the name of thisFile)
set AppleScript's text item delimiters to {"_"}
set newName to (oldName as string)
set name of thisFile to newName\
if kind of thisFile is "folder" then
set fContents to every item of thisFile
my doUnderScrore (fContents)
end if
end repeat
end tell
set AppleScript's text item delimiters to oldTIDs
end doUnderScore
I didn't test this (or even try to compile it), but I think it should
work. It should cut the time in half, because it iterates through the
list only once instead of twice.
--Michelle
--
There are two types of people: those who are going somewhere, and
those who are going nowhere.
--Ben Rumson
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.