Sorting lists of strings and lists of lists in Applescript
Sorting lists of strings and lists of lists in Applescript
- Subject: Sorting lists of strings and lists of lists in Applescript
- From: Alastair Leith <email@hidden>
- Date: Tue, 18 Mar 2014 16:07:16 +1100
I found a "sortlist" command in the applescript dictionary but I can't get it to work for me.
set random_list to {"adam", "penny", "prada", "swati", "teddy", "james"} set sorted_list to sortlist random_list ¬ ascending true ¬ remove duplicates false ¬ comparison 1
log random_list log sorted_list
When I pasted the command into Script Debugger it was not wrapped with tell statements but I tried wrapping it in tell application "Finder" in case. There is this comment in the dictionary but I don't know what it refers to — the links are dead:
I found a "sortlist" command in the applescript dictionary but I can't get it to work for me.
The dictionary description suggests this command will also sort a list of lists using the "with respect to" argument by prioritising the criteria with integers (presumably like a table sort in a spreadsheet app but no example or specification is provided).
In short _javascript_ has an inbuilt sort for array objects method: my_array.sort(a,b) does Applescript have anything similar?
|
_______________________________________________
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