I found another thread that used shell scripting to sort a list. It was pretty cool but I have a need to show a list of colors and a matching substitute color. I was thinking this would be in a list of two-item lists to keep the pairs matched. I would like to display the list in alphabetical order based on the original color. Does anyone have any ideas how this could be done in a minimal amount of code?
This works, and is nice and short, for a list of single color names:
set theList to {"Pantone 300", "White Variable", "Black", "Other Color"}
set text item delimiters of AppleScript to ASCII character 10
set theList to "" & theList
set text item delimiters of AppleScript to ""
do shell script "echo " & quoted form of theList & " | /usr/bin/sort"
set theList to paragraphs of result
But I want to sort this list and end up with a new list that still has the paired up colors:
set theList to {{"Pantone 300 Variable", "Pantone 300"}, {"White Variable", "Paper"}, {"FPO Variable Color", "Black"}, {"Legally Approved", "Black"}}
I want the result to be:
{{“FPO Variable Color”, “Black”}, {“Legally Approved”, “Black”}, {“Pantone 300 Variable”, “Pantone 300”}, {“White Variable”, “Paper”}}
Model: PowerPC G5 Tower OS 10.4.8
AppleScript: XCode 2.5
Browser: Safari 419.3
Operating System: Mac OS X (10.4)