• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Passing argumenst to C executable from Apple script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Passing argumenst to C executable from Apple script
      • From: Shane Stanley <email@hidden>
    • Re: Passing argumenst to C executable from Apple script
      • From: Philip Aker <email@hidden>
References: 
 >Passing argumenst to C executable from Apple script (From: SVV Satyanarayana <email@hidden>)
 >Re: Passing argumenst to C executable from Apple script (From: Philip Aker <email@hidden>)
 >Re: Passing argumenst to C executable from Apple script (From: SVV Satyanarayana <email@hidden>)
 >Re: Passing argumenst to C executable from Apple script (From: "Mark J. Reed" <email@hidden>)
 >Re: Passing argumenst to C executable from Apple script (From: "Mark J. Reed" <email@hidden>)
 >Re: Passing argumenst to C executable from Apple script (From: "Mark J. Reed" <email@hidden>)
 >Re: Passing argumenst to C executable from Apple script (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: Deleting "cached" items from the volumes folder
  • Next by Date: Re: Is there the equivalent of "any item of"
  • Previous by thread: Re: Passing argumenst to C executable from Apple script
  • Next by thread: Re: Passing argumenst to C executable from Apple script
  • Index(es):
    • Date
    • Thread