Applescript with iCal

Hi All,
I'm trying to write an applescript to dump those events from a calendar that lie between today and a future date I specify. For each event, on a single line I want two tab separated values - the date and the event summary.
Here's what I came up with -
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into the Script Editor">
#!/usr/bin/osascript
on run argv
set so to ""
tell application "iCal"
set endDate to (AppleScript's date (item 2 of argv))
set curDate to (current date)
set curDate to curDate - (time of curDate)
repeat with e in (every event in calendar (item 1 of argv) ¬
whose (start date) is greater than or equal to curDate ¬
and (start date) is less than or equal to endDate)
if so is not "" then set so to so & "\n"
set so to so & (short date string of AppleScript's date (start date of e)) & "\t" & (summary of e)
end repeat
end tell
end run
</pre>
This works as long as I do not use "short date string of AppleScript's date". However when I try to get the short date string i get this error -
<pre>
[puneet@bluestreak scripts]$ ./iCalEvents.AppleScript personal 4/3
./iCalEvents.AppleScript:444:461: execution error: Can’t make short date string of date (date "Saturday, March 28, 2009 12:00:00 AM") into type Unicode text. (-1700)
</pre>
Can someone point out what am I doing wrong ? (I know AppleScript only since yesterday :P)
thanks in advance,
regards,
Puneet

I'm just guessing, but I'll say that you're being too verbose.
set so to so & (short date string of AppleScript's date (start date of e)) & "\t" & (summary of e)
(start date of e) is already a date object, so there's no need to coerce it to another date object, and there's certainly no need to coerce it to "AppleScript's date".
So I'd suggest:
set so to so & (short date string of (start date of e)) & "\t" & (summary of e)

Similar Messages

  • Using applescript with iCal

    I have been using an applescript to create a unique combo of new events over the course of a school year for multiple people. I run the script to make a new events in an untitled calendar, export the calendar and then create a new untitled calendar and run it again. 60 or so different times, all with unique combos. I've posted this question to the Applescript forum with no replies, and thought I'd try here. My issue is that when iCal starts to make new events it begins at somewhat arbitrary dates, cycles through the whole year correctly, but jumps around in such a way that it seems to really bog the script down. Now maybe it is a script issue, although this script has worked correctly in the past. Maybe it is a permissions/cache issue (I've run Onyx and it helps with the speed). Currently it is starting to make new events on the 26th of Oct when the year foes from sept 7,2010 to June 7 2011. I'm convinced that I can get that 26th of Oct to change by trashing the cache or something (I'll work on that), a simple restart does not influence it. The script in the end does work, so maybe I'm troubleshooting something that is minor, but I'd love to know the answer! Thanks for the help.
    dan

    So I ran the automation tab of Onyx to repair permissions, execute maintenance scripts, clean the cache... and now when the applescript runs it makes the first new event on a different date than Oct 26...(don't quite remember right now what it is). The question is what is controlling this...??? ARGH
    dan

  • How to start from scratch with iCal (getting rid of duplicate iCal events)

    For reasons I can't figure out, all my iCal events are duplicated 6 times in iCal. None of these events can be deleted (either by hitting the Delete key or via the Edit menu).
    I tried using an AppleScript for this purpose (http://www.johnmaisey.pwp.blueyonder.co.uk/applescripts/ ) but it doesn't work, at least on my 10.5.1 Mac.
    I'm pretty sure I'm going to switch over to Daylite, for both my Calendar and Address Book functions, but until then, it'd be nice to start fresh with iCal, since I'm also trying out a .mac account for the first time, and it might be handy to have a clean calendar backup.
    Is there a method for just starting fresh with iCal?

    see this thread that may help you with duplicate events: http://discussions.apple.com/thread.jspa?threadID=1192813&tstart=0
    hope this helps

  • Applescript and iCal

    Hi,
    I'm new to Applescript and have a litte problem with iCal. In my script I want to get a list of all summaries of a iCal calendar. But for some reasons I want to set all events to a variable first and get the summary of all events from this variable (and not directly from iCal). I tried it in this way:
    tell application "Calendar"
              set sumList to summary of events of calendar "Sync"   -- works fine, result is a list of all summaries
              set calList to events of calendar "Sync"                         -- works fine, result is a list of claendar events
              set sumList1 to get summary of every item of calList -- doesn't work (error 1728)
    end tell
    Any ideas why the 3rd line doesn't work?

    You can get more than one property at a time (in the same loop).  For example, the following, will give you a list of lists (with a sublist for each event which contains the summary, start date, end date, uid).  However, if you explain what you are trying to do, there may be a better way.
    tell application "Calendar"
              set calList to events of calendar "XX"
              set propList to {}
              repeat with calEvent in calList
          copy {summary, start date, end date, uid} of calEvent to end of propList
      end repeat
    end tell
    propList

  • Outlook 2011 no longer syncing with iCal and contacts

    I have installed Yosemite recently on my Macbook Pro. I run MS Outlook 2011 for professional reasons. Until now, syncing with my Android phone worked (almost) fine, using a nice app called SyncMate. For a few days now (not sure it is linked to installing Yosemite though) new data on my outlook calendar and address book no longer appear on my phone after syncing. After checking I realized that Outlook is actually not syncing any more with iCal and Contacts, so of course the syncing with the phone cannot work. How can I resolve this ?

    facing the same problem, it was syncing prior to my upgrade to Lion. have you managed to find a solution?

  • Creating a folder on my HD with /current/ date and time with iCal

    hi all.
    new user here trying to tighten things up over here.
    can anyone advise me as to whether there is a way to do this with iCal? i'd like to have a folder like this so i can see it easily on my various external backup drives and basically know very quickly how recent the update is that i am looking at.
    also, is there a lot more to iCal than simply keeping my calendars updated and synce and possibly posted to the web or shared with others or whatever? i am loving the sync ability and the sonorous alerts but i am wondering if i can/need to read up on additional functionalities in iCal that keep me organized.
    TIA

    It's not clear what tool you are using to automate the process.
    At least one of the 3rd-party Crystal Reports Desktop Scheduling tools listed at: http://www.kenhamady.com/bookmarks.html provides that functionality.  It allows you to use Crystal Reports fields or formulas to dynamically set the export file path and name.

  • I want to cut and paste iCal entries on iPad.  Have seen a number of questions raised but no definitive answer - is it possible or not?  (I use Bento but that doesn't sync with ICal now so can use that solution)

    I want to cut and paste iCal entries on iPad.  Have seen a number of questions raised but no definitive answer - is it possible or not? 
    (I use Bento but that doesn't sync with ICal now so can use that solution)
    Hope to hear helpful news soon....
    C

    No, the camera connection kit only supports the copying of photos and videos to the Photos app, it doesn't support copying content off the iPad. For your second camera instead of the SD reader part of the kit, does the iPad to camera cable not work with it for direct transfer to the iPad ?
    For Lightroom and Nikon software again no - you can only install apps that are available in the iTunes app store on your computer and the App Store app on the iPad, 'normal' PC and Mac (OS X) software are not compatible with the iPad (iOS). There are some apps that perform fairly basic editing functions that are available in the store, but nothing as sophisticated as, for example, Lightroom.

  • IPhone Calendar Entries No Longer Sync With iCal or MobileMe Account

    I've been experiencing this for a few months now, and was hoping someone might have some ideas on how to fix this issue I am having.
    Every time I enter a new entry onto my Calendar from my iPhone... those entries do not show up on either my Desktop iCal or Mobile Me account online (this used to work). However... if I enter a new entry on either my desktop or Mobile Me account... those entries do show up on my iPhone.
    I do not sync my Contacts or Calendars using iTunes. That is turned off. I sync through MobileMe.
    Any help would be appreciated.

    On your iPhone, go to Settings > Mail, Contacts, Calendars.
    Select your MobileMe account.
    Turn Calendars off for over the air syncing. A warning message will be provided indicating your MobileMe online calendars and calendar events will be deleted from your iPhone with an option to keep the calendars on your iPhone or delete from your iPhone. Select Delete from My iPhone.
    Follow this by turning Calendars back on for over the air syncing.
    Enter a new calendar event on your iPhone to test if the new calendar event shows up with your MobileMe online calendar and with iCal on your Mac.

  • Can I view my exchange server appointments with ical / mobile me?

    Apologies if this is a rookie question....
    I have a work exchange account set up on my iphone 4 (they won't let me connect my mac to the exchange server) and would like to sync my exchange calendar with ical or mobile me. Can this be done without hooking a mail client on my mac?

    bump

  • What's a good calendar service to use with iCal on iPhone and mac?

    Sometime around iOS 7 and Mavericks updates, my Google calendar stopped playing nice with iCal on my phone. I'm wondering what other people are doing.
    I don't know whether it was Google or Apple that caused the issue, and I'm not too fussed either way, I just want to have something that works again.
    What does 'not playing nice' mean?
    I used to be able to create an appointment, add my wife as an invitee, and it would appear in her iCal.
    Now, it appears in her email, but not calendar. Clicking "yes" on the email loads safari instead of iCal. Then there's this whole log in thing. It's annoying.
    What I'd like
    Three things:
    1. I'd like my wife and I to each have a personal calendar. She should have read/write access to her calendar, and read-only to mine (and vice versa).
    2. I'd like a share calendar that we can both see and write to. We used this for family events.
    3. I'd like to be able to invite my wife to an event, and have that invite appear in iCal both on her phone and her mac.
    Everything should of course work well with iCal.
    I don't care if it works with Google services, although if there's a way to fix my google calendar so that it works right, I'm open to that.

    Unless you want a new computer, forget about AVCHD. It requires too much muscle to edit comfortably on anything but the fastest computer.
    What camera is nice, depends on your budget. Formats that are easy to edit are HDV, DVCProHD (P2) and XDCAM. In the consumer range you could look at the Canon HV40 or XH-A1s, in the prosumer range look at the Panasonic AG-HPX170, Canon XH-H1s, JVC GY-ND250 or Sony HVR Z5 or Z7 and all Sony XDCAM cameras, especially the EX1 and EX3. In the professional range look at the Sony PDW-F355 or upward.

  • IPhone Calendar not syncing correctly with iCal since Lion-install

    Since installing Lion, the calendar on my iPhone is not syncing correctly:
    Events created on my iPhone don't show on my Mac
    Events edited on my iPhone don't change on my Mac
    Events that I created in iCal on my Mac, for test-purposes, and then deleted immediately, show up on the iPhone when syncing.
    Syncing through iTunes (not MobileMe).
    Using WeekCal on my iPone, but it seems that the same is the case with the "original" calendar-app.
    No similar experience prior to Lion-install.
    iPhone is iOS 4.3.4 -up to date
    Any ideas? Does anybody know how to reset the sync, for instance?

    Hi, my name is Lucas, i'm an Apple Certified Technitian.
    Last couple of weeks i've installed OSX Lion in a few Macs.
    But one of them drove me crazy!
    I have a Late 2007 White Macbook and i installed OSX Lion last week. I also have an iPhone 4 (Factory Unlocked) that i also updated to IOS 4.3.5 ... no problems syncing between them
    Then i did the same with a 13'' Unibody MacBook Pro and an iPhone 4 (not unlocked)... no problems neither
    Yesterday i installed Lion on a Mid2010 15" MacBook Pro and updated another iPhone 4 (Factory Unlocked) to IOS 4.3.5 and when i tried to sync the iphone with iTunes 10.4 nothing happened.
    I mean, nothing.. the iTunes started syncing and when it gets to sync the calendars it stayied there forever.
    I left it for hours and nothing.
    As i said i'm an ACT so i tried everything.
    1- Remove Calendars from iPhone and syncing again
    1- Repair Permittions
    2- Reinstall iTunes
    3- Reset iTunes and iCal Preferences and Caches
    4- Backup iCal - erase ical content and generate a new iCal database
    5- Reset Syncing Prefs and logs
    6- Use DiskWarrior from an external OSX
    7- Reset PRAM
    Nothing worked.
    I thought it could be some conflict with Microsoft Outlook and/or Exchange server since this Mac is the only one of the three macs i installed that uses Outlook Sync and Exchange server and it's the only one that gave me trouble.
    But disableing it didn't worked neither.
    THE SOLUTION
    I Already solved this thing out. But i still don't understand the logic of all this... anyway, what y did is this:
    1- turn off microsoft outlook sync with iCal (from outlook preferences)
    2- Backed up iCals (Just in case)
    3- Create a new Calendar Category (by default you have Work and Home... i created one called Test)
    4- i Created a new task at that calendar
    5- In iTunes uncheck the "Sync iCal" box and sync the iPhone
    6- Check th "Sync iCal" box, then check the "sync the selected calendars" box
    7- Check the "Test" calendar and sync the iPhone.
    This worked so i started creating task in this Test Calendar both in iphone and mac, just to test it, Worked fine.
    Then i selected all the other calendars (Home - Work - etc) and i turned on the outlook sync
    Then i synced the iPhone and Voilà everything is working again.
    Now i can create task in outlook calendar and when y sync the iphone it appears on it.
    I don't know what the problem is... but this looks like the solution
    HOpe it works for you!

  • Bug(?) with iCal - Can not change the event time

    Hello all,
    First of all, let me preface my question by admitting that I'm new to the Mac world, transitioning from MS environment. So please, be a bit patient
    Now, on to my problem:
    I have created events in iCal and I can not change the time for any event. The time that's always displayed is 15:54! I have checked the time zone setting to on/off to se if it makes a difference, but to no avail. I have also gone into preferences and under the General Tab, the Day starts at and the Day ends at: show three (3) selections; Noon, 15:54, Midnight !!???
    I have changed the Show hours at a time, to see if that makes a difference, but it does not.
    To add to the above mystery, I have created events with my mobile SonyEricsson K850i, with the correct time(s), date, etc., synchronized with iCal and the time changed to 15:54!!
    This is a new MacBook Pro, with the latest patches! For some reason the iCal applet does not allow any changes to the time.
    Any suggestions/help will be greatly appreciated.

    Hi
    I am having the exact same problem you discussed and was wondering whether you ever found a solution.
    Cheers,
    Anna

  • TS1627 iCal on my MacBook Pro won't sync with iCal on the iPhone and visa versa

    Just got a new iPhone 5 and now iCal on my MacBook Pro won't sync with iCal on the iPhone and visa versa

    Hi Jetjuice!
    I have an article that can help you troubleshoot this issue a little further and can provide you with some more steps to take in attempting to resolve this issue:
    Sync Services: Advanced troubleshooting for contact and calendar syncing
    http://support.apple.com/kb/ts2481
    That article has an extensive list of steps to perform in attempting to get the calendar to sync again, and those steps should help you resolve the issue. Thanks for using the Apple Support Communities!
    Cheers,
    Braden

  • IPhone calendar will not sync with iCal on Mac

    Calendar entries on my iPhone 4S/iOS 5.1 will not sync with iCal on my MacBook Pro 2.4/10.6.8, but it will the other way around. I have tried:
    Restarting iPhone
    Re-setting sync services (holding down Option key and clicking on Sync icon in menu bar)
    Changing which calendar to sync with (iTunes 10.6.1)
    This may have something to do with having to do a complete Time Machine backup after a Volume Optimisation with Tech Tool Pro rendered my startup disk as un-bootable....???
    I do not use Mobile Me or iCloud (can't with Snow Leopard...) and it is a straight USB connection.
    I consider myself a medium expert, with no programming/Terminal skills whatsoever.
    Any help is appreciated.
    Manolis

    Thanks. There is another thread that shares a solution that involves deleting ical Library cache files and Preference files.  I"ll see if that works.  ICloud shouldn't be a factor in my case since I don't use it and it's "off" in Preferences. I am encouraged that I don't need to use it to fix this issue based on other's experiences, but we'll see!

  • Ical on iphone does not sync with ical on mac, but the mac does it!

    My ical on my iphone does not sync with ical on mac using MobileMe, but reverse it works very well.
    so typing an new event in ical on my phone will NOT appear in ical at my computer. Typing a new event on my mac, than within 10 seconds it appears on my phone.
    anybody know how to resolve this? never had the problem before
    problem 2: ical on my iphone seems to duplicate a lot of events. Non of them are duplicated on my computer.
    related problem?
    thank
    Hein

    I have solved my problem - don't know if yours is the same. I noticed on iPhone, when I listed the calendars there are two sections: the top line showed "All Calendars ->"; when I click on that I get duplicate entries for everything.
    Below that is:
    "From My Mac.
    "All from My Mac ->", followed by a list of individual calendars. When I clicked on that I got single entries.
    This led me to realize that in my Settings ->Accounts I had the old "...mac.com" a/c and new "..me.com" a/c. I had thought it didn't matter.
    Once I eliminated the "mac.com" A/c, I had only one set of calendars.
    Hope this helps you.
    Val J

Maybe you are looking for

  • CRM Web Log on Issue

    i am getting the below error while i am trying to access CRM with http://<host>:8000/sap/bc/bsp/sap/crm_ui_frame/default.htm?sap-client=800&sap-sessioncmd=open It is promting for User name Password and accepting too. Error Message Business Server Pag

  • How to get a Recovery media for Satellite L305D S5900

    I am a Ghanaian who bought a Toshiba laptop about seven months ago. The model is Satellite L305D S5900. I am also in Ghana. I found out from the documents that came with the laptop and your forum that I can order for Recovery media for it with no cha

  • Color setting file malfunction ID CS6

    One option in Color Settings is to check the box for "Missing Profiles". This should alert me, when placing files into a template, that a file is untagged or does not have an embedded profile. However, it does not. Instead, it automatically assigns i

  • Converted YouTube videos no longer work

    I have been converting some YouTube videos for my own offline use for some time to view on my iPod Touch. I use a little program called TubeSock. Since 2.0 software was released for both iPod Touch and the iPhone 3G all of my converted videos no long

  • File access in jsp

    hi i am developing a web appln in jsp which accesses the client machine n access the files and folders in his machine....is this possible or will i have to create a signed applet to access those files