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

Re: Sorting? [sorted]


  • Subject: Re: Sorting? [sorted]
  • From: bill fancher <email@hidden>
  • Date: Fri, 13 Sep 2002 21:18:05 -0700

Or you could do it with Python (installed by default on 10.2):

set s to "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 text item delimiters to ASCII character 10
do shell script paragraphs of ("python -c '
temp = \"\"\"" & s & "\"\"\"
temp = [name[0:9] + \"%.2d\" % int(name[9:]) for name in temp.split()]
temp.sort()
for name in temp:
print name[0:9] + \"%d\" % int(name[9:])
'") as string

BTW, the construct

set text item delimiters to ASCII character 10
paragraphs of whatever as string

is nice for multi-line shell scripts too:

set text item delimiters to ASCII character 10
do shell script paragraphs of ("
echo Man Page for grep:
man grep | col -b
") as string

--
bill
_______________________________________________
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: Sorting? [sorted]
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: Sorting? [sorted] (From: John Delacour <email@hidden>)

  • Prev by Date: Re: Scripting Style (was: Re: Hiding Slaves)
  • Next by Date: Re: Sorting? [sorted]
  • Previous by thread: Re: Sorting? [sorted]
  • Next by thread: Re: Sorting? [sorted]
  • Index(es):
    • Date
    • Thread