• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Setting a new event, with an alarm, in iCal, using a script with dialogs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting a new event, with an alarm, in iCal, using a script with dialogs


  • Subject: Setting a new event, with an alarm, in iCal, using a script with dialogs
  • From: Clint Hoxie <email@hidden>
  • Date: Sat, 1 Dec 2007 20:58:11 -0700

Using the following script, I can run each commented section as a separate piece with no problems (given that dependent variables are defined), but when I run them as a complete set, I get a "can't get date" error. Any ideas where my problem in this script is?

Thanks.

Clint

PS - I haven't gotten to debugging the set alarm section, which I don't think is ready to work, because I've been stuck getting the date entered. I had a simpler version that just requested date and time as 2 dialogs instead of 4, but it wasn't working, either.

-------------------------

tell application "iCal"
activate
view calendar at current date


--Get event description
display dialog "Enter event name:" default answer ""
set eventName to text returned of the result


--Get date
display dialog "Enter event year:" default answer "2007"
set eventYear to text returned of the result
display dialog "Enter event month (1-12):" default answer ""
set eventMonth to text returned of the result
display dialog "Enter event day (1-31):" default answer ""
set eventDay to text returned of the result


--get time
display dialog "Enter event time:" default answer ""
set eventTime to text returned of the result
set eventStart to date (eventMonth & space & eventDay & space & eventYear & space & eventTime)


--get event duration in minutes
display dialog "How many minutes will the event last?" default answer "0"
set eventDuration to text returned of the result
set eventSeconds to (60 * eventDuration)
set eventEnd to eventStart + (1 * eventSeconds)


--get alarm
display dialog "Enter time before event for alarm to trigger (in minutes)." default answer "15"
set minutesVariable to text returned of the result
set eventAlarmOffset to (-60 * minutesVariable)


--make the event
set newevent to make new event at end of events of calendar "Alarms" with properties {summary:eventName, start date:eventStart, end date:eventEnd}
display alarm {trigger interval:eventAlarmOffset}
end tell
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Setting a new event, with an alarm, in iCal, using a script with dialogs
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Changing the subject of a message
  • Next by Date: Re: Setting a new event, with an alarm, in iCal, using a script with dialogs
  • Previous by thread: Changing the subject of a message
  • Next by thread: Re: Setting a new event, with an alarm, in iCal, using a script with dialogs
  • Index(es):
    • Date
    • Thread