• 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: Getting Info from the Finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Info from the Finder


  • Subject: Re: Getting Info from the Finder
  • From: "Mark J. Reed" <email@hidden>
  • Date: Tue, 18 May 2010 09:42:39 -0400

Here's a handler that uses mdls to build up an AS record containing
the data you want, with no requirement for satimage:

to getCreatorInfo(myFile)
    set shellCommand to ¬
        "mdls -raw -name kMDItemCreator  -name kMDItemEncodingApplications " ¬
        & (quoted form of (POSIX path of myFile)) ¬
        & " | sed -e 's/^ *\"\\(.*\\)\"/\\1/' "

    set oldTIDs to text item delimiters
    set text item delimiters to character id 0
    set {creator, encodingAppText} to ¬
        text items of (do shell script shellCommand)
    set text item delimiters to oldTIDs

    tell paragraphs of encodingAppText
        set encodingApplications to its items 2 through (length - 1)
   end tell

   return { Creator: creator, EncodingApplications: encodingApplications }
end getCreatorInfo


Which you could then use like this:

set myFile to choose file
tell getCreatorInfo(myFile)
    set myInfo to "Creator: " & its Creator ¬
                     & ", Producer: " & its EncodingApplications as text
end


--
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

References: 
 >Getting Info from the Finder (From: Thomas Fischer <email@hidden>)
 >Re: Getting Info from the Finder (From: Martin Michel <email@hidden>)
 >Re: Getting Info from the Finder (From: Thomas Fischer <email@hidden>)
 >Re: Getting Info from the Finder (From: Luther Fuller <email@hidden>)
 >Re: Getting Info from the Finder (From: Thomas Fischer <email@hidden>)

  • Prev by Date: Re: Getting Info from the Finder
  • Next by Date: FileMaker Pro Hierarchy
  • Previous by thread: Re: Getting Info from the Finder
  • Next by thread: Re: Getting Info from the Finder
  • Index(es):
    • Date
    • Thread