-- --------------------------------------------
-- SCRIPT ALL_NEXTSTEPS                      --
-- --------------------------------------------
-- iCal ToDos to Clipboard 
-- John Maisey 5 Aug 2005 
-- Copies ToDo title, due date and notes of one calendar to the clipboard 
-- With apologies to John, edited by Mike McCamon 17 Oct 2005 for my hack

set theCals to {}
set theTodos to {}

tell application "iCal"
	set master_data to "Next Actions List" & return & "Last sync: " & date string of (current date) & return
	set theCals to calendars
	set i to 1
	repeat with a_Cal in theCals
		set calTitle to title of calendar i
		if (calTitle contains "@") then
			-- do nothing
		else
			-- set master_data to master_data & calTitle & return
			set exists_todos to false
			set the_todos to ""
			
			repeat with aTD in todos of a_Cal
				if (the length of the (completion date of aTD as string)) is 0 then
					set exists_todos to true
					set TD_name to summary of aTD
					if (TD_name does not contain ">") then
						set the_todos to the_todos & "  O   " & TD_name & return
					end if
				end if
			end repeat
			
			if exists_todos then
				set master_data to master_data & return & calTitle & return
				set master_data to master_data & the_todos
			end if
		end if
		
		set i to i + 1
	end repeat
end tell

set the clipboard to master_data as string
-- been when done
beep 3


-- --------------------------------------------
--  END SCRIPT                               --
-- --------------------------------------------


-- --------------------------------------------
-- SCRIPT PICK_CALENDAR                      --
-- --------------------------------------------

-- iCal ToDos to Clipboard 
-- John Maisey 5 Aug 2005 
-- Copies ToDo title, due date and notes of one calendar to the clipboard 
-- With apologies to John, edited by Mike McCamon 17 Oct 2005 for my hack

tell application "iCal"
	--select calendars 
	set myCalName to (choose from list (title of (every calendar) as list) with prompt "Choose Calendar for ToDos")
	if myCalName is false then return
	set empty to missing value
	set myInfo to item 1 of myCalName & return & date string of (current date) & return & return
	set myCal to (first calendar whose title is item 1 of myCalName)
	set myTodos to properties of todos of myCal
	--return myTodos 
	repeat with myToDo in myTodos
		if (completion date of myToDo) contains missing value then
			try
				set dueDate to date string of (due date of myToDo)
			on error
				set dueDate to ""
			end try
			if (description of myToDo) is not missing value then
				set myDesc to (description of myToDo)
			else
				set myDesc to ""
			end if
			set myInfo to myInfo & "O   " & summary of myToDo & return
		end if
	end repeat
	
	set the clipboard to myInfo
end tell

set the clipboard to myInfo as string
-- been when done
beep 3


-- --------------------------------------------
--  END SCRIPT                               --
-- --------------------------------------------


 
Back