Re: THANK YOU! Re: File name list help?
Re: THANK YOU! Re: File name list help?
- Subject: Re: THANK YOU! Re: File name list help?
- From: Arthur J Knapp <email@hidden>
- Date: Mon, 08 Oct 2001 16:26:01 -0400
>
Date: Sun, 07 Oct 2001 15:17:39 -0700
>
Subject: THANK YOU! Re: File name list help?
>
From: "T.J. Mahaffey" <email@hidden>
>
After studying everyone's input, the following has turned out to be the
>
simplest and most ideal form of the solution:
>
>
tell application "Finder"
>
activate
>
set AppleScript's text item delimiters to {return}
>
set theItemNames to name of every item in selection as text
>
set AppleScript's text item delimiters to ""
>
set the clipboard to theItemNames
>
end tell
One problem that you may encounter is when a file or folder name
contains a return character. For instance, the custom "icon" file
that occationally lurks around in folders starts with a return,
(though as an invisible file, it shouldn't be a problem when working
with the Finder's selection).
If this is strictly for user-display purposes, then the following
may assist in reading those lurking return characters:
tell application "Finder"
-- ":" cannot occur in a Mac file or folder name.
-- ( ? But what about Mac OS X ? )
--
set AppleScript's text item delimiters to {":"}
set theItemNames to name of every item of selection as string
if (theItemNames contains return) then
set AppleScript's text item delimiters to {return}
set theItemNames to text items of theItemNames
set AppleScript's text item delimiters to {"\\r"} -- display-literal
set theItemNames to "" & theItemNames
end if
set AppleScript's text item delimiters to {":"}
set theItemNames to text items of theItemNames
set AppleScript's text item delimiters to {return}
set theItemNames to "" & theItemNames
set AppleScript's text item delimiters to {""}
activate
set the clipboard to theItemNames
end tell
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.zavatone.com/