Re: ASObjC: Get Most Recent File or Folder
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