ICal Looping?
I recently migrated to a new MBP8,3 running the latest Lion update 10.7.4. I migrated email and outlook calandars from my aging Windows XP system. I have noticed an apparent iCal problem. Today the fan came on when there wasn't any obvious reason. I opened system.log and found huge numbers of messages from iCal:
May 31 14:04:11 dv-macbook-pro iCal[4818]: VTIMEZONE does not match System Time Zone (America/Los_Angeles) for 19440319T000000 to 19460319T000000: (
"interval: 2001-01-01 00:00:00 +0000, offset: 0"
) != (
"interval: 1945-09-30 01:00:00 -0800, offset: -28800"
BEGIN:VTIMEZONE
X-LIC-LOCATION:America/Los_Angeles
TZID:America/Los_Angeles
BEGIN:DAYLIGHT
TZOFFSETFROM:-0800
TZNAME:PDT
TZOFFSETTO:-0700
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
TZNAME:PST
TZOFFSETTO:-0800
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
May 31 14:04:11 dv-macbook-pro iCal[4818]: Unexpected EOF, returning last token as fallback
It appears to be writing 20-30 of these messages per second!
What does this mean and how can I stop it?
Check to see if you have Timezone Support turned on in iCal.
iCal-->Preferences-->Advanced-->Turn on Time Zone Support.
If you don't need it turn it off. If you do need it, make sure your Date and Time preferences are properly set for the computer.
System Preferences-->Date and Time-->Time Zone
Similar Messages
-
HELP - REALLY URGENT : iCal sending loop mails for an alarm, and more
Hi.
My iCal is not working since 2 months now. Even I post here something, I had no replies. iCal is REALLY slow since 2 months, needing 20 seconds to pass a field (as to go from 20 to 00 field in a 20:00 meeting).
I reinstalled totally my Mac OS for that and it did not change anything. It's linked to SyncServer.
Worst, now I have an alarm that was set last year, to send an email. Everytime I start my laptop, iCal loop this alarm and sent 500 mails, I have to force to quit SyncServer. And if I go to iCal to remove the alarm, iCal crash !
I can't loose all my datas... please do help me !I made that, but as my OS X reinstallation, did not solve anything
and even .mac sync does not work anymore now pff i'm getting tired of Apple in this kind of situation, nobody cares -
Mac 10.6.8 ical "server responded with an error" endless loop
I get an endless loop. "The Server Responded with an Error "--click OK. Next window "The Server Respnded with an Error"--whether click "go offline" or "return to server" takes me back to first window, ad infinitum. Can't change anything on calendar; cannot access ical Preferences. basically cannot do anything except Force Quit, whether logged into my account or my wife's [registered to my wife's yahoo! email].
Also cannot synch calendars now between imac, iphone, and ipad like we could in beginning. Using 10.6.8 because some of my peripherals not compatible with later.
This problem just started a couple of days ago [the server problem freezing the calendar, it hasn't been working properly for awhile and the calendar synch was lost when a friend upgraded the iphone software.]
What can I do to restore 1] the functionality of the ical? and 2] synching the imac, ipad, and iphone icals?I read another response to a similar question posted a couple of years ago. I turned off the Wifi, restarted iCal offline, and that eliminated the message. However, as soon as I turned on the Wifi the message again appeared, the app froze requiring a Force Quit, and the game is still afoot. NO SOLUTIONS ANYONE?
-
ICal in infinite loop adding events
I have truthfully never had much use for Ical. I have found it's functionality, look and feel sadly lacking with other programs.
However, I now have ICAL in what appears to be an infinite loop of trying to add new events. I suspect it has something to do with a link to Google Calendar.
I have nothing of value on ICal and I want to start over from scratch.
How to do?
OS X LION 10.7.5
Macbook Pro. Early 2008Further investigation looks like it's adding every event ever from MEETUP. Still want to NUKE iCAL and start ALL OVER>
Thanks in advance for the assistance.
Chuck -
ICal is frozen, cannot post new appointments. I can post appts on Mac Air and Iphone 5s...they are syncing thru Icloud but the MacBook Pro is stuck. I get the message updating...that has been going for several hours. How can I reset ICal? I have already forece-quit, shut down, and closed...none seem to clear the problem.
When you next have the problem, note the exact time: hour, minute, second.
If you have more than one user account, these instructions must be carried out as an administrator.
Launch the Console application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
View ▹ Show Log List
from the menu bar.
Scroll back in the log to the time you noted above. Select any messages timestamped from then until the end of the episode, or until they start to repeat. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V).
When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
Please do not indiscriminately dump thousands of lines from the log into this discussion.
Important: Some private information, such as your name, may appear in the log. Anonymize before posting. -
ISync and iCal in a loop?
I have recently had to reset my sync history. I now seem to have a problem setting my K800i phone to sync.
Having added the device, when I check the box for calendars, I get a dialogue box saying DO YOU WANT TO USE ICAL AS YOUR CALENDAR APPLICATION. I then click on Open iCal which brings iCal to the front. I then go back to iSync and exactly the same thing happens again when I click to select the calendars syncing.
I have tried removing the device and adding it again, to no avail. Any ideas?
cHey everybody, I have the same problem with my Nokia E51.
Any advice would be most welcome.
Thanks!
Ben -
Stuck in iCal/MobileMe Upgrade Loop
When I launch iCal a dialogue box pops up and I am asked if I want to
"upgrade to the new MobileMe Calendar." I am assured that if I click
the "Upgrade..." button I will "learn more about the new MobileMe
Calendar" and be able to upgrade.
"Sure, why not?"
Clicking "Upgrade..." simply takes me to my calendar at me.com. There
is no information on an upgrade, and nothing seems different.
Each time I launch iCal on any of five Macs currently in use the same cycle
repeats.
TIA!I upgraded to iCal Beta and have regretted it ever since.
First of all I couldn't upgrade despite getting the invite because the upgrade cycle didn't work. Then when I finally upgraded cutting and pasting info into iCal put everything in the wrong order with no simple way of putting it right, so addresses and phone numbers all got mixed up. Then the leave feedback button was nowhere to be seen to report this problem so I decided to leave the Beta. Now I cannot get iCal on iPhone to sync any other way but manually despite no end of resetting sync data, backing up and or erasing calendars. -
ICal in endless update loop ?!?!
My HOME calendar is shared between several devices, two of which use separate email addresses. On these deveces I get the blue box which states: HOME - This calendar is now public." I click OK to dismiss it, then 30 seconds later it reappears. This goes on, and on, and on.......and on....and on....
Anyone else have this problem or know how to fix it?same problem here!
-
Converted Outlook to iCal - All day events messed up
I converted Outlook calendar via O2M and imported it into iCal on iMac. The all-day events are blocking up time from 12:00am to 12:00am rather than appearing in the all-day box at the top of the day. When I click on the event, the "Make All-Day Event" selection is grayed out and I cannot select it. The events are blocking up and crowding my calendar and I can't see anything. I don't want to delete and re-enter all events. Just bought the iMac a week ago. What's the fix?
Found this on another topic and it fixed my problem:
Re: AppleScript to make All-Day Events?
Feb 2, 2006 1:28 AM (in response to Roger Barre)
Hi Roger, This is fairly straighforward in Applescript. You could try something like the script below. Depending on the number of events in the calendar it's possible this could take time. The script should let you know when it's done. Just in case you don't like the result. Backup, just in case. In iCal go to File>Back up Database... and save your calendars. --Copy blue text into Script Editor (Applications > Applescript > Script Editor) , press Run and follow prompts. If you are happy with the results you could save it as an Application.
tell application "iCal"
-- Select calendar
set myCal to first calendar whose title is (item 1 of (choose from list (title of (every calendar) as list) with prompt "Choose calendar"))
-- Loop through events
repeat with myEvt in events of myCal
-- Get start & end times of event
set {startTime, endTime} to {start date of myEvt, end date of myEvt}
-- Check start and end hours & mins
set hoursAndMins to {hours of startTime, minutes of startTime, hours of endTime, minutes of endTime}
-- See if start and end time are midnight, if so set to all day.
if hoursAndMins is equal to {0, 0, 0, 0} then set allday event of myEvt to true
end repeat
display dialog "Done all day events"
end tell Best wishes John
Mac OS X (10.4.4) -
ICal - AppleScript To Convert ToDos To Events
I use a iMac G4 800MHz 15" running 10.4.11. I have used Chronos Personal Organizer 4.5.0 for quite some time. I want to transfer my approximately 21,000 CPO calendar items (all are To Dos) to iCal. This number includes approximately 5,000 items that I transferred from DateBook Pro to CPO a few years ago.
I downloaded the trial version of Chronos SOHO Organizer 6.5.4 and the accompanying converter. I converted my three CPO calendars and then imported them to SOHOO 6.5.4 successfully. Then, I exported each of them from SOHOO 6.5.4 as a ".ics" file. I imported each of these ".ics" files into iCal successfully. However, iCal does not display To Do items embedded in the calendar as does CPO and SOHOO. iCal segregates the To Do items into the To Do list window. Therefore, I wish to convert all of my 21,000 iCal calendar items from To Do items to Events, such that iCal will display them in the calendar display (day / week / month) on the original date that I assigned to each of them. During the conversion from To Do to Event, I wish to retain all text / remarks / notes.
Can anyone suggest an AppleScript that will perform this conversion? I have searched the web exhaustively without any success. Would anyone like to take a stab at writing an AppleScript that performs this conversion? I have read many postings on various forums that wish to do the same thing as me, eg. transfer data from either CPO or SOHOO to iCal but embed the To Do items in the Event calendar.
Thank you.
Kurt R. TodoroffThis is relatively straightforward, but you should be aware of a couple of issues:
A Task, "To Do" in iCal, has no duration and iCal does not seem to parse SOHOO's DUE parameter correctly so it cannot have a time or alarm either.
If you are prepared to have your tasks appear on their original days within iCal, this can be done, but you would either need to choose to have them appear as all day events or events of a fixed duration (e.g. none) and at a fixed time (e.g. 9am).
You could try this (which is the allday event version):
Make a new calendar in iCal called "Test"
Import your .ics file - choosing to add the events to the Test calendar.
Copy and paste the text between the lines (below) into Script Editor and press Run
If you're happy with the result, simply rename your Test calendar.
If not, or I have misunderstood what you want to do, post back.
Good luck, and _*make sure you have taken backups before starting*_.
tell application "iCal"
repeat with calNum from 1 to (count of calendars)
if name of calendar calNum is "Test" then
exit repeat
end if
end repeat
set todoList to todos of calendar calNum
repeat with theTodo in todoList
set dueDate to due date of theTodo
set theSummary to summary of theTodo
set theDescription to description of theTodo
try
set dummy to length of (theDescription)
on error
set theDescription to ""
end try
try
set makeEvent to (make new event at the end of events of calendar calNum with properties ¬
{start date:dueDate, end date:dueDate, summary:theSummary, description:theDescription, allday event:true})
delete theTodo
on error
loop
end try
end repeat
end tell
------------- -
ICal move events from one calendar to another with AppleScript
I made an AppleScript to clean up my calendars and thought I would share. My iMac had a calendar called "Home" and my iPhone had a default calendar "Calendar" so I ended up with all of my events spread across two calendars. Decide to clean up and move everything to one calendar.
This script is admittedly not very efficient. The nested repeat loops means it takes a while to run. Feel free to take this as a start point. I have it checking each property for missing value before adding it to avoid errors. I could have added a line to delete the old event after creating the copy, but I was just deleting the whole old calendar after the script ran.
I hope this is helpful to someone. Oh, this was created under Snow Leopard so if you are in Lion you might need to tweak things. I don't know how much the scripting library has changed.
tell application "iCal"
set thisCalOld to calendar "OldCalendarName"
set thisCalNew to calendar "NewCalendarToMoveEventsTo"
set cntrMatch to 0
set cntrCopied to 0
repeat with thisEventOld in events of thisCalOld
repeat with thisEventNew in events of thisCalNew
set isOKtoProceedWithCopy to true
if (start date of thisEventNew = start date of thisEventOld) and (summary of thisEventNew = summary of thisEventOld) then
--Don't copy
set cntrMatch to cntrMatch + 1
set isOKtoProceedWithCopy to false
exit repeat
end if
end repeat
if isOKtoProceedWithCopy then
set theStamp to stamp date of thisEventOld
set theAllDay to allday event of thisEventOld
set theURL to url of thisEventOld
set theRecur to recurrence of thisEventOld
set theEndDt to end date of thisEventOld
set theClass to class of thisEventOld
set theStartDt to start date of thisEventOld
set theDesc to description of thisEventOld
set theSummary to summary of thisEventOld
set theLoc to location of thisEventOld
set theExcludeDt to excluded dates of thisEventOld
set theSeq to sequence of thisEventOld
set theStatus to status of thisEventOld
tell thisCalNew
set thePropList to {}
if theStamp is not equal to missing value then
set thePropList to thePropList & {stamp date:theStamp}
end if
if theAllDay is not equal to missing value then
set thePropList to thePropList & {allday event:theAllDay}
end if
if theURL is not equal to missing value then
set thePropList to thePropList & {url:theURL}
end if
if theRecur is not equal to missing value then
set thePropList to thePropList & {recurrence:theRecur}
end if
if theEndDt is not equal to missing value then
set thePropList to thePropList & {end date:theEndDt}
end if
if theClass is not equal to missing value then
set thePropList to thePropList & {class:theClass}
end if
if theStartDt is not equal to missing value then
set thePropList to thePropList & {start date:theStartDt}
end if
if theDesc is not equal to missing value then
set thePropList to thePropList & {description:theDesc}
end if
if theSummary is not equal to missing value then
set thePropList to thePropList & {summary:theSummary}
end if
if theLoc is not equal to missing value then
set thePropList to thePropList & {location:theLoc}
end if
if theExcludeDt is not equal to missing value then
set thePropList to thePropList & {excluded dates:theExcludeDt}
end if
if theSeq is not equal to missing value then
set thePropList to thePropList & {sequence:theSeq}
end if
if theStatus is not equal to missing value then
set thePropList to thePropList & {status:theStatus}
end if
set theNewCopy to make new event at end with properties thePropList
end tell
set cntrCopied to cntrCopied + 1
end if
end repeat
end tell
display dialog ("Exists(not copied):" & cntrMatch & " New Copied:" & cntrCopied)That should not be necessary because I get the value of ID out of another table, where I generate ID with a sequence..
So normally it should just tranfer that row from one table to another. But it doesn't !
Knowing that I cannot create a row in the table wouter_published_posts(I can just move rows from the add_post table to the wouter_published_posts table), It should be inpossible that twice the ID appears. But yet he keeps trowing errors...
help me, please -
The new (and poorly designed) iCal list the time on the right of the event in month view. Is there a way to have the time listed to the left of the event.
ie. from Meeting 8 AM To 8AM Meeting.
(Why would they ever change that in the redesign??)On reflection I see whats happening. You are looping through the events, then have an 'if…then' block. You finish that if block before you make the event, so the variables haven't been set if the event isn't on that date.
Move the 'end if' line to after the second to last 'end tell' line and it'll work. You also don't need the second 'tell application "iCal"' line (or associated 'end tell') as you are already in a tell block for iCal.
I hope you find this useful.
Best wishes
John M -
I think this is a client side problem with iCal 4.0.1 in OS 10.6.2, because I'm able to use my exchange calendar via iCal on other machines. The broken machine is stuck in an error loop:
+The account "Exchange" currently can’t be modified. To discard your changes and continue using the version of your calendars that’s on the server, click Revert to Server. To save your changes on your computer until the problem is resolved, click Go Offline.+
Clicking Revert or Try Again just pops up the dialog again with a similar error about another event. The system log message is
iCal: error = Error Domain=CalExchangeErrorDomain Code=-14 ... iCal can’t delete an occurrence from the repeating the event... from the Exchange server.
Anyone know what the error code means, or what can be done to get out of this loop?I ran into the same problem with iCal in Mac OS X 10.6.3. To fix it, I quit iCal, removed ~/Library/Calendars/Calendar Cache, then restarted iCal.
-
Weird order of events added to iCal using Applescript
This is a script that has worked perfectly in the past and as far as I know has not been modified (my bad if so...) Currently it is adding all the correct events into iCal but taking a real long time to do it and this is probably due to the weird chronology it takes to putting the events in. I will include the script at the bottom of this post and here is a section of the event log that shows the weird chronology... Thanks in advance for the help.
dan
count every event of calendar "School Calendar 09-10"
176
get summary of item 1 of every event of calendar "School Calendar 09-10"
"Day 5"
get summary of item 1 of every event of calendar "School Calendar 09-10"
"Day 5"
get start date of item 1 of every event of calendar "School Calendar 09-10"
date "Monday, April 5, 2010 12:00:00 AM"
make new event at end of calendar "Classes2" with properties {summary:"Alg I period 2", start date:date "Monday, April 5, 2010 9:30:00 AM", end date:date "Monday, April 5, 2010 10:25:00 AM"}
event id "879D03C6-24CE-49C8-AB3B-D216FF4CF148" of calendar id "186E5DE2-8E33-492F-9F76-D0EF292B98D8"
make new event at end of calendar "Classes2" with properties {summary:" Pre Calc B period 3", start date:date "Monday, April 5, 2010 10:30:00 AM", end date:date "Monday, April 5, 2010 11:25:00 AM"}
event id "1AF62B85-F074-4E93-A03F-89CFD79A59A6" of calendar id "186E5DE2-8E33-492F-9F76-D0EF292B98D8"
make new event at end of calendar "Classes2" with properties {summary:" IB Math period 4", start date:date "Monday, April 5, 2010 11:30:00 AM", end date:date "Monday, April 5, 2010 12:25:00 PM"}
event id "CCB9EE0D-870E-43EA-AA39-3DAE2BCB23F8" of calendar id "186E5DE2-8E33-492F-9F76-D0EF292B98D8"
get summary of item 2 of every event of calendar "School Calendar 09-10"
"Day 3"
get summary of item 2 of every event of calendar "School Calendar 09-10"
"Day 3"
get start date of item 2 of every event of calendar "School Calendar 09-10"
date "Monday, April 19, 2010 12:00:00 AM"
make new event at end of calendar "Classes2" with properties {summary:" Pre Calc F period 1", start date:date "Monday, April 19, 2010 8:30:00 AM", end date:date "Monday, April 19, 2010 9:25:00 AM"}
event id "F8A5B643-7758-437B-919E-65C0EBF043EA" of calendar id "186E5DE2-8E33-492F-9F76-D0EF292B98D8"
make new event at end of calendar "Classes2" with properties {summary:"Alg I period 3", start date:date "Monday, April 19, 2010 10:30:00 AM", end date:date "Monday, April 19, 2010 11:25:00 AM"}
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;"
title="this text can be pasted into a HTML editor">
tell application "iCal"
---------This is where you gather / set user data
display dialog "How many courses do you teach?" default answer ""
set courses to the text returned of the result as number
set slotA to ""
set slotB to ""
set slotC to ""
set slotD to ""
set slotE to ""
set slotF to ""
set slotG to ""
set slotH to ""
repeat with x from 1 to courses
set entered to text returned of (display dialog "Please enter the slot (A-H) and the course name, separating them with a comma:" default answer "")
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ","
set {chosenslot, chosencourse} to {(entered's text item 1), (entered's text item 2)}
if chosenslot is "A" then
set slotA to chosencourse
end if
if chosenslot is "B" then
set slotB to chosencourse
end if
if chosenslot is "C" then
set slotC to chosencourse
end if
if chosenslot is "D" then
set slotD to chosencourse
end if
if chosenslot is "E" then
set slotE to chosencourse
end if
if chosenslot is "F" then
set slotF to chosencourse
end if
if chosenslot is "G" then
set slotG to chosencourse
end if
if chosenslot is "H" then
set slotH to chosencourse
end if
end repeat
set TargetCalendar to "Classes2"
--Predefined period times
set periodTimes to {{startTime:"08:30 AM", endTime:"09:25 AM"}, {startTime:"09:30 AM", endTime:"10:25 AM"}, {startTime:"10:30 AM", endTime:"11:25 AM"}, {startTime:"11:30 AM", endTime:"12:25 PM"}, {startTime:"12:30 PM", endTime:"01:25 PM"}, {startTime:"01:30 PM", endTime:"02:25 PM"}}
set Day1pattern to {slotA, slotB, slotC, slotD, slotE, slotF}
set Day2pattern to {slotG, slotH, slotA, slotD, slotE, slotB}
set Day3pattern to {slotF, slotC, slotG, slotD, slotE, slotH}
set Day4pattern to {slotB, slotA, slotF, slotD, slotE, slotC}
set Day5pattern to {slotH, slotG, slotB, slotD, slotE, slotA}
set Day6pattern to {slotC, slotF, slotH, slotD, slotE, slotG}
--Predefined period cycles
set Day1 to {slotA & " period 1", slotB & " period 2", slotC & " period 3", slotD & " period 4", slotE & " period 5", slotF & " Period 6 "}
set Day2 to {slotG & " period 1", slotH & " period 2", slotA & " period 3", slotD & " period 4", slotE & " period 5", slotB & " period 6"}
set Day3 to {slotF & " period 1", slotC & " period 2", slotG & " period 3", slotD & " period 4", slotE & " period 5", slotH & " period 6"}
set Day4 to {slotB & " period 1", slotA & " period 2", slotF & " period 3", slotD & " period 4", slotE & " period 5", slotC & " period 6"}
set Day5 to {slotH & " period 1", slotG & " period 2", slotB & " period 3", slotD & " period 4", slotE & " period 5", slotA & " period 6"}
set Day6 to {slotC & " period 1", slotF & " period 2", slotH & " period 3", slotD & " period 4", slotE & " period 5", slotG & " period 6"}
--Makes a "list of lists" so that all the period definitions are in one place
set periodCycle to {Day1, Day2, Day3, Day4, Day5, Day6}
set periodcycle2 to {Day1pattern, Day2pattern, Day3pattern, Day4pattern, Day5pattern, Day6pattern}
set isitacycleday to {"Day 1", "Day 2", "Day 3", "Day 4", "Day 5", "Day 6"}
--This repeat loop is using the cycle day definitions in the calendar named "School Calendar "A.Y.""
repeat with theEvent in (events of calendar "School Calendar 09-10")
if isitacycleday contains (summary of theEvent) then
--Gets the current day and the cycle day number
set cycleday to summary of theEvent
set cycleDate to (start date of theEvent) + 1 * hours
set cycleNumber to last character of cycleday as integer
--There are always 6 periods in every day
repeat with periodNumber from 1 to 6
--Gets the subject from periodCycle
set theSummary2 to item periodNumber of item cycleNumber of periodcycle2
set theSummary to item periodNumber of item cycleNumber of periodCycle
--Checks to see if there's a subject for this period, if not skips to next one
if theSummary2 is not "" then
set theStart to date (startTime of item periodNumber of periodTimes) of cycleDate
set theEnd to date (endTime of item periodNumber of periodTimes) of cycleDate
--Makes the event in the calender whose name is defined at the top of the script
make new event at end of calendar TargetCalendar with properties {summary:theSummary, start date:theStart, end date:theEnd}
end if
end repeat
end if
end repeat
end tell </pre>Did it run faster in the past?
The events are happening as your script is generating them - for example, you get the event summary to compare in an if statement, then get it again when you assign it to a variable. The Script Editor's *Event Log* is handy in this case to see when you are creating a lot of extraneous or duplicate events.
Also, when using application tell statements, you should only target the application's terminology, since it will just pass back what it doesn't know how to do - in other words, try not to put anything in the statement except what you need from the application.
I don't have your iCal calendar events to play with, but a couple of tweaks to your code should improve the performance:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into the Script Editor">
---------This is where you gather / set user data
display dialog "How many courses do you teach?" default answer ""
set courses to the text returned of the result as number
set slotA to ""
set slotB to ""
set slotC to ""
set slotD to ""
set slotE to ""
set slotF to ""
set slotG to ""
set slotH to ""
repeat with x from 1 to courses
set entered to text returned of (display dialog "Please enter the slot (A-H) and the course name, separating them with a comma:" default answer "")
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ","
set {chosenslot, chosencourse} to {(entered's text item 1), (entered's text item 2)}
if chosenslot is "A" then
set slotA to chosencourse
end if
if chosenslot is "B" then
set slotB to chosencourse
end if
if chosenslot is "C" then
set slotC to chosencourse
end if
if chosenslot is "D" then
set slotD to chosencourse
end if
if chosenslot is "E" then
set slotE to chosencourse
end if
if chosenslot is "F" then
set slotF to chosencourse
end if
if chosenslot is "G" then
set slotG to chosencourse
end if
if chosenslot is "H" then
set slotH to chosencourse
end if
end repeat
set TargetCalendar to "Classes2"
--Predefined period times
set periodTimes to {{startTime:"08:30 AM", endTime:"09:25 AM"}, {startTime:"09:30 AM", endTime:"10:25 AM"}, {startTime:"10:30 AM", endTime:"11:25 AM"}, {startTime:"11:30 AM", endTime:"12:25 PM"}, {startTime:"12:30 PM", endTime:"01:25 PM"}, {startTime:"01:30 PM", endTime:"02:25 PM"}}
set Day1pattern to {slotA, slotB, slotC, slotD, slotE, slotF}
set Day2pattern to {slotG, slotH, slotA, slotD, slotE, slotB}
set Day3pattern to {slotF, slotC, slotG, slotD, slotE, slotH}
set Day4pattern to {slotB, slotA, slotF, slotD, slotE, slotC}
set Day5pattern to {slotH, slotG, slotB, slotD, slotE, slotA}
set Day6pattern to {slotC, slotF, slotH, slotD, slotE, slotG}
--Predefined period cycles
set Day1 to {slotA & " period 1", slotB & " period 2", slotC & " period 3", slotD & " period 4", slotE & " period 5", slotF & " Period 6 "}
set Day2 to {slotG & " period 1", slotH & " period 2", slotA & " period 3", slotD & " period 4", slotE & " period 5", slotB & " period 6"}
set Day3 to {slotF & " period 1", slotC & " period 2", slotG & " period 3", slotD & " period 4", slotE & " period 5", slotH & " period 6"}
set Day4 to {slotB & " period 1", slotA & " period 2", slotF & " period 3", slotD & " period 4", slotE & " period 5", slotC & " period 6"}
set Day5 to {slotH & " period 1", slotG & " period 2", slotB & " period 3", slotD & " period 4", slotE & " period 5", slotA & " period 6"}
set Day6 to {slotC & " period 1", slotF & " period 2", slotH & " period 3", slotD & " period 4", slotE & " period 5", slotG & " period 6"}
--Makes a "list of lists" so that all the period definitions are in one place
set periodCycle to {Day1, Day2, Day3, Day4, Day5, Day6}
set periodcycle2 to {Day1pattern, Day2pattern, Day3pattern, Day4pattern, Day5pattern, Day6pattern}
set isitacycleday to {"Day 1", "Day 2", "Day 3", "Day 4", "Day 5", "Day 6"}
--This repeat loop is using the cycle day definitions in the calendar named "School Calendar "A.Y.""
tell application "iCal" to repeat with theEvent in (get events of calendar "School Calendar 09-10") --> only target iCal for what it knows
set cycleday to summary of theEvent --> might as well set the info
if cycleday is in isitacycleday then
--Gets the current day and the cycle day number
set cycleDate to (start date of theEvent) + 1 * hours
set cycleNumber to last character of cycleday as integer
--There are always 6 periods in every day
repeat with periodNumber from 1 to 6
--Checks to see if there's a subject for this period, if not skips to next one
if (item periodNumber of item cycleNumber of periodcycle2) is not "" then --> skip as much as possible
--Gets the subject from periodCycle
set theSummary to item periodNumber of item cycleNumber of periodCycle
set theStart to date (startTime of item periodNumber of periodTimes) of cycleDate
set theEnd to date (endTime of item periodNumber of periodTimes) of cycleDate
--Makes the event in the calender whose name is defined at the top of the script
make new event at end of calendar TargetCalendar with properties {summary:theSummary, start date:theStart, end date:theEnd}
end if
end repeat
end if
end repeat
</pre> -
Trouble with a script that deletes event in iCal
Used this script over the summer and it worked fine. Can't figure out the issue now, but it isn't working. Here is a few lines of the output I get and then the error I get is at the bottom. I'll post the full script at the bottom of this posting. Error # -1728??? File doesn;t exist?
Thanks,
dan
get summary of item 2 of every event of calendar "Untitled"
--> "Enviro C Lab Period 3-4"
get summary of item 2 of every event of calendar "Untitled"
--> "Enviro C Lab Period 3-4"
get description of item 2 of every event of calendar "Untitled"
--> missing value
get status of item 2 of every event of calendar "Untitled"
--> none
get start date of item 2 of every event of calendar "Untitled"
--> date "Tuesday, April 26, 2011 10:30:00 AM"
get summary of item 2 of every event of calendar "Untitled"
--> "Enviro C Lab Period 3-4"
get end date of item 2 of every event of calendar "Untitled"
--> date "Tuesday, April 26, 2011 11:55:00 AM"
get allday event of item 2 of every event of calendar "Untitled"
--> false
make new event at end of every event of calendar "Untitled" with properties {status:none, start date:date "Tuesday, April 26, 2011 10:30:00 AM", summary:"Enviro C Lab Period 3-4", end date:date "Tuesday, April 26, 2011 12:25:00 PM", allday event:false}
--> event id "AF27EFB6-3949-4977-A153-1EFE31FD8206" of calendar id "0EDA6DFD-52AD-4E7F-BC81-984CFF7D3F39"
delete item 2 of every event of calendar "Untitled"
--> error number -1728 from item 2 of every event of calendar "Untitled"
Result:
error "iCal got an error: Can’t get item 2 of every event of calendar \"Untitled\"." number -1728 from item 2 of every event of calendar "Untitled"
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;"
title="this text can be pasted into a HTML editor">
tell application "iCal"
repeat with theEvent in (events of calendar "Untitled")
set control to {}
set control to summary of theEvent
set AppleScript's text item delimiters to space
set theSummary to summary of theEvent
set textSummary to text items of theSummary
if the third item of textSummary is "Lab" then
if the fifth item of textSummary is "5-6" then
get theEvent
set theDescription to description of theEvent
set theStatus to status of theEvent
set theStartDate to (start date of theEvent) - 0.5 * hours
set theSummary to summary of theEvent
set theEndDate to end date of theEvent
set theAllDay to allday event of theEvent
set newEvent to (make new event at end of events of calendar "Untitled" with properties {status:theStatus, start date:theStartDate, summary:theSummary, end date:theEndDate, allday event:theAllDay})
set oldEvent to ""
set theEvent to oldEvent
get theEvent
delete theEvent
end if
if the fifth item of textSummary is "3-4" then
get theEvent
set theDescription to description of theEvent
set theStatus to status of theEvent
set theStartDate to start date of theEvent
set theSummary to summary of theEvent
set theEndDate to (end date of theEvent) + 0.5 * hours
set theAllDay to allday event of theEvent
set newEvent to (make new event at end of events of calendar "Untitled" with properties {status:theStatus, start date:theStartDate, summary:theSummary, end date:theEndDate, allday event:theAllDay})
delete theEvent
end if
end if
end repeat
end tell
</pre>Hello
The posted event log indicates some inconsistent behaviour of iCal in referencing item 2 of every event. I.e., it could access it first and failed to do so after a new event is created. Scent of bug here. Or possibly inserting ugly small delay after event creation might let the script delete the newly created event...
Anyway, the 'by index' reference form of object must be used very carefully when object can be deleted or added dynamically.
Also I wish to add that it is not recommended to use an object specifier, that returns list of objects, as the base list for repeat statement, such as :
--CODE1
-- # not recommended
repeat with theEvent of (events of calendar "Untitled")
-- omitted
end repeat
--END OF CODE1
Instead, you'd better get the list first and use it, such as :
--CODE2
-- # recommended
repeat with theEvent of (get events of calendar "Untitled")
-- omitted
end repeat
--END OF CODE2
The reason is as follows.
In CODE1, the iterator is assigned as item k of events of calendar "Untitled", where k iterates from 1 to count of events of calendar "Untitled" at the time of loop entrance. The problem is that this list of events is dynamic list which may change when event is deleted or added, and consequently item k as iterator may no longer refer to the item k of the original collection of events.
In CODE2, the iterator is assigned as item k of a static list which is obtained by statement 'get events of calendar "Untitled" at the time of loop entrance. If the event object is returned in 'by ID' reference form (or any form other than that depends upon index in the container), item k as iterator is guaranteed to refer to the item k of the original collection of events whether or not collection changes.
Thus you may try something like this :
--SCRIPT
(* not tested *)
tell application "iCal"
tell calendar "Untitled"
repeat with theEvent in (get its events) -- # get the objects list
set theEvent to theEvent's contents -- # dereference each once
set AppleScript's text item delimiters to {space}
set textSummary to text items of summary of theEvent
set AppleScript's text item delimiters to {""} -- # reset astid
if item 3 of textSummary is "Lab" then
if item 5 of textSummary is "5-6" then
tell theEvent
set prop to {¬
start date:(its start date) - 0.5 * hours, ¬
end date:its end date, ¬
status:its status, ¬
summary:its summary, ¬
allday event:its allday event}
end tell
make new event at end of events with properties prop
delete theEvent
end if
if item 5 of textSummary is "3-4" then
tell theEvent
set prop to {¬
start date:its start date, ¬
end date:(its end date) + 0.5 * hours, ¬
status:its status, ¬
summary:its summary, ¬
allday event:its allday event}
end tell
make new event at end of events with properties prop
delete theEvent
end if
end if
end repeat
end tell
end tell
--END OF SCRIPT
Hope this may help,
H
Maybe you are looking for
-
How can i redirect to another JSP page automatically after some event
I am developing a Tic-Tac-Toe game which can be played between two players who are on two different machines. When the first player comes to the Welcome page he will redirected to a Waiting Page when he clicks on the 'Start' button. When the second p
-
S_ALR_87012178/Customer Open Item Analysis by Balance of Overdue Items/
I would like to modify the 'Dynamic selections' (Shift + F4) list on the selection screen. Where are the selections coming from? How to change the list? I should add one selection more to 'Documents'-selections.
-
Cannot download folio in adobe content viewer - urgent help please
Hello, my folio won't download in my Adobe content viewer ("cannot connect to server") and I would have needed it for a presentation at the client - the client also wanted to download the folio on his device but the same error came up. I tried it the
-
hi all i wnt to know what is mean by tds certificate. I came to know a tds cetificate is generated for every invoice to be payed am i correct ? and these tds certificate details are stored in following tables jai_ap_tds_payments jai_ap_tds_f16_dtls_v
-
Why is Distiller crashing?
I am using Mac OZ 10.4.10. I've got Adobe Acrobat 7.0 Professional running and have Adobe Distiller 7.0 installed. However Distiller always crashes on startup. I have tried re-installing it but to no avail. Other people here can use Distiller without