Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Enable T610 phones to show all-day iCal events Apps

We all (well, most of us, I think) are of the opinion that the iCal - iSync - mobile phone syncing is a great addition. Well, I found out that sadly enough, all-day events where not correctly synchronized to my T610; they are just left out. This renders the organiser in the T610 pretty useless.

So I created an AppleScript which automatically creates a series of normal events from 1 to 4 am out of an all-day event which can span several days. These events are all put in a separate calendar, which can be turned off in iCal, but is nevertheless then synced to the phone, showing all the dates. It is pretty complicated because AppleScript actually does not give you any information on the end date of an all-day-event; I had to get that information directly from the .ics file. Therefore, your calendar name should not have any spaces in it, or just the first day of the recurring event will be parsed.

There's a note on VersionTracker's iSync page discussing this issue, and it includes an email address where you can send feedback requesting better support for all-day events.

Read the rest of the hint for the script...

[robg adds: I have checked that the script syntax checks properly in AppleScript, but I have not tested it.]

property AlldayCalendarName : "All-Day Events"
property monthlist : ¬
  {January, February, March, April, May, June, July, August, September, October, November, December}
property theweeks : 4

tell application "iCal"
  
  --find the Allday Events calendar
  set theNum to 0
  set Calendartitles to {}
  repeat with i from 1 to count of calendars
    if title of item i of calendars is AlldayCalendarName then set theNum to 1
    copy title of item i of calendars to end of Calendartitles
  end repeat
  
  if theNum is 0 then
    --create the calendar and rescan the calendar titles
    create calendar with name AlldayCalendarName
  end if
  
  --identify the AlldayCalendar
  set i to 1
  repeat with theItem in calendars
    if the title of the item i of calendars is equal to AlldayCalendarName then
      set theNum to i
      exit repeat
    end if
    set i to i + 1
  end repeat
  set AlldayCalendar to item theNum of calendars
  --delete all old events in here
  delete every event in AlldayCalendar
  
  --now scan every calendar for all-day events and make an identical copy
  --in the AlldayCalendar, only as normal event from 1:00 to 4:00 am
  repeat with theCal in calendars
    
    if title of theCal is not AlldayCalendarName then
      repeat with theEvent in events of theCal
        --only look x weeks back
        if theEvent is allday event and the (start date of theEvent) >  ¬
        ((current date) - (theweeks * weeks)) then
          set theSummary to summary of theEvent
          set theuid to the uid of theEvent
          set thestartdate to the start date of theEvent
          try
            set theendstring to do shell script "cat ~/Library/Calendars/" &  ¬
            title of theCal & ".ics | grep -iA 6 " & theuid & " | grep DTEND"
          on error
            set theendstring to ""
          end try
          if theendstring = "" then
            set theenddate to thestartdate
          else
            set theenddate to current date
            set time of theenddate to 0
            set year of theenddate to text 18 thru 21 of theendstring as integer
            set monthnumber to text 22 thru 23 of theendstring as integer
            set month of theenddate to item monthnumber in monthlist
            set day of theenddate to text 24 thru 25 of theendstring as integer
            set theenddate to theenddate - days
          end if
          --the next is the enddate of the ical record
          set theendtime to thestartdate
          --set the time from 1 to 4 in the morning
          set the time of thestartdate to 60 * 60 * 1
          set the time of theendtime to 60 * 60 * 4
          --set the time of the last date to 5 to avoid an early stop of the repeat loop
          set the time of theenddate to 60 * 60 * 5
          --repeat adding an event for all the days
          repeat until thestartdate > theenddate
            make new event at end of events of AlldayCalendar ¬
              with properties {start date:thestartdate, summary:theSummary, end date:theendtime}
            set thestartdate to thestartdate + days
            set theendtime to theendtime + days
          end repeat
        end if
      end repeat
    end if
  end repeat
end tell
Improvements welcomed!
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[14,505 views]  

Enable T610 phones to show all-day iCal events | 12 comments | Create New Account
Click here to return to the 'Enable T610 phones to show all-day iCal events' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Enable T610 phones to show all-day iCal events
Authored by: irs-away on Nov 22, '03 04:03:21PM

I'm trying to get this to work with calendars I download from Apple's iCal Calendars. Specifically US Holidays. It loads a US Holidays.icl file in my Calendars folder. How do I edit this script so that it changes that? I'm new to this and I've played aroudn with it, but what I do doesn't seem to be working.



[ Reply to This | # ]
iCal and the T616
Authored by: jcpenney on Dec 08, '03 09:23:17PM

I just bought the T616 (At&T's T610) and I have gotten it to work perfectly with my contacts. iSync even syncs up the calendars, but the time for each event is always wrong. In one of my tests, the day was even wrong. What am I doing wrong or is this a known bug? If so, how do I fix it? I plan on using your script for my all day events, but I first want to fix this major issue....



[ Reply to This | # ]
iCal and the T616
Authored by: lsutiger on Dec 08, '03 09:50:22PM

Check the time zone settings in the phone. Mine was doing the same thing.

Still can't get it to display all day events though.



[ Reply to This | # ]
iCal and the T616
Authored by: thoughtcube on Jan 09, '04 01:46:47PM

The issue isn't with the sync'ing. It's actually a timezone issue. On your phone (I have a t610 so this might be slightly different), you can make the change easily:

Settings -> Time and Date -> Advanced -> Time Zone

Then select your proper time zone. Central Time is GMT-6.00H for reference.

Then make sure that you have the correct Daylight Savings Time setting and voila! It should show up in the proper place.



[ Reply to This | # ]
Enable T610 phones to show all-day iCal events
Authored by: dr.kaos on Jan 08, '04 06:27:24PM

Script doesn't work quite right for me....

All Day Events get created in the new calendar, but they are created one day earlier than the original event AND only the first day of a multi-day event is created (even though all of my calendars have single word names -- no spaces).

I believe the problem lies in the format of the events in the ICS files, as muti-day events do not have DTEND fields in iCal 1.5.1, only a DURATION field, which the script does not account for.

I tried hacking my way through a fix, but I don't speak AppleScript, nor do I fully understand its interaction with iCal (syntax). Anybody crreate an updated version of this script? If so, I'd love to make this work. As it stands, I'm having to go through and manually convert all of my All Day Events...

Cheers



[ Reply to This | # ]
Enable T610 phones to show all-day iCal events
Authored by: teejot on Jan 22, '04 03:40:34AM
Hi, I don't know why (maybe because iCal 1.5.2 changed the fileformat) but I had to change the 'grep' command to:

grep -i -A 3 -B 4

With this change the script runs very well.

torben

[ Reply to This | # ]

Enable T610 phones to show all-day iCal events
Authored by: justinmj on Jan 25, '04 04:50:50PM

My iCal (and T610) show these events on the previous day. Any idea how to fix it? This happened after I ran the script, right in iCal, all the created events showed up the day before the actual all-day event. Then, when I iSynced to the phone, the same things occured.

PLEASE help, anyone!

Thanks,
Justin



[ Reply to This | # ]
Enable T610 phones to show all-day iCal events
Authored by: dilznik on Mar 30, '04 05:09:30PM

I don't know if anyone else had this issue, but multi-day entries absolutely freaked out. I now have the longest fencing tournament in the history of the sport!
Anyone know what to change in the Applescript to fix this?

---
The only time Microsoft would make something that doesn't suck is if they made a vacuum cleaner.



[ Reply to This | # ]
Enable T610 phones to show all-day iCal events
Authored by: lachdrache on Apr 05, '04 09:25:52AM

iCal 1.5.2 provides the end date of an all-day event via AppleScript. But the start date and the end date are in GMT not in the local time zone.

For non-all-day events the start date and the end date are in the local time zone.



[ Reply to This | # ]
Enable T610 phones to show all-day iCal events
Authored by: cane on Apr 22, '04 05:59:01PM
if the UID of an event contains a space, the script wont generate events for every day -- only for the first day. the following should fix that
set theendstring to do shell script "cat ~/Library/Calendars/" & ¬
title of theCal & ".ics | grep -i -A 3 -B 4  '" & theuid & "' | grep DTEND"
(the idea of changing the grep otions goes to that guy before, my change was to include single quotes around the UID. -- it should now read
single quote - double quote - ampersand - theuid - amp - dbl qt - sgl qt
)

[ Reply to This | # ]
Enable T610 phones to show all-day iCal events
Authored by: cjmilne on Jul 15, '04 01:52:12PM

For whatever reason All-Day Fixer was dropping the new entries into 12PM the day before the event. I applied the above fix (literally just replaced the text in the original script with the line found above) and then started screwing with the multipliers in the time portion of the script. It appears as if the script is ignoring thestartdate & only using theenddate for me so I changed the multiplier from 12 to 24 & the entries now come up at 12AM on the correct day. This may be an artifact of using 24 hr notation or perhaps iCal's ics format has changed again. This is 10.3 with iCal 1.5.2 (v637).

Chris



[ Reply to This | # ]
Enable T610 phones to show all-day iCal events
Authored by: lachdrache on Nov 09, '04 10:00:00AM

With iSync 1.5 Apple added support for allday events for some Sony Ericsson and Siemens mobile phones.

From iSync Help | What's new:
With iSync 1.5 you can synchronize your calendar and contact information on a variety of new mobile phones. You can also sync all-day events (as read-only events) on all Sony Ericsson and some Siemens mobile phones.

It works for my Siemens S55. In iSync there is a new button "Options..." available at the bottom where one can enable "Sync all-day events".



[ Reply to This | # ]