• 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
Two Windows in the Calendar app?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Two Windows in the Calendar app?


  • Subject: Two Windows in the Calendar app?
  • From: Gil Dawson <email@hidden>
  • Date: Wed, 17 May 2017 14:38:40 -0700

I've done a bit of scripting of the Calendar (née "iCal") app in 10.6.11; however I'm kinda stumped at a new development.

I added (yet another) Google calendar to my collection, and it somehow got added into a separate window.  It works fine, in that I can manually add or delete events and the changes appear on the Google calendar web page after a few seconds; also vice versa.

The problem is, I cannot figure out how to address the second window via AppleScript.  The following program...

tell application "Calendar"
set theWindows to the windows
log "the length of theWindows =" & the length of theWindows
repeat with aWindow in theWindows
log "Window name =           " & name of aWindow
log "Window id =" & uid of aWindow
log "Window index =" & (index of aWindow)
set {lx, uy, rx, ly} to the bounds of aWindow
log "Window bounds =" & "{" & lx & ", " & uy & ", " & rx & ", " & ly & "}"
log "Window visible =" & visible of aWindow
log "Window document exists=" & (exists of document of aWindow)
try
set theCalendars to the calendars of aWindow
log "the length of theCalendars=" & the length of theCalendars
on error errm number errn
log "Error:" & errm & ": #" & errn
end try
log ""
end repeat
end tell

...suggests that the Calendar app actually sports six windows, four of which are invisible:  

(*the length of theWindows =6*)
(*Window name =           email@hidden*)
(*Window id =5309*)
(*Window index =1*)
(*Window bounds ={156, 28, 1249, 766}*)
(*Window visible =true*)
(*Window document exists=false*)
(*Error:Calendar got an error: Can’t get every calendar of window id 5309.: #-1728*)
(**)
(*Window name =           Calendar*)
(*Window id =4696*)
(*Window index =2*)
(*Window bounds ={428, 24, 1530, 1022}*)
(*Window visible =true*)
(*Window document exists=false*)
(*Error:Calendar got an error: Can’t get every calendar of window id 4696.: #-1728*)
(**)
(*Window name =           *)
(*Window id =4698*)
(*Window index =3*)
(*Window bounds ={1540, 447, 1759, 450}*)
(*Window visible =false*)
(*Window document exists=false*)
(*Error:Calendar got an error: Can’t get every calendar of window id 4698.: #-1728*)
(**)
(*Window name =           *)
(*Window id =4699*)
(*Window index =4*)
(*Window bounds ={1522, 536, 1882, 536}*)
(*Window visible =false*)
(*Window document exists=false*)
(*Error:Calendar got an error: Can’t get every calendar of window id 4699.: #-1728*)
(**)
(*Window name =           *)
(*Window id =4700*)
(*Window index =5*)
(*Window bounds ={1517, 468, 1877, 468}*)
(*Window visible =false*)
(*Window document exists=false*)
(*Error:Calendar got an error: Can’t get every calendar of window id 4700.: #-1728*)
(**)
(*Window name =           *)
(*Window id =5310*)
(*Window index =6*)
(*Window bounds ={813, 129, 1049, 129}*)
(*Window visible =false*)
(*Window document exists=false*)
(*Error:Calendar got an error: Can’t get every calendar of window id 5310.: #-1728*)
(**)

The two visible windows are appropriately named; the invisible four have no names.  
None seem to have documents (despite what the dictionary suggests) and none seem to contain "calendars".  

The app itself, however, appears to contain 13 calendars.  

set theCalendars to the calendars --of the app itself
log "the length of theCalendars=" & the length of theCalendars --> 13


repeat with aCalendar in theCalendars
tell aCalendar
log "Calendar name =                         " & name
log "description = " & description
end tell
end repeat

These correspond to the pre-existing thirteen calendars in the "Calendar" window.  The new calendar in the new window (named "email@hidden") isn't in the list.

I've looked in Apple's Calendar Scripting Guide.  It says nothing about two windows in the Calendar app.

Any ideas on how to research/address this situation?  
Perhaps Shane's CalendarLib might help here?

--Gil

 _______________________________________________
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: Two Windows in the Calendar app?
      • From: Gil Dawson <email@hidden>
  • Prev by Date: 10.12.5 chokes "open location" command in applet
  • Next by Date: Comma delimited paragraph
  • Previous by thread: Re: 10.12.5 at work.
  • Next by thread: Re: Two Windows in the Calendar app?
  • Index(es):
    • Date
    • Thread