Après avoir essayé sans grand succès une médiocre solution, j'ai
trouvé ce qui suit sur internet.
--Script de Kim Hunter, pratiquement inchangé.
-- SortCalendar(current date) La routine renvoie une liste d'
évènements triee par chronologie. Pour exploiter, les propriétés des
évènements, il faut revenir dans le contexte de Ical
tell application "iCal"
return {summary of item 1 of my SortCalendar(current date), start
date of item 1 of my SortCalendar(current date)}
end tell
on SortCalendar(DateDebut)
tell application "iCal"
set FutureEventList to every event of calendar 1 whose start date
is greater than (DateDebut)
set SortedEventList to my sortEvents(FutureEventList)
return SortedEventList
end tell
end SortCalendar
on findLeastItem(lst)
tell application "iCal"
set theLeast to start date of item 1 of lst
set theIndex to 1
set iterater to 1
repeat with i in lst
if start date of i ≤ theLeast then
set theLeast to start date of i
set theIndex to iterater
end if
set iterater to iterater + 1
end repeat
return theIndex
end tell
end findLeastItem
on removeItemAtIndex(lst, theIndex)
set newList to {}
set theLength to length of lst
if theLength = 1 then
set newList to {}
else if theLength = theIndex then
set newList to items 1 thru (theLength - 1) of lst
else if theIndex = 1 then
set newList to items 2 thru theLength of lst
else
set newList to items 1 thru (theIndex - 1) of lst & items (theIndex
+ 1) thru (theLength) of lst
end if
return newList
end removeItemAtIndex
on sortEvents(myList)
set myNewList to {}
repeat until length of myList = 0
set leastIndex to findLeastItem(myList)
set end of myNewList to item leastIndex of myList
set myList to removeItemAtIndex(myList, leastIndex)
end repeat
return myNewList
end sortEvents
_______________________________________________
Applescript_fr mailing list
Applescript_fr@???
http://listes.patpro.net/mailman/listinfo/applescript_fr