Advertisement

AppleScript: Print daily iCal agenda

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

  1. 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.

  2. 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.