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

Re: sort these records?


  • Subject: Re: sort these records?
  • From: KOENIG Yvan <email@hidden>
  • Date: Thu, 29 May 2008 10:06:02 +0200

property listeOwners : missing value
property lesRecords : missing value
property triee : missing value
property linefeed : ASCII character 10

set lesRecords to {{owner:"Dom", cats:{"Sane", "Crazy"}}, {owner:"Andy", cats:{"Hip", "Dip"}}, {owner:"Dom0", cats:{"Sane", "Crazy"}}, {cats:{"Sane", "Crazy"}, owner:"Dom9"}, {owner:"Dom35", cats:{"Sane", "Crazy"}}, {owner:"Dom6", cats:{"Sane", "Crazy"}}, {owner:"Dom", cats:{"Sane", "Crazy"}}, {cats:{"Sane", "Crazy"}, owner:"Dom3"}}

set my listeOwners to {}
repeat with i from 1 to count of lesRecords
	copy owner of item i of lesRecords & tab & i to end of my listeOwners
end repeat

set tt to my recolle(my listeOwners, linefeed)
set triee to paragraphs of (do shell script "echo " & quoted form of tt & " | sort")
set my listeOwners to {}
repeat with i from 1 to count of my triee
copy item (item 2 of my decoupe((item i of my triee) as text, tab)) of lesRecords to end of my listeOwners
end repeat
listeOwners


--my nettoie() (* so the lists will not be saved in the script *)

--=============

on nettoie()
	set listeOwners to missing value
	set lesRecords to missing value
	set triee to missing value
end nettoie

--=============

on recolle(l, d)
	local t
	set AppleScript's text item delimiters to d
	set t to l as Unicode text
	set AppleScript's text item delimiters to ""
	return t
end recolle

--=============

on decoupe(t, d)
	local l
	set AppleScript's text item delimiters to d
	set l to text items of t
	set AppleScript's text item delimiters to ""
	return l
end decoupe

--=============
Yvan KOENIG (from FRANCE jeudi 29 mai 2008 10:05:42)
may be interesting for long lists.


_______________________________________________ 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
References: 
 >as alias bug? (From: Philip Aker <email@hidden>)
 >Re: as alias bug? (From: deivy petrescu <email@hidden>)
 >Re: as alias bug? (From: Michelle Steiner <email@hidden>)
 >Re: sort these records? (From: Michelle Steiner <email@hidden>)
 >Re: sort these records? (From: email@hidden)
 >Re: sort these records? (From: "Mark J. Reed" <email@hidden>)
 >Re: sort these records? (From: deivy petrescu <email@hidden>)

  • Prev by Date: Re: as alias bug?
  • Next by Date: Re: as alias bug?
  • Previous by thread: Re: sort these records?
  • Next by thread: Re: sort these records?
  • Index(es):
    • Date
    • Thread