• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to sort a list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to sort a list


  • Subject: Re: how to sort a list
  • From: eric m katerman <email@hidden>
  • Date: Thu, 13 May 2004 16:23:48 -0500

I'm not sure if this works in all cases (whatever that means), but it does for the one you describe:

set the_list to {"c", "b", "e", "a", "d"}
set old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"
"}
set list_string to (the_list as string)
do shell script "echo \"" & list_string & "\" > /Users/eric/data/tmp.dat"
do shell script "sort /Users/eric/data/tmp.dat > /Users/eric/data/tmp2.dat"
set new_string to (do shell script "cat /Users/eric/data/tmp2.dat")
set new_list to (words of new_string)

ek

On May 13, 2004, at 3:00 PM, Andre Vink wrote:

Hi list,

how to sort a list?

{ "c", "b", "e", "a", "d" }
to
{ "a", "b", "c", "d", "e" }

andre
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


---------------------------------------------
Eric Katerman, Math Dept. UT-Austin

past:
recent apps: Script Editor; Terminal; Safari; Mail; Preview
recent docs: current.app; diskspace.scpt; Standard Additions.asdictionary

present:
UTC: Thu May 13 21:19:00 GMT 2004
[no song playing]

future:
next class: complex analysis final (this Saturday at 2pm in CPE 2.216: a little bit of Cauchy, a dash of Riemann, and a healthy smattering of Liouiville)
next seminar: [nothing scheduled for the next 30 days!]
next radio: like biting into a fork (this afternoon in 41 minutes in kvrx: best-of/end-of the semester show)
next sport: *squash club* (this evening at 7pm in rsc/gregory: come and learn how to play squash)

Too often I find that the volume of paper expands to fill the available
briefcases.
-- Governor Jerry Brown
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: how to sort a list
      • From: Christopher Nebel <email@hidden>
References: 
 >how to sort a list (From: Andre Vink <email@hidden>)

  • Prev by Date: how to sort a list
  • Next by Date: Applescript bundle droplet problems
  • Previous by thread: how to sort a list
  • Next by thread: Re: how to sort a list
  • Index(es):
    • Date
    • Thread