HELP, with iCal scripting, thanks :)

I am making a script to add an event to iCal, and then add an open file alarm to it, but this following code gives me this error ICal got an error: AppleEvent handler failed.


tell application "iCal"
	tell calendar "Home"
		make new event with properties {description:"Do not delete", summary:"Never delete", location:"Never delete", start date:"Friday, September 30, 2008 5:12:26 PM", end date:"Friday, September 30, 2008 5:12:30 PM", allday event:false}
		set theEvent to event "Never Delete"
		tell theEvent
			make new open file alarm at end with properties {trigger date:"Friday, September 30, 2008 5:12:26 PM", filepath:(path to me)}
		end tell
	end tell
end tell

any ideas why?

thanks :slight_smile:

An Open File Alarm is associated with an event or todo. I don’t have the dictionary in front of me, but check the properties of an open file alarm and see whether you’ve fulfilled them.

I got the making of the event to work, but adding an alarm to it is not working, it will only work if I use a number (set theEvent to event 1) I want to use a name (Set theEvent to event “whatever the name is”)


set theCurrentDate to (current date)
tell application "iCal"
	tell calendar "Home"
		make new event at end with properties {description:"Do not delete", summary:"Never delete", location:"Never delete", start date:theCurrentDate, end date:theCurrentDate}
		set theEvent to event "Never Delete" --This line gives me the error "iCal got an error: Invalid key form." the only way it works is if I say, "set theEvent to event 1" 
		tell theEvent
			make new open file alarm at end with properties {trigger date:theCurrentDate, filepath:"/Users/debradaube/Desktop/Backwards.app"}
		end tell
	end tell
end tell

but I have to many things in iCal to count them all and find out what number it is…
Any help for this?

thanks

This works for me (with my locations and names): Note that all I’ve done is to assign the new event to a variable and then tell it, and I also removed the end date spec which will create another event one minute after the first.

set theCurrentDate to (current date)
tell application "iCal"
	tell calendar "Home"
		set newEvent to make new event at end with properties {description:"Do not delete", summary:"Never delete", location:"Never delete", start date:theCurrentDate}
		tell newEvent
			make new open file alarm at end with properties {trigger date:theCurrentDate, filepath:"/Users/debradaube/Desktop/Backwards.app"}
		end tell
	end tell
end tell

Thank you so much, I should have thought of that. Thanks again! :slight_smile:

Okay, It will open files as it should, but I need it to open an application. I guess this can’t be done right?

Any help is of value, thanks

I mean I want it to run a script, not really open an application…one of the alarm options is “Run AppleScript” but I don’t know how to use that through applescript :frowning:

Wow it works with applications, i’m sorry. It didn’t work because I tried to open an app that was on my flash drive, and the error was it couldn’t find it, ha ha.

Have you solved your problem?

Yes