Re: Dumb Finder scripting question
Re: Dumb Finder scripting question
- Subject: Re: Dumb Finder scripting question
- From: Laine Lee <email@hidden>
- Date: Fri, 14 Dec 2007 17:31:16 -0600
- Thread-topic: Dumb Finder scripting question
On 12/14/07 4:26 PM, "Paul Berkowitz" <email@hidden> wrote:
> Right. I've wondered why there's no "root name" or something similar,
> myself.
>
> And
>>> set thesourcename to (name of (info for the_item))
>>> set thesourcename to (text items 1 thru -5 of thesourcename) as Unicode text
>
> will be wrong in the case of extensions that are longer than 3 characters
> (there are some ".jpeg" files around, among others. Not to mention one of
> our favorites here - ".scpt").
>
> Best to get both the name and name extension in the Finder, count the
> extension, and use text 1 to (that -2), if that is not 0, of the name. I
> know you know that, but maybe not everyone has thought of it.
Right, of course, if you want to eliminate static constraints. I wanted to
find out if text "munging" is just as unacceptable to Mark as using TIDs,
and apparently it is.
It seems to me that their was at one time a displayed name property that
worked, but only if show all extensions wasn't selected in Finder
preferences. Modest experimentation in 10.5.1 seems to indicate that's still
true for Applescript's (as opposed to Finder) info, except that some
extensions appear to be displayed regardless of that setting.
Also, it appears that you can demonstrate a difference between the displayed
name and the item name using the Finder, but only if the extension hidden
property value for the item is false. I don't know what determines that,
because the preference item in question does not seem to have a consistent
effect for all file system objects which are either files or packages but
not folders. For example, I could ask Finder for the displayed name of a
GarageBand document (a package) and it would return the displayed name which
did not include the "band" extension whether or not the extension appeared
in the Finder's visible name for the document, as determined by Finder
preferences. But for a file having the name exension "m4v", the preference
setting did not prevent the displayed name of the item from including the
name extension, and a script asking Finder for info revealed no distinction
between name and displayed name. I'll bet the ostensible inconsistency is
related either to launch services or to whether the item is a package, or
both.
--
Laine Lee
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden