Help with Applescript (adding alarms to a calendar entry in Mavericks)

Discussion in 'Mac Programming' started by mrjayviper, May 6, 2014.

  1. mrjayviper, May 6, 2014
    Last edited: May 6, 2014

    mrjayviper macrumors regular

    Joined:
    Jul 17, 2012
    #1
    Hello.

    I have following scripts (see bottom) that is meant to open all calendar entries and create alarms for each. This is working fine on 10.8.x. I've been testing the same script on Mavericks and I'm getting this error.

    [​IMG]

    The error happens on the line that says "make new open file alarm...". If I commented these 2 lines, it proceeds fine.

    Any ideas what could be wrong? I looking at the Applescript reference guide available online but I can't find the section that talks about make and it's a bit hard to search the net for the word "make" since it's pretty generic.

    Thanks for the help :)
    ----------------

    Here's my code:
    Code:
    		set startFile to "/Users/" & UName & "/Desktop/my-app1-here.app"
    		set endFile to "/users/" & UName & "/Desktop/my-app2-here.app"
    
    		tell application "Calendar"
    			tell calendar "Home"
    				delay 1
    				set allEvents to every event
    				
    				repeat with rEvent in allEvents
    					tell rEvent
    								set theDate to start date - 1 * minutes
    						set endDate to end date
    						
    						if (minutes of (endDate) is 0) then
    							set endDate to endDate - 5 * minutes
    						end if
    						
    						make new open file alarm at end with properties {trigger date:theDate, filepath:startFile}
    						make new open file alarm at end with properties {trigger date:endDate, filepath:endFile}
    						
    					end tell
    				end repeat
    				
    			end tell
    here's the console log error
    Code:
    7/05/2014 10:19:52.698 am Calendar[646]: [com.apple.calendar.ui.log] [Save failed with error Error Domain=NSCocoaErrorDomain Code=1560 "Multiple validation errors occurred." UserInfo=0x608000866600 {NSDetailedErrors=(
        "Error Domain=CalCalendarStorePersistenceErrorDomain Code=1550 \"Alerts that open files or scripts must include a file path.\" UserInfo={\n    CalAlarmUID = \"2B8B98F1-0E23-45A7-AFDA-5AB692A36647\";\n    CalCalendarItemUID = \"79E93DF6-2073-40DF-BAB1-1642493B5B18\";\n    CalCalendarUID = \"DD5D4A36-F3E9-4BA7-A15B-A843D9381564\";\n    CalManagedObjectType = CalManagedAlarm;\n    NSLocalizedDescription = \"Alerts that open files or scripts must include a file path.\";\n}",
        "Error Domain=CalCalendarStorePersistenceErrorDomain Code=1550 \"Alerts that open files or scripts must include a file path.\" UserInfo={\n    CalAlarmUID = \"7729163B-0C99-4F21-AA2D-4A96E41D5045\";\n    CalCalendarItemUID = \"79E93DF6-2073-40DF-BAB1-1642493B5B18\";\n    CalCalendarUID = \"DD5D4A36-F3E9-4BA7-A15B-A843D9381564\";\n    CalManagedObjectType = CalManagedAlarm;\n    NSLocalizedDescription = \"Alerts that open files or scripts must include a file path.\";\n}"
    )}]
    7/05/2014 10:19:52.699 am Calendar[646]: Detailed error: Error Domain=CalCalendarStorePersistenceErrorDomain Code=1550 "Alerts that open files or scripts must include a file path." UserInfo={
        CalAlarmUID = "2B8B98F1-0E23-45A7-AFDA-5AB692A36647";
        CalCalendarItemUID = "79E93DF6-2073-40DF-BAB1-1642493B5B18";
        CalCalendarUID = "DD5D4A36-F3E9-4BA7-A15B-A843D9381564";
        CalManagedObjectType = CalManagedAlarm;
        NSLocalizedDescription = "Alerts that open files or scripts must include a file path.";
    }
    7/05/2014 10:19:52.699 am Calendar[646]: Detailed error: Error Domain=CalCalendarStorePersistenceErrorDomain Code=1550 "Alerts that open files or scripts must include a file path." UserInfo={
        CalAlarmUID = "7729163B-0C99-4F21-AA2D-4A96E41D5045";
        CalCalendarItemUID = "79E93DF6-2073-40DF-BAB1-1642493B5B18";
        CalCalendarUID = "DD5D4A36-F3E9-4BA7-A15B-A843D9381564";
        CalManagedObjectType = CalManagedAlarm;
        NSLocalizedDescription = "Alerts that open files or scripts must include a file path.";
    }
    
     
  2. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Instead of looking at the Applescript reference guide it might be better to take a look at the Calendar dictionary. Did you take a look at the Console application for more information? What is UName? If it's a variable then it's not set to anything in the script you posted. I'm guessing it's your username and perhaps it's a typo but /Users/ is not the same as /users/.
     
  3. mrjayviper thread starter macrumors regular

    Joined:
    Jul 17, 2012
    #3
    the code I posted is just a snippet of a much larger code. I just included the parts where it's giving me an error.

    Also, any variable name you see are properly declared above and the paths are all correct.

    thanks again

    ps. I edited my original post to include console message. I didn't know it appears there! :eek:
     
  4. mrjayviper thread starter macrumors regular

    Joined:
    Jul 17, 2012
    #4
    CAn someone please point me to the dictionary? I searched the net but the dictionary words brings up unrelated results.
     
  5. snorkelman macrumors 6502a

    snorkelman

    Joined:
    Oct 25, 2010
    #5
    in applescript editor menu:

    File
    Open Dictionary..
    Calander.app
     

Share This Page