• 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: Dave <email@hidden>
  • Date: Fri, 03 Jun 2016 16:23:48 +0100

Hi,

This makes it hard to use from Objective-C.


> On 3 Jun 2016, at 06:34, Christopher Stone <email@hidden> wrote:
>
>  if returningAsListBool = true then
>     # Extract just the paths and convert to an AppleScript list
>     return (theSortedNSArray's valueForKey:(current application's NSURLPathKey)) as list
>   else
>     # 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
>   end if
>

In my opinion it would be better to add another handler that calls the array version and extracts the last Object from the returned array:

on filesIn:folderPOSIXPath sortedBy:sortKey includeFolders:includeFoldersBool


on lastFileIn:folderPOSIXPath sortedBy:sortKey includeFolders:includeFoldersBool

Then Call filesIn:folderPOSIXPath sortedBy:sortKey includeFolders:includeFoldersBool

and return the last item of the return Array.

All the Best
Dave


 _______________________________________________
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: Shane Stanley <email@hidden>
References: 
 >ASObjC: Get Most Recent File or Folder (From: Christopher Stone <email@hidden>)
 >Re: ASObjC: Get Most Recent File or Folder (From: Jim Underwood <email@hidden>)
 >Re: ASObjC: Get Most Recent File or Folder (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: [FYI] more sdef-based library stupidity
  • Next by Date: Re: [FYI] more sdef-based library stupidity
  • Previous by thread: Re: ASObjC: Get Most Recent File or Folder
  • Next by thread: Re: ASObjC: Get Most Recent File or Folder
  • Index(es):
    • Date
    • Thread