Re: Passing argumenst to C executable from Apple script
Re: Passing argumenst to C executable from Apple script
- Subject: Re: Passing argumenst to C executable from Apple script
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 18 Apr 2008 17:00:26 -0400
On Fri, Apr 18, 2008 at 11:14 AM, Philip Aker <email@hidden> wrote:
>
> On 08-04-18, at 08:03, Mark J. Reed wrote:
> While on the subject, is there a simple way, given an alias or a file
> object, to get its containing folder as the same sort of object, without
> having to do text item splitting on the pathname or whatever?
> Not really. info for, doesn't provide the container, and alias as a class
> has no properties. Shame.
>
>
> set ptd to path to desktop folder
> tell application "Finder" to container of ptd as alias
Hm. Wonder how expensive that round trip to the Finder is, compared
to some all-in-process list-and-string manipulation? At least we can
be pretty sure that it's already running...
My try at doing it stringishly:
on containerOf(anAlias)
set tid to text item delimiters
set text item delimiters to ":"
set parentChain to reverse of text items of (anAlias as alias as string)
repeat while beginning of parentChain is ""
set parentChain to rest of parentChain
end repeat
set containerPath to (reverse of rest of parentChain) as string
set text item delimiters to tid
containerPath as alias
end containerOf
--
Mark J. Reed <email@hidden>
_______________________________________________
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