Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Creating iCal event Cannot convert date to number .. ??

:'Hey All,


I am trying to make appointments with an email alarm to go to multiple recipients.


The error I keep getting is


"Can’t make "12-08-13" into type number."

And help for any other mistakes you may see would be helpful too.

Thanks



##Get the Date

set theDate to short date string of (current date)

set theCal to "Home" as text


display dialog "Enter event date:" default answer (theDate as text) ¬

buttons {"Cancel Apt", "Make Apt"} ¬

default button 2

set aptDate to text returned of the result



##Get the email list

set emailList to ""

set emailList to text returned of (display dialog "List the eMail's of Presentation participants" default answer "example@me.com, example2@me.com")


##Make the ical event

tell application "iCal"

set eventName to ("Presentation for " & emailList) as text

set alarmTime to (aptDate as number) * -1

set newEvent to make new event at end of events of calendar theCal with properties {description:"Event Description", summary:eventName, location:"Event Location", start date:aptDate, allday event:true, trigger interval:alarmTime}

set theAlarm to make new mail alarm at end of mail alarms of newEvent with properties {visible:true, recipient:emailList, subject:"Presentation Info", content:"eMail body"}

end tell

end run

Applescript-OTHER, Mac OS X (10.7.4)

Posted on Aug 13, 2012 7:58 AM

Reply
17 replies

Creating iCal event Cannot convert date to number .. ??

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.