Should be a quick answer, I just seem to be missing something. The first block of code here adds the event just fine:
tell application "iCal" to activate
delay 5
tell application "iCal"
tell calendar "Home"
set startdate to date "Friday, December 2, 2011 2:00:00 AM"
set enddate to date "Friday, December 2, 2011 3:00:00 PM"
make new event at end with properties {summary:"Title", location:"Location", start date:startdate, end date:enddate}
end tell
end tell
But this block here, I simply replace the quoted text with a string variable and it breaks, iCal runs into an error “Can’t get date” number -1728
tell application "iCal" to activate
delay 5
tell application "iCal"
tell calendar "Home"
set test to "Friday, December 2, 2011 2:00:00 AM"
set startdate to date test
set enddate to date "Friday, December 2, 2011 3:00:00 PM"
make new event at end with properties {summary:"Title", location:"Location", start date:startdate, end date:enddate}
end tell
end tell
Is there a fundamental concept I’m missing as to why quoted text can be converted into a date object but string variables cannot?