Description: Quick way to add events to iCal.
Requirement: Mac OS 10.3+ and Satimage.osax
You can add event is the following forms:
[day of month] [start time[-end time]] [alarm] [summery]
20 16 Meeting with customer (no alarm, end time plus one hour)
20 16:30 Meeting with customer
20 16:30-18:30 Meeting with customer
20 16:30-18:30 2 Meeting with customer (alarm two hours before)
20 16:30-18:30 30m Meeting with customer (alarm 30 minuts before)
You can only schedule events one month forward. Times must be entered according to 24 hour time.
Use something like Quicksilver or iKey to add shortcuts/triggers to the script.
-- Script Start (* Quick way to add events to iCal. Modified versions of the QSiCalScripts from http://www.hawkwings.net/2006/02/04/applescripts-for-ical-events-and-to-dos/ 2007-03-26 by Fredrik Jonsson <mailto(colon)fredrik(at)combonet(dot)se> home page <http://xdeb.org/wiki/AppleScript> *) property theAlarmSound : "Basso" -- Ping, Basso, Sosumi etc. set iCalendars to {} set theCals to {} tell application "iCal" set theCals to calendars whose writable is true repeat with i from 1 to count of theCals copy title of item i of theCals to end of iCalendars end repeat end tell tell me to activate set theDialog to (display dialog "Make new event with [day of month] [start time[-end time]] [alarm] [summery]: " default answer "") if (button returned of theDialog is "Cancel") then return set theResult to the text returned of theDialog set theEvent to find text "([0-9]+)[ ]+([0-9:]+)(-([0-9:]+))?[ ]+(([0-9]+)([mh])?[ ]+)?(.*)" in theResult using {"\\1", "\\2", "\\4", "\\6", "\\7", "\\8"} with string result and regexp set theDay to string 1 of theEvent set theStartTime to string 2 of theEvent set theEndTime to string 3 of theEvent set theAlarmTime to string 4 of theEvent set theAlarmSize to string 5 of theEvent set theSummary to string 6 of theEvent set theDescription to "" set thisDate to current date -- Add minuts if there are none. if (theStartTime does not contain ":") then set theStartTime to theStartTime & ":00" end if set theStartDate to (date theDay) + (time of date theStartTime) if (day of thisDate is greater than day of theStartDate) then -- Add one month to the date, (+ 1 * months) doesn't work unfortunately. -- Setting the day to 32 makes it overflow to the next month. set day of theStartDate to 32 -- Then we set the day correctly set day of theStartDate to theDay end if if (theEndTime = "") then set theEndDate to theStartDate + 1 * hours else -- Add minuts if there are none. if (theEndTime does not contain ":") then set theEndTime to theEndTime & ":00" end if set theEndDate to theStartDate + ((time of date theEndTime) - (time of date theStartTime)) end if tell me to activate set theChoice to choose from list iCalendars with prompt "Choose the Calendar to use" OK button name "Choose" without multiple selections allowed and empty selection allowed if (theChoice is not false) then set theCalChoice to item 1 of theChoice end if set theCalName to theCalChoice -- Run through our Calendar list and find the iCal id of the chosen Calendar set i to 1 repeat with anitem in iCalendars if (item i of iCalendars is equal to theCalName) then set theNum to i exit repeat end if set i to i + 1 end repeat set currentCal to item theNum of theCals tell application "iCal" set theEvent to (make event at end of events of currentCal with properties {start date:theStartDate, end date:theEndDate, summary:theSummary, description:theDescription}) if (theAlarmTime is not "") then if (theAlarmSize is "m") then set theAlarm to (theAlarmTime as integer) * -1 else set theAlarm to (theAlarmTime as integer) * -60 end if make new sound alarm at end of sound alarms of theEvent with properties {trigger interval:theAlarm, sound name:theAlarmSound} end if end tell -- Script Stop