[<] Sujet : [AS] au Sujet de iCal
De : Yves CiBERT <anonyme@...>
Date : 2010-03-12 08:42:04
Sujet : Re: [AS] au Sujet de iCal
De : Yves Petronin <anonyme@...>
Date : 2010-03-09 18:41:33
Sujet : Re: [AS] au Sujet de iCal
De : Yves Petronin <anonyme@...>
Date : 2010-03-09 19:04:50
Sujet : Re: [AS] au Sujet de iCal
De : Yves Petronin <anonyme@...>
Date : 2010-03-09 20:58:16
Sujet : Re: [AS] au Sujet de iCal
De : Yves Petronin <anonyme@...>
Date : 2010-03-12 13:08:28
Sujet : Re: [AS] au Sujet de iCal
De : Yves Petronin <anonyme@...>
Date : 2010-03-12 13:37:34
Sujet : Re: [AS] au Sujet de iCal
De : Yves Petronin <anonyme@...>
Date : 2010-03-12 19:03:15
Sujet : Re: [AS] au Sujet de iCal
De : Yves Petronin <anonyme@...>
Date : 2010-03-13 10:01:41
Sujet : Re: [AS] au Sujet de iCal
De : Yves Petronin <anonyme@...>
Date : 2010-03-13 14:04:34
Sujet : Re: [AS] au Sujet de iCal
De : Yves Petronin <anonyme@...>
Date : 2010-03-13 15:42:57
Voici une version légèrement modifiée et qui respecte d'avantage la
notion de calendrier, puisque l' heure de départ est maintenant
l'heure zero du jour en cours et non plus l'heure de lancement du script
--SCRIPT
--Script de Kim Hunter, légèrement modifié.
--SortCalendar(pDate_Debut, pRangeDays, pcalendar_index) -- La
routine renvoie une liste d' évènements Ical triée chronologiquement.
Le premier argument est la date du début de la recherche
d'évènements, le second la durée en jours pendant laquelle on
collecte les évènements, le dernier est le N° du calendrier. Pour
exploiter le résultat de cette routine, il faut revenir dans le
contexte de Ical (tell application "Ical"....)
property pDate_Debut : missing value
property pRangeDays : 1
property pcalendar_index : 1 --Numero d'ordre de calendrier.
set pDate_Debut to (current date) - ((hours of (current date)) *
3600) - ((minutes of (current date)) * 60) -- Zero heure de ce jour à
quelques secondes près
if SortCalendar(pDate_Debut, pRangeDays, pcalendar_index) is not {} then
tell application "iCal"
set dlg2 to ""
repeat with i in my SortCalendar(pDate_Debut, pRangeDays,
pcalendar_index)
set a to summary of i
set b to start date of i
set dlg1 to (a as string) & " - " & "jour: " & day of b & " - " &
"Heure: " & time string of b & return
set dlg2 to dlg2 & dlg1 as string
end repeat
return dlg2
--activate
--display dialog dlg2 giving up after 5
end tell
else
beep
say "no event found in calendar" & (pcalendar_index as string) using
"Bruce"
end if
on SortCalendar(pDate_Debut, pRangeDays, pcalendar_index)
tell application "iCal"
set FList to every event of calendar pcalendar_index whose start
date is greater than (pDate_Debut)
set FutureEventList to {}
repeat with i from 1 to count FList
if (start date of item i of FList is less than ((pDate_Debut) +
pRangeDays * days)) then
set end of FutureEventList to item i of FList
end if
end repeat
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
09
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
--SCRIPT
Yves Petronin <anonyme@...>
Apple, AppleScript, AppleScript Studio, AppleTalk, AppleWorks, ColorSync, Finder, HyperCard, iBook, iLife, iMac, iWork, Keynote, Mac, Macintosh, Mac OS, Pages, Panther, PowerBook, Power Mac, Power Macintosh, QuickTime, Safari, Tiger, Xcode sont des marques déposées par Apple Computer, Inc., enregistrées aux Etats-Unis et dans les autres pays. Liste officielle