iCal calendars don’t have an enabled property. Is there another way to check whether a calendar is enabled or not? Thanks.
This Script reads the various plist files. (So AFAIK they only update when iCal quits)
The script works on my mac. and I have only just written it to see if it could be done.
property AppSupp_folder : POSIX path of (path to application support from user domain)
set CalplistPath to quoted form of (AppSupp_folder & "iCal/Sources/" as Unicode text)
set NodeplistPath to quoted form of (AppSupp_folder & "iCal/nodes" as Unicode text)
set Corefolders to paragraphs of (do shell script "cd " & CalplistPath & "; ls -t1") as list
tell application "iCal"
set biglist to {}
set bigCal_List to {}
repeat with aCalendar in calendars
tell aCalendar
set a to name of aCalendar
copy a to end of biglist
end tell
end repeat
end tell
biglist
repeat with i from 1 to number of items in Corefolders
set NodeMatch to ""
set this_coreInfo to item i of Corefolders
set aTitle to do shell script "defaults read " & (CalplistPath & this_coreInfo & "/info " as string) & " Title"
set this_coreInfo to do shell script "echo " & quoted form of this_coreInfo & "| awk -F.calendar '{print $1}'"
set NodeMatch to word -1 of (do shell script "defaults read " & NodeplistPath & "|grep -ib1 " & quoted form of this_coreInfo & " |grep -i \"Selection\"")
if NodeMatch is "0" then
set NodeMatch to "Un-Enabled"
else
set NodeMatch to "Enabled"
end if
repeat with i from 1 to number of items in biglist
set this_icalname to item i of biglist
if aTitle is this_icalname then
set this_cal to this_icalname & " is : " & NodeMatch as string
copy this_cal to end of bigCal_List
end if
end repeat
end repeat
bigCal_List
Great approach, Mark.
I tried vainly to find a GUI scripting solution
Thanks Stefan.
Thanks Mark, brilliant!