If you use iCal to store you important dates and events, and use it on a regular basis without syncing events via an iPod, iPhone, or other device, then you know how frustrating it can be when you forget about an appointment or event. I'm going to show you a way to automatically print your daily iCal agenda with a simple AppleScript. You can set this script to run when your Mac starts up so you never miss an appointment!Continue reading to learn how to create this AppleScript.
Creating the Script
Open Script Editor.app (it can be found in /Applications/AppleScript). When you have the application opened, type (or copy / paste) the entire AppleScript below.
tell application "iCal"
view calendar at (my (current date))
switch view to day view
activate
tell application "System Events"
keystroke "p" using command down
delay 1 -- (seconds)
keystroke return
delay 2 -- (seconds)
keystroke return
end tell
quit
end tell
When you are finished, your script should look similar to the one below.

Saving the script
You can save this script as an application by clicking File > Save As, and choosing "Application" from the "File Format" drop-down box. Type a name and location for your script to be saved and then click the "Save" button.

Running the script
To run this script, you can double-click on the application that you just created or you can drag it into the dock for easy clicking (or right-click on the icon in the dock and select "Open at Login" to have your script run when you login to your account).
When the script runs, it will open iCal, set the view to the current date, and will then print the current view. Normally, this would take a couple minutes to do by hand, but you can now have an iCal agenda quickly printed off.
Additional notes
- This script assumes that you are using either Mac OS X "Tiger" (version 10.4) or "Leopard" (version 10.5). I have yet to test this on 10.3 or below, but it may work on older versions of Mac OS X.
- In order to use this script, you must enable "GUI Scripting." To do this, open "AppleScript Utility" in the /Applications/AppleScript directory. Then check the "Enable GUI Scripting" checkbox.











Reader Comments (Page 1 of 1)
4-28-2008 @ 11:15AM
Norman Ferguson said...
Very nice, indeed.
Now let's take it up a notch. Show us how to replace the block with a way to email the day's events to a particular email address.
Thanks!
Reply
4-28-2008 @ 11:37AM
VA said...
Yes, please, email daily schedule! I have tried the same thing in automator but for some reason it fails.
I think having your daily email sent to yourself at the start of the day would be just soo useful...
4-28-2008 @ 11:45AM
geddy76 said...
@Norman,
I did exactly what you are asking not too long ago as an Automator workflow. It's 3 Actions (the first 2 are iCal Actions, the 3rd is a Mail Action):
1. Get Specified iCal items. [select which calendars you want
included in the summary.]
2. Event Summary. [Set for "Today, "Tomorrow" or whatever
you want.]
3. New Mail Message [Fill in the appropriate info.]
Set the workflow to run as a daily alarm in iCal. I made a new Calendar called Events (that stays hidden).
Now if anyone can figure out how to get iCal to Print to PDF as an Applescript, please let me know. It's impossible in Tiger.
4-28-2008 @ 2:11PM
sean Carter said...
That's what I was thinking. I would like to have my alarm which goes off on workdays open up the script and then email me the events so I can be reminded on my way to work looking at my iphone...
4-28-2008 @ 12:56PM
Norman Ferguson said...
@geddy76 - unfortunately, 10.5's iCal Automator 'Event Summary' action differs significantly from 10.4 Tiger's. And I have not (yet) found an easy way to find recurring events whose recurrence = today.
Still working on it.
Reply
4-29-2008 @ 4:27AM
VA said...
I confirm, the automator version does not work in Leopard.
This is why I have been looking for an Applescript version...
4-28-2008 @ 10:42PM
justin turner said...
the way to do this in leopard is:
Get specified iCal items, and select the calendar you want.
Filter events in iCal whose start date is today.
Event summary so you get all the details of the events.
New Mail message with what you want.
Send outgoing messages.
jt
4-28-2008 @ 2:55PM
Aaron Davies said...
"You can set this script to run when your Mac starts up" -- you shut down your Mac?
Reply
4-28-2008 @ 3:39PM
dbit said...
love it!
keep the applescript tips coming!
Reply
4-28-2008 @ 5:49PM
Mike said...
Actually, you could take this a step further and create a reoccurring task in iCal that would kick off early in the morning (say 5 or 6 am) and run this applescript - printing your agenda.
Then as you run out the door for the day, you have a printed agenda waiting for you!
Reply
4-28-2008 @ 10:55PM
Norman Ferguson said...
@justin - the only problem is that your method does not find recurring events (and I have yet to fond any method that does).
Reply
4-29-2008 @ 5:37PM
numlock said...
Never posted a script so i hope this comes out right. Anyway this would print out the day view as a pdf in the folder ical prints its pdfs and saves its backups.
You could then add a folder action to that specific folder to look for pdf´s created today and add that pdf as an attachment to an outgoing mail to the email address of your choice
set todaysDate to (current date)
set {d, m, y} to {day, month, year} of todaysDate
set yearString to text -2 thru -1 of ("0" & (y mod 100))
set monthList to {January, February, March, April, May, June, July, August, September, October, November, December}
repeat with i from 1 to 12
if m = (item i of monthList) then
set monthString to text -2 thru -1 of ("0" & i)
exit repeat
end if
end repeat
set todaysDate to " - " & d & "/" & monthString & "/" & yearString
tell application "iCal" to activate
tell application "System Events"
tell process "iCal"
keystroke "t" using command down
keystroke "p" using command down
delay 3
keystroke return
delay 5
delay 5
click menu button "PDF" of window "Print"
perform action "AXPress" of menu item "Save as PDF…" of menu 1 of menu button "PDF" of window "Print"
delay 2
keystroke "iCal" & todaysDate
keystroke tab
keystroke return
keystroke return
end tell
end tell
Reply
4-30-2008 @ 9:13AM
geddy76 said...
I had written something very similar to that a month ago. However, no matter what I did, whenever I got to the part where the script was looking to access the Print PDF menu, it crapped out and gave me the NS-4 error (or whatever it is). Just tested yours (in Tiger) and got the same. Which is why I went the Automator way. It still summarizes to email, but not near as nicely as the PDF.