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: Jim Underwood <email@hidden>
- Date: Fri, 08 Jul 2016 23:55:57 +0000
- Thread-topic: ASObjC: Get Most Recent File or Folder
Shane,
Thanks for the heads up.
This seems to work for checking for an empty folder:
if (theSortedNSArray as
list is {}) then return
""
Jim Underwood
aka JMichaelTX
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