Creating new event in iCal from BBEdit data window.  Calendar number fails.

When I try to create a new event in iCal I am getting the error "The variable theCalendarNumber is not defined." even though theCalendarNumber is supposed to be set in the preceding line. Does this have anything to do with embedding the tell application "iCal" within the tell application "BBEdit 6.5" loop?
Before this error I was getting a NSContainerSpecifierError error. I think that was because I was trying to specify the calendar as a string instead of a number as required by Panther OS.
BBEdit data window follows.........
3/8/2009 Fun Fly CD ?
4/5/2009 Fun Fly CD ?
14/8/2009 Combat
4/25/2009 Club Cleanup Workday
5/2/2009 Electric Extravaganza
5/17/2009 Fun Fly CD ?
6/7/2009 Fun Fly CD ?
7/12/2009 Fun Fly CD ?
7/19/2009 Combat
8/9/2009 Fun Fly CD ?
8/14/2009 Combat
8/22/2009 War Bird
8/29/2009 Club Cleanup Workday
9/5/2009 & 9/6/2009 IMAC
9/13/2009 Fun Fly CD ?
10/4/2009 Fun Fly CD ?
11/9/2009 Fun Fly CD ?
11/14/2009 Combat
12/13/2009 Combat
Applescript follows.......
set theCals to {}
set iCalendars to {}
set theDate to current date
set myDate to date string of theDate
tell application "iCal"
set theCals to calendars whose writable is true
repeat with i from 1 to count of theCals
copy title of item i of theCals to end of iCalendars
end repeat
end tell
set theChoice to (choose from list iCalendars with prompt "Choose the Calendar to use" OK button name "Choose" without multiple selections allowed and empty selection allowed)
tell application "BBEdit 6.5"
repeat with i from 1 to count of lines in text window 1
set the_line to contents of line of text window 1
set old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to tab
set the_Date to text item 1 of the_line
set the_Event to text item 2 of the_line
tell application "iCal"
set theCalendarNumber to (first calendar whose title is theChoice)
set theEvent to make new event at end of events of theCalendarNumber with properties {start date:the_Date, summary:"", description:the_Event}
--if alarmTime is not 0 then
--tell MyEvent
--make new display alarm at end of display alarms with properties {trigger interval:alarmTime}
--end tell
--end if
--show theEvent
save
end tell
set AppleScript's text item delimiters to old_delims
end repeat
end tell
tell application "iCal"
reload calendars
end tell

You have a couple of issues here.
First, the line:
set theCalendarNumber to (first calendar whose title is theChoice)
However, theChoice is defined at:
set theChoice to (choose from list iCalendars with prompt "Choose the Calendar to use" OK button name "Choose" without multiple selections allowed and empty selection allowed)
Since you're allowing multiple selections, theChoice will be a list.
You can't get 'first calendar whose title is' a list. You will need to either permit single selections only, or extract the calendar name from the selected items (maybe iterating through them if you want to add the event to multiple calendars).
Once you address that, the line:
set theEvent to make new event at end of events of theCalendarNumber...
also won't work because theCalendarNumber will be the name of a calendar, so this command tries to set the event to the end of events of a string. Instead you need to ask for the named calendar, like:
set theEvent to make new event at end of events of calendar theCalendarNumber
Then you should be set.

Similar Messages

  • Unable to create new events in iCal

    I updated my iPhone 4 to iOS7, and now when I try to create a new event in iCal, nothing happens. I am able to tap the "+" and enter the event information, but when I tap "Done", no new event appears in the calendar.
    If I, instead, create the event in the Calendar on my PC, the phone syncs with Outlook, and the event appears on the phone's iCal app.
    Why am I suddenly unable to create new events on my phone in iOS7, and how can I fix this issue?

    Thanks! I've noticed the phone has been a bit "clunky" since the update too. Did you experience the same thing & did the hard restart help?

  • HT2513 Cannot Create New Events in iCal

    Hello:
    I recently deleted a large number of appointments from my iCal using my MacBook. Now, iCal on the MacBook will not allow me to see new events I want to create, but it will push the new events to my other devices using iCloud. What's going on?

    Hmm....I was able to fix my issues. I'll share it here in the event it can help you.
    While iCal was closed I simply moved to trash the folder "/Users/<my username>/Library/Application Support/iCAl/" I then re-opened iCal and I could then create new or import old ".ics" files, close iCal and re-open with all information being retained. Sweet!

  • I cant create new events in iCal on my Mac or display them

    Since a few days ago after upgrading to Lion when I want to create a new event it
    dosent show up in my calender. All the old events is shown and when I create an
    event for example on my iPhone and sync with iCal on my Mac I can see the
    new event.
    I click in the calender to make a new event, nothing shows up, but when syncing
    with my iPhone I can see the new event without any text because I didnt see the
    small eventbar to type in or make the right time for the event. Can anybody help
    me with this issue?
    Regards,
    Collins from Sweden!

    Called Apple fast track support and problem is resolved. User error, for some reason I had selected the wrong calendar - after selecting the proper calendar on the left sidebar I could create events. Apparently at some time I created a 'todo' mailbox. It had nothing in it and I ended up deleting it so it doesn't get selected again in error.
    Took 15 minutes to connect with an ICAL specialist. Once connected received excellent support.

  • Create new event in iCal that triggers an applescript

    Dear applescripters
    I am trying to write a script that creates an event in applescript that launches an applescript.
    This is the code:
    tell application "iCal"
    tell calendar "Verstuur"
    set theCurrentDate to current date
    set time of theCurrentDate to (time of theCurrentDate) + 60
    set verstuur to make new event at end with properties {start date:theCurrentDate, end date:theCurrentDate + 1 * minutes}
    tell verstuur
    make new open file alarm at end with properties {trigger interval:0, filepath:POSIX path of "file://localhost/Users/jschaafsma/Desktop/Verstuurfilmpje"}
    end tell
    end tell
    end tell
    when iCal tries to trigger the script iCal generates an error that the file Verstuurfilmpje is not found.
    Any ideas what i am doing wrong?
    Thanks
    Jschaafsma

    Well, for one, your file path isn't valid.
    … filepath:POSIX path of "file://localhost/Users/jschaafsma/Desktop/Verstuurfilmpje"}
    First off, POSIX path of takes a Mac-style (i.e. colon-delimited) path or alias and converts it to an POSIX path, so either you need to drop the 'POSIX path of' code, or pass in a Mac-style path.
    Secondly, even if you were to use 'POSIX path of', your path specification is invalid anyway - you haven't passed in a POSIX path you've passed in a file URL, which is different. A POSIX path of that file would look like:
    filepath: "/Users/jschaafsma/Desktop/Verstuurfilmpje"
    So rewrite this line and you should be set.

  • Cannot create new events in iCal - they dissappeaar after quitting

    Hello there,
    I've used iCal for many years with no problem.
    Recently I noticed that events were dissappearing.
    I can add events and use iCal as normal as long as I don't quit the program or restart my computer. I can put the computer to sleep and all my new events are fine, but as soon as I restart or quit and reopen ical all the new events have dissappeared. Bizarrely my old events remain intact and events in the future that I added before the problemn started are also still there.
    I have tried backing up the database before quitting, then reverting to the backup database, but even when i do this there are no new events visable.
    Can anyone offer any help. I feel like i need to reinstall iCal or something.
    Thanks.
    Damien

    Hmm....I was able to fix my issues. I'll share it here in the event it can help you.
    While iCal was closed I simply moved to trash the folder "/Users/<my username>/Library/Application Support/iCAl/" I then re-opened iCal and I could then create new or import old ".ics" files, close iCal and re-open with all information being retained. Sweet!

  • Can,t create new events in ical on Mac book Pro.

    This morning when I try to add a new event a pop up appears "This calendar was created by Mail. You can’t add events to a Mail calendar. Mail calendars only contain to do items created in Mail." Ical worked fine yesterday. I have a mobile me acc and can edit the online calendar but not the one on my laptop.
    Thanks

    Called Apple fast track support and problem is resolved. User error, for some reason I had selected the wrong calendar - after selecting the proper calendar on the left sidebar I could create events. Apparently at some time I created a 'todo' mailbox. It had nothing in it and I ended up deleting it so it doesn't get selected again in error.
    Took 15 minutes to connect with an ICAL specialist. Once connected received excellent support.

  • I can no longer create an event on iCal by double clicking on a time or date, nor can I double click on an existing event! HELP!

    I can no longer create an event on iCal by double clicking on a time or date, nor can I double click on an existing event! HELP!
    The only way I have to create an event is by using the "+" button, which is very limiting!
    I am running the latest version of Mac OS X and all the updates.
    Anyone know how I could get a proper use of my iCal ?
    Thanks

    Hi,
    If you list the steps you have taken to fix this it will help.
    Have you tried using the File > New Event menu item?
    Have you logged the user account out/ restarted the computer?
    Have you tried un-syncing any accounts synced to Calendar?
    Is there some change made to the computer that may have triggered this?
    Best wishes
    John M

  • When I try entering a new event in iCal on my MacBook Air, I get an error message popping up on my screen that says: The request for account "iCloud" failed.  The server responded with "502" to operation CalDAVSetPropertyQueueableOperation. Help!!??

    When I try entering a new event in iCal on my MacBook Air, I get an error message popping up on my screen that says:
    The server responded with “502”
    The request for account “iCloud” failed. 
    The server responded with “502” to operation CalDAVSetPropertyQueueableOperation.
    The request for account “iCloud” failed.
    I am then given the option of staying Online or going Offline.
    Can anyone help me?
    thanks

    Hello b.krushel,
    Thank you for using Apple Support Communities
    Any number of things could cause this issue, so I would recommend this article named iCloud: Troubleshooting iCloud Calendar found here http://support.apple.com/kb/TS3999.
    These sections in particular:
    General Troubleshooting
    Make sure there are no current issues listed on the System Status that affect iCloud Calendar. The System Status is located on the iCloud Support webpage.
    Make sure you have fully enabled iCloud Calendar for the client you are using (for more setup and troubleshooting information on iOS, OS X, Windows and iCloud.com, see the additional details below).
    Check to see if the issue you are seeing is covered in iCloud Help. To search iCloud Help, visit help.apple.com/icloud.
    Check your settings and preferences as something may not be set up correctly. For example, having incorrect date and time settings can cause issues which are easily resolved by entering the appropriate settings.
    Troubleshooting Calendar on OS X Mountain Lion (iCal on OS X Lion)Note: For instructions on setting up iCloud Calendar with Calendar or iCal on your Mac, see iCloud Setup.If you are having trouble with Calendar or iCal on a Mac and you are using iCloud Calendar, try each of these steps, testing after each to see if the issue is resolved:
    Make sure you are using OS X Lion v10.7.2 or later. Click here for help verifying the version of OS X you are using.
    Make sure your computer is online. Attempt to view www.apple.com and iCloud.com. If you can't connect to the Internet, your iCloud calendars and events will not update in iCal. Click here for more information about troubleshooting your Internet connection.
    Verify that your iCloud member name is entered into the iCloud Preference pane in System Preferences. See iCloud Setup for more information about setting up iCloud on a Mac.
    Make sure you enter and update calendar information in the iCloud section of Calendar or iCal. Only calendars and events in the iCloud section of the Calendar or iCal Calendar list will be pushed to iCloud. Both Calendar and iCal for the Mac support the display of and interaction with multiple accounts and datastores, for example, iCloud, On My Mac, Exchange, Google, and so on. This makes it easy to create or modify events or calendars in a section of  Calendar or iCal that may not be updating iCloud. Learn more about moving local calendars to iCloud.
    In some cases, you may find that you have data duplicated in both the local On My Mac and the iCloud sections of Calendar or iCal. Learn more about resolving this issue.
    You can make the iCloud calendar your default calendar for all new events. In Calendar on OS X Mountain Lion, choose Calendar > Preferences > General, or in OS X Lion, choose iCal > Preferences > Generaland under the Default Calendar heading, select one of the Calendars under the iCloud heading. Close the Preferences window to save this change.
    If recent changes simply don't appear, try forcing Calendar or iCal to refresh by selecting Refresh All from theCalendar menu.
    Make sure your account was successfully created in Calendar on your Mac (or iCal). After upgrading to iCloud Calendar, you may need to quit and reopen Calendar (or iCal). To confirm your account is configured correctly in iCal:
    Open Calendar (or iCal).
    Open Calendar (or iCal) Preferences.
    Click Accounts. You should see an account with your iCloud member name entered.
    Turn iCloud Calendars off and back on
    Quit Calendar (or iCal).
    Choose Apple () menu > System Preferences > iCloud.
    Remove the checkmark in the checkbox next to Calendars.
    Close System Preferences and wait about a minute.
    Open System Preferences and choose iCloud.
    Replace the checkmark next to Calendars.
    Close System Preferences.
    Open Calendar (or iCal) and test to see if the issue has been resolved.
    Restart your computer. This may sound simple, but it does reinitialize your network and application settings and can frequently resolve issues.
    Take care,
    Sterling

  • Can't create new events or todos

    I am a frequent iCal / Mac user and have been using my Mac for the last year with no problem.
    Yesterday, I was no longer able to create new events or todos, in any calendar. When I click new event or new todo, there is no response (no window pops up, just ignores). When I drag an area in a day to create a new event, it shows the dragged time, then doesn't create the todo
    If I create an event or todo on my iPhone, it stays on my iPhone, but does not show up when syncing.
    Note all old events are still present. I can move an existing event to the future, so this shows edits are still possible.
    Can this be a recent bug from an pushed updated? Has anyone else seen this?
    I have rebooted and ensured all SW is up to date.
    Greg

    I am having the same trouble and just realized it yesterday. Can you provide the detailed steps you followed that I could try?
    I sync my calendar to MobileMe and my phone and those are both fine - and I've added new things to them since iCal stopped working apparently (guessing it was about a week ago based on things missing from iCal). I'm confused by your comment about backing up iCal - won't that simply end up restoring the same inaccurate data? Or maybe in my case it doesn't matter because the next time I sync it will update with the data I have on my phone and MobileMe (so maybe a dumb question). I already use Time Capsule so I'm guessing I can just use my most recent Time Capsule/iCal file backup to do my restore?
    I know very little about Terminal - not even enough to be dangerous! Are you saying in terminal you typed in that exact string you're showing below?
    Thanks!

  • When I try to add a new event to iCal a dialog says "you can't add or change events in the Birthday Calendar". How do I cancel this?

    When I try to add a New Event to iCal a dialog box keeps saying "you can't add or change events in the Birthday Calendar". iCal is, however, receiving up-dates from my other devoces via iCloud. Can anyone help unblock this for me please?

    You can not add events to the birthday's calendar. To add birthday's to the birthday calendar you need to add the birthday to a contact in the Contacts app.
    You can set your default calendar here:
    iCal > Preferences > General  > Default Calendar and chose the calendar you want to default to.

  • Many years ago synced iCal with Microsoft program. Since installing Lion whenever I try to create an event in iCal it flashes up message "Unable to open Microsoft sync services Power PC applications no longer supported." How do I get rid of message?

    Many years ago synced iCal with Microsoft program. Since installing Lion whenever I try to create an event in iCal it flashes up message "Unable to open Microsoft sync services Power PC applications no longer supported." How do I get rid of message?

    Lion no longer supports PowerPC apps. If this is Microsoft Office 2008 (Entourage 2008) then you should disable the syncing services.  (I don't have Office 2008 installed anymore so I don't know exactly what it's called anymore.)  If you have Microsoft Office 2004 or earlier, then it can't be run on Lion at all since Lion removed Rosetta, which is what allowed a PPC app to run on an Intel based Mac.
    Also, I believe Microsoft removed sync services from the current Outlook 2011 (which replaces Entourage) so even upgrading to a newer version of Microsoft Office will not get you back that calendar sync feature.  Supposedly Microsoft is working on a new syncing system, but I wouldn't hold my breath.

  • Iphoto create new event then copy photos to the new event.

    I took some pictures this afternoon and imported them into iPhoto.
    I looked for a new evernt but there wasn't one, so I checked 'last import' and there they were, but for some reason they they were there along with pictures I took almost a year ago.  I checked the clock on my camera and the dates were correct and I can't find any reason that the new pictures were grouped with ones from a year ago.
    So, I marked the new pictures, clicked 'copy', went back to 'events' and selected "new eventy" and created a new event, called "New event 8-4-13'.
    Clicked on the new event... and there was no way to copy the pictures I'd selected with 'copy' in the preceeding sentence. 
    My question:   it seems to be possible to create a New Event under the Library/Events, is there any way to actually associate pictures with this new event?

    the easiest way to do a new event is to flag the photos and use the create new event form flagged photos command
    As to your issue in finding the event - I do not understand what you have - but the most common reason for this si an incorrect sort - check the event sort - view menu ==> sort events
    LN

  • Why do new events in iCal automatically have reminders?

    When I create a new event in iCal (whether on my MacBook, or on my iPad, or on my iPhone), iCal automatically adds 2 reminders. I have checked my iCal preferences, and "Add a default alert to all new timed events" is unchecked. It's an annoying little quirk.
    This happened prior to upgrading to the new IOSes, and I was hoping it would disappear with the updates. However, it's not.
    Can anyone please help me to fix this?

    I found the answer from another forum. Changed the settings in Google Calendar. Bizarre.

  • Unable to add new event in iCal, Lion 10.7.1

    Hi,
    On Lion 10.7.1, I can't seem to add new events to iCal.
    I have tried the following:
    1. 2-finger click on a day in the month-view. This pops out the menu and I can click on 'New Event', but after that, nothing happens.
    2. Clicking on the '+' button at the top. This pops out the 'Create Quick Event' window. After typing in a new event and hitting return, nothing happens.
    I can create a new event in the 'Day' and 'Week' view though.
    iCal was working fine for me last week, but it seems to be broken since yesterday. I'm not sure if it stopped working after the 10.7.1 update.
    Thanks for any guidance or assistance!

    Solved! Needed to check "Show All Day Events" in the View menu!

Maybe you are looking for

  • How to avoid JMS validation when starting weblogic server

    Hi All, When starting up WebLogic server, it will validate JMS destinations one by one for deployed applications. If I don't connect the VPN, then these JMS destinations are not reachable, and WebLogic Server will spend a lot of time to try connectin

  • How to create a database (file.mdb)?

    Hello. I'm trying to create a .mdb database (Access) with Java but dont know how. How can i create a database if I need to be connected to an existing database? public class JavaApplication1 { * @param args the command line arguments public static vo

  • Term Loan Repayment

    Hi we have taken loan say $10000 and want to repay over a period of 10 months with interest rate of 10% at reducing balance method and interest also will be calculated accordingly on the balance outstanding. How can it be done through Oracle payable?

  • ERROR IN RSQL MODULE OF DATABASE INTERFACE

    Hi friends,   I am executing the report it is working for 1 year(01.01.2006 to 28.02.2007).But if i enter 07.03.2007 to 07.03.2007 i am getting RSQL database interface problem. So please suggest me for this problem.Thanks for the same. Thanks&Regards

  • HELP!  My iPad can't sync due to an unknown error.

    When I try to sync my iPad 2, I get an error alet saying "The iPad cannot be synced.  An unknown error occurred (1140)". I restored the iPad to its original settings.  It then tried to restore my apps, video, etc. from my back up.  Before completing