• 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: Sorting?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sorting?


  • Subject: Re: Sorting?
  • From: John Delacour <email@hidden>
  • Date: Thu, 12 Sep 2002 10:58:04 +0100

At 10:18 am +0200 12/9/02, Gvran Ehn wrote:

Does anyone have a sorting routine that sorts name/numbers correctly?

I used the sorting routine at http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.05.htm
but it gives me this:
page1_box0
page1_box1
page1_box10
page1_box11
page1_box12


In this case I can think of nothing much shorter than this:



set origList to paragraphs of "page1_box0
page1_box1
page1_box10
page1_box11
page1_box12
page1_box13
page1_box14
page1_box15
page1_box16
page1_box17
page1_box18
page1_box19
page1_box2
page1_box20
page1_box21
page1_box22"
set indexList to {}
set ls2 to {}
set finalList to {}
repeat with i in origList
set n to text 10 through -1 of i
set end of indexList to n + 1
end repeat
set max to 0
repeat with i in indexList
set i to 0 + i
if i is greater than max then set max to i
end repeat
repeat with i from 1 to max
set end of ls2 to ""
end repeat
set x to 1
repeat with i in indexList
set i to i as number
set item i of ls2 to item x of origList
set x to x + 1
end repeat
repeat with s in ls2
set s to s as string
if s is not "" then set end of finalList to s as string
end repeat
_______________________________________________
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.

  • Prev by Date: Re: Sorting?
  • Next by Date: Re: AppleScript Guide Books
  • Previous by thread: Re: Sorting?
  • Next by thread: Re: Sorting?
  • Index(es):
    • Date
    • Thread