• 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: Calendar scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calendar scripting


  • Subject: Re: Calendar scripting
  • From: Christopher Stone <email@hidden>
  • Date: Tue, 20 Oct 2015 19:08:44 -0500

On Oct 20, 2015, at 17:17, Shane Stanley <email@hidden> wrote:
I should also note that after creating an event with Jay's script it does NOT become visible in my Calendar UNTIL I do something like toggle the Work calendar off/on.

To an extent, it's not a bad thing. There are potentially many processes dealing with you event store, and you probably don't want them pinging it all the time to see if anything has changed. 
______________________________________________________________________

Hey Shane,

I hear what you're saying but have to disagree.

There's a reload calendars command, and it fails to do squat.

Created events are not very useful if you can't see them.  To not provide a proper mechanism to refresh their display is negligent – if there is one then it's not working.

You can't even toggle a calendar on/off with AppleScript – something I frequently want to do.

I often want to focus only on my Mother's medical appointment calendar for instance.  I want to toggle all others off and see only her appointments – then I want to toggle everything back on.

Doing this manually with 10 calendars is a drag.

Providing a scripted method of doing it should be a no-brainer for someone who actually scripts their calendar.  (As you are wont to say the devs need to eat their own dog food.)

I'm sick of messing with it, so I finally wrote a GUI script (first draft below).

I'll update this to toggle all calendars appropriately, but it works and reasonably quickly at that.

Combining it with Jay's create event script fixes the event display issue.  A kludged fix is better than no fix.

-------------------------------------------------------------------------------------------
set theDate to ((current date))

tell application "Calendar"
  activate
  tell calendar "Local ⇢ Home"
    set timeString to time string of theDate
    set newEvent to make new event with properties {description:"But it took forever", summary:"This has been created at " & timeString, location:"Using applescript", start date:theDate, end date:theDate + 15 * minutes, allday event:false, status:confirmed}

    

  end tell
end tell
-------------------------------------------------------------------------------------------
set calendarName to "Home ⇢ iCloud"

tell application "System Events"
  tell application process "Calendar"
    tell (first window whose subrole is "AXStandardWindow")

      

      tell outline 1 of scroll area 1 of splitter group 1 of splitter group 1
        set homeCloudCal to first UI element of rows whose text field 1's value is calendarName

        

        repeat with i in homeCloudCal
          if (contents of i) ≠ missing value then
            set homeCloudCal to contents of i
            exit repeat
          end if
        end repeat

        

        tell checkbox 1 of homeCloudCal to perform action "AXPress"
        tell checkbox 1 of homeCloudCal to perform action "AXPress"

        

      end tell
    end tell
  end tell
end tell
-------------------------------------------------------------------------------------------

--
Take Care,
Chris

 _______________________________________________
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: Calendar scripting
      • From: Jay Louvion <email@hidden>
    • Re: Calendar scripting
      • From: Shane Stanley <email@hidden>
References: 
 >Calendar scripting (From: Jay Louvion <email@hidden>)
 >Re: Calendar scripting (From: Shane Stanley <email@hidden>)
 >Re: Calendar scripting (From: Jay Louvion <email@hidden>)
 >Re: Calendar scripting (From: Shane Stanley <email@hidden>)
 >Re: Calendar scripting (From: Christopher Stone <email@hidden>)
 >Re: Calendar scripting (From: Shane Stanley <email@hidden>)

  • Prev by Date: Scripting Apple Directory
  • Next by Date: Re: Countdown Timer
  • Previous by thread: Re: Calendar scripting
  • Next by thread: Re: Calendar scripting
  • Index(es):
    • Date
    • Thread