• 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 Individual Metadata Items with ASObjC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Individual Metadata Items with ASObjC


  • Subject: Re: Getting Individual Metadata Items with ASObjC
  • From: Christopher Stone <email@hidden>
  • Date: Mon, 1 May 2017 22:21:12 -0500

On 06/10/2016, at 04:20, Christopher Stone <email@hidden> wrote:
I've just consolidated some code I've used for years into a handler.


Hey Folks,

It was just pointed out to me by Jim Underwood that I left a handler out of this when I originally posted it.

I see I also failed to say the Satimage.osax was required.

Appended is a working script.

--
Best Regards,
Chris

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2016/06/09 03:48
# dMod: 2017/05/01 22:15
# Appl: Miscellaneous
# Task: Get kMDItemWhereFroms metadata from the selected file in the Finder.
# Libs: None
# Osax: Satimage.osax
# Tags: @Applescript, @Script, @Satimage.osax, @Finder, @Shell, @Metadata, @WhereFroms
-------------------------------------------------------------------------------------------

tell application "Finder" to set finderSelectionList to selection as alias list
if length of finderSelectionList = 0 then error "No files were selected in the Finder!"
set posixPath to POSIX path of (item 1 of finderSelectionList)

set whereFromsList to getFileWhereFromsUrlList(posixPath)

-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on fndUsing(_find, _capture, _data, _all, strRslt)
    try
        set findResult to find text _find in _data using _capture all occurrences _all ¬
            string result strRslt with regexp without case sensitive
    on error
        false
    end try
end fndUsing
-------------------------------------------------------------------------------------------
on getFileWhereFromsUrlList(posixPath)
    set whereFromsInfo to do shell script "mdls -name kMDItemWhereFroms " & quoted form of posixPath
    set whereFromsURLs to fndUsing("\"(.+)\"", "\\1", whereFromsInfo, true, true) of me
end getFileWhereFromsUrlList
-------------------------------------------------------------------------------------------


 _______________________________________________
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

  • Prev by Date: Re: Copying the path of files selected in Finder
  • Next by Date: Mail list problem. Please ignore
  • Previous by thread: Re: Keynote scatterplot_2d chart making sample
  • Next by thread: Mail list problem. Please ignore
  • Index(es):
    • Date
    • Thread