• 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: ASObjC: Get Most Recent File or Folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ASObjC: Get Most Recent File or Folder


  • Subject: Re: ASObjC: Get Most Recent File or Folder
  • From: Jim Underwood <email@hidden>
  • Date: Fri, 03 Jun 2016 05:11:15 +0000
  • Thread-topic: ASObjC: Get Most Recent File or Folder

Thanks, Chris.  This looks very useful.

For those that are blind like me, you can toggle the return of either:
  • only the last item added, 
  • OR a list of items sorted by date added, 
by enabling the proper "return" statement at the end of the handler.



# Extract just the paths and convert to an AppleScript list
  return (theSortedNSArray's valueForKey:(current application's NSURLPathKey)) as list

  

  # Or if you only want the most-recent, use this instead of the previous line:
  # return (theSortedNSArray's lastObject()'s valueForKey:(current application's NSURLPathKey)) as text


Best Regards,

 

Jim Underwood

aka JMichaelTX


From: <applescript-users-bounces+jmichael=email@hidden> on behalf of Chris Stone <email@hidden>
Date: Thu, Jun 2, 2016 at 10:32 PM
To: "ASUL (AppleScript)" <email@hidden>
Subject: ASObjC: Get Most Recent File or Folder

Get the path of the single most recently added item OR get a list of paths sorted by most recently added.

I've updated this with a boolean to allow folders to be included or excluded.

* Note the list of sort-keys at the end – you can play with them all you want.
 _______________________________________________
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: ASObjC: Get Most Recent File or Folder
      • From: Christopher Stone <email@hidden>
References: 
 >ASObjC: Get Most Recent File or Folder (From: Christopher Stone <email@hidden>)

  • Prev by Date: ASObjC: Get Most Recent File or Folder
  • Next by Date: Re: ASObjC: Get Most Recent File or Folder
  • Previous by thread: ASObjC: Get Most Recent File or Folder
  • Next by thread: Re: ASObjC: Get Most Recent File or Folder
  • Index(es):
    • Date
    • Thread