• 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: iCal moving events to calendar not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iCal moving events to calendar not working


  • Subject: Re: iCal moving events to calendar not working
  • From: "Nigel Garvey" <email@hidden>
  • Date: Fri, 25 Jul 2008 22:42:31 +0100

"David A. Cox" wrote on Thu, 24 Jul 2008 16:51:55 -0700:

>I am trying to look at a calendar (imported into iCal) and move the
>events to set of other calendars depending on my attendance status for
>the meeting. But when I run the script (a condensed version of it
>below), the events often move to the wrong calendar, and then either
>disapear after a moment, or disapear if I quit iCal and launch it again.

I haven't had enough time with my G5 today to be able to set up a
situation to test your script. The way it's written, _every_ event will
be moved somewhere, even if you're not one of the attendees. Is that what
you want?

There are one or two optimisations that could be made, notably using a
'whose' filter instead of a repeat loop to identify the your attendee:

>			if e's status is tentative then
>				set TentativeStatus to true
>			end if
>
>			set {theAttendees} to e's {attendees}
>
>
>			repeat with j from 1 to (count theAttendees)
>
>
>				set CurrentAccount to item j of theAttendees
>
>				if display name of CurrentAccount is MyCalName then
>					set MyStatus to participation status of CurrentAccount
>
>					if MyStatus is declined then
>						set MoveToDelete to true
>
>
>					else if MyStatus is unknown then
>						set MoveToUndecided to true
>					end if
>				end if
>
>			end repeat

    set TentativeStatus to (e's status is tentative)

    tell (first attendee of e whose display name is MyCalName)
      if (it exists) then
        set MyStatus to its participation status

        if MyStatus is declined then
          set MoveToDelete to true

        else if MyStatus is unknown then
          set MoveToUndecided to true
        end if
      end if
    end tell

Also, of course, expressions like 'if TentativeStatus is true' can be
reduced to 'if TentativeStatus'.

Otherwise, I can't see anything desperately wrong with your code. It
sounds as though something may have become corrupted.

NG

 _______________________________________________
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

  • Follow-Ups:
    • Re: iCal moving events to calendar not working
      • From: "David A. Cox" <email@hidden>
  • Prev by Date: Re: slash path to alias
  • Next by Date: Re: Is this legit? [POSIX]
  • Previous by thread: iCal moving events to calendar not working
  • Next by thread: Re: iCal moving events to calendar not working
  • Index(es):
    • Date
    • Thread