Now that we have all these cool Unix utilities I decided to unleash some AppleScript upon them. The following script will display the output of the calendar command in a dialog, allowing you to then place the contents on the clipboard. Paste the following into script editor, modify to your liking and compile:
set n to do shell script "calendar -f ~/Library/calendar"Some notes to help make this easier to use:
display dialog "Calender:\r" & n buttons {"Clipboard", "OK"}¬
default button 2
if the button returned of the result is "Clipboard" then
set the clipboard to n
display dialog "The calendar is on the clipboard." buttons¬
{"Cool"} giving up after 10 default button 1
-- the "giving up after 10 " part basically assumes it's cool
-- after 10 seconds of inactivity and removes the dialog
end if
- Create the calendar file first with touch ~/Library/calendar, and then edit it to add your entries.
- Read the man pages for calendar (man calendar) for information on how to format your calendar file.
- There are some sample calendars in /usr/share/calendar; to see the script in action, try using /usr/share/calendar/calendar.computer (or any of the others in that directory) in the first line after the "-f". You can also add extra options (-l 30 to show the next 30 days, for example).
•
[9,602 views]

