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: Shane Stanley <email@hidden>
- Date: Sat, 09 Jul 2016 09:41:42 +1000
On 9 Jul 2016, at 8:50 AM, Jim Underwood <email@hidden> wrote:
return (theSortedNSArray's lastObject()'s valueForKey:(current application's NSURLPathKey)) as text
Just be aware that if the folder is empty, firstObject() and lastObject() will return missing value, and you will get an error trying to call valueForKey: on missing value. So to be safe you should do some kind of check, perhaps getting the count of the array, first.
|
_______________________________________________
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