AppleScript hulp gezocht.
2 december 2006 - 14:13   
geplaatst door: HAKAN
He, ik ben op zoek naar iemand, voor een vergoeding als je wilt, die mij kan helpen een AppleScript te bouwen voor Ical. Ik heb een bestaand script welke misschien aangepast kan worden. Het gaat erom om de status van een afspraak in Ical te zetten. Apple heeft dit sinds Tiger uit Ical gehaald, maar de velden staan nog steeds in de Ical data alleen Ical heeft niet meer de mogenlijkheid om deze in te vullen. Nu weet ik dat dit kan met een Applescript maar ik kan het niet. Als je geïntresseerd bent stuur me even een PM.

cheers HAKAN

AppleScript hulp gezocht.
6 december 2006 - 17:51    reactie #1
geplaatst door: TLM
[news]En wat heb je nu van Applescript?

status van een afspraak is inderdaad niet meer zichtbaar maar wel nog te bereiken via AS


TLM
[/news]

AppleScript hulp gezocht.
7 december 2006 - 12:46    reactie #2
geplaatst door: HAKAN
He TLM,

Ik heb nu een Script gevonden die volgens mij de status verandert van een afspraak. Deze werkt niet helemaal zoals ik wil maar dit is hem:

tell application "iCal"
   -- Choose the calendar
   set the_cal_name to (choose from list (title of every calendar as list) with prompt "Choose the calendar to search for events among:") as string
   repeat with this_cal in every calendar
      if the_cal_name as string is equal to the name of this_cal then
         set the_cal to this_cal
      end if
   end repeat
   
   -- Look through the events and choose those in the next the_number_of_days
   set the_number_of_days to 5
   set the_event_list to {}
   set the_name_list to {}
   repeat with the_event in every event in the_cal
      if the start date of the_event is greater than the (current date) ¬
         and the start date of the_event is less than the ((current date) + (the_number_of_days * days)) then
         if the (count of the attendees of the_event) is greater than 0 then
            set the end of the_event_list to the_event
            set the end of the_name_list to the summary of the_event & " (" & the start date of the_event & ") -" & the uid of the_event
         end if
      end if
   end repeat
   -- If there are no events in the_number_of_days days with attendees, give up
   if (count of the_name_list) is 0 then
      display dialog "No nearby events found." buttons {"OK"} default button 1
      return
   end if
   -- Otherwise, pick the event
   set the_name to (choose from list (the_name_list) with prompt "Choose the event:") as string
   set the_event to null
   -- Note that we're including the name & date for readability, and the uid for specificity
   -- Kind of ugly, but no way to hide the UID when using the "choose" syntax that I know of
   repeat with this_event in the_event_list
      if the_name is equal to the (summary of this_event & " (" & the start date of this_event & ") -" & the uid of this_event) then
         set the_event to this_event
      end if
   end repeat
   -- If the user hit cancel, the event is null, so give up
   if the_event is null then return
   
   -- Get the list of attendees; in this case, we're assuming display name is unique
   set attendee_list to the display name of every attendee of the_event as list
   set the_attendees to choose from list attendee_list with prompt "Choose the attendee(s) to change the status for:" with multiple selections allowed
   -- Find the one we picked
   repeat with the_attendee in every attendee of the_event
      if the display name of the_attendee is in the_attendees then
         set the_old_status to the participation status of the_attendee
         -- If we got some random status that isn't listed, let the user know
         if the_old_status as string is not in {"unknown", "accepted", "declined", "undecided"} then
            set the_extra_prompt to "
            (was " & the_old_status & ")"
         else
            set the_extra_prompt to ""
         end if
         -- Either way, try to pre-select the current status using "default"
         set the_new_status to choose from list {"unknown", "accepted", "declined", "undecided"} ¬
            with prompt "Choose new status for " & display name of the_attendee & ¬
            ":" & the_extra_prompt default items {the_old_status as string}
         -- Convert the status-as-applescript-constant to status-as-string
         if the_new_status is not false then
            set the_new_status to the_new_status as string
            if the_new_status is equal to "unknown" then set the_new_status to unknown
            if the_new_status is equal to "accepted" then set the_new_status to accepted
            if the_new_status is equal to "declined" then set the_new_status to declined
            if the_new_status is equal to "undecided" then set the_new_status to undecided
            set the participation status of the_attendee to the_new_status
         end if
      end if
   end repeat
   -- Apparently, unless you create and then remove an attendee, iCal may think nothing has happened
   tell the_event
      set fake_attendee to (make new attendee at the beginning of the attendees of the_event)
      delete the fake_attendee
   end tell
end tell

Het zou volgens mij veel simpeler kunnen waarvoor ik hem nodig heb.

thnx HAKAN