Re: Last One - Replacing Chars of file name - I HATE TIDs.
Re: Last One - Replacing Chars of file name - I HATE TIDs.
- Subject: Re: Last One - Replacing Chars of file name - I HATE TIDs.
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 24 Aug 2001 19:24:29 -0700
On 8/24/01 9:05 PM, "T.J. Mahaffey" <email@hidden> wrote:
>
Ok, I'm giving up. I tried the following script in various versions and it
>
does nothing. No error, no nothing.
It does almost everything.
But if you actually want to RENAME the file (as I imagine you do), then you
have to tell the Finder to do that. You haven't done that:
set name of thisFile to theText -- inside the Finder block
see below:
>
>
on open theFileList
>
repeat with thisFile in theFileList
>
tell application "Finder"
>
>
set {AppleScript's text item delimiters, oldTIDs} to {" ",
>
AppleScript's text item delimiters}
>
>
set theText to name of thisFile as string
-- 'name' property already is a string, you don't need 'as string'
here
>
>
set AppleScript's text item delimiters to " "
set AppleScript's text item delimiters to {" "}
-- is actually more accurate, although yours would work by a
coercion
>
>
set textList to text items of theText
>
>
set AppleScript's text item delimiters to "_"
set AppleScript's text item delimiters to {"_"}
>
>
set theText to textList as string
>
>
set AppleScript's text item delimiters to oldTIDs
set name of thisFile to theText
>
end tell
>
end repeat
>
end open
>
--
Paul Berkowitz