Re: Sort folder list descending
Re: Sort folder list descending
- Subject: Re: Sort folder list descending
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 25 Mar 2010 18:04:16 -0400
In the category of "how to do things that you really shouldn't be
doing with AppleScript", I like these handlers:
on map(aScript, aList)
set resultList to {}
repeat with anItem in aList
tell aScript to open(anItem)
set end of resultList to the result
end repeat
return resultList
end
on pluck(propName, aList)
set plucker to (run script "script" & return & "on open(foo)" & return & "ret
urn(get " & propName & " of foo)" & return & "end" & return & "end")
return map(plucker, aList)
end pluck
which would let you do this:
set myNames to pluck("name", myItems)
On Thu, Mar 25, 2010 at 5:28 PM, Alex Zavatone <email@hidden> wrote:
>
> On Mar 25, 2010, at 4:20 PM, Luther Fuller wrote:
>
> On Mar 25, 2010, at 4:10 PM, Alex Zavatone wrote:
>
> Ok, it looks like this is most of the way there. Do you have a good way to
> get the text name of the folder out of the resulting list while keeping the
> sort order?
> How do I simply get the folder name of these folders as
> On Mar 25, 2010, at 3:33 PM, Luther Fuller wrote:
>
> get sort (get folders of sourceFolder) by modification date
> set folderList to (reverse of the result) as alias list
>
> Perhaps this does what you are looking for ...
> set sourceFolder to alias "OS_X:Library:Frameworks" -- for example
> tell application "Finder"
> get sort (get folders of sourceFolder) by modification date
> set folderList to (reverse of the result) as alias list
> --
> repeat with i from 1 to (count items of folderList)
> (name of item i of folderList) as text
> display dialog the result
> end repeat
> end tell
> beep
> Or not?
>
> Yep. That does. I saw that I could get the name of an individual item of
> the list but for some reason you can not get the name of every item or each
> item in the list. I was hoping there was one of those elegant AppleScript
> one liners that lets you do a loop in one line.
> Sometimes, it's pretty impossible to know when AppleScript will let you do
> do something and when it won't.
> Thanks Luther. You saved me serious pain here.
> Cheers,
> - Alex
> _______________________________________________
> 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
>
--
Mark J. Reed <email@hidden>
_______________________________________________
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