View Single Post
Code:
tell application id "com.omnigroup.OmniPlan"
	
	set oSchedule to schedule of project of document of front window
	set dteCalDate to date "Wednesday, March 24, 2010 00:00:00"
	
	set oCalDaySchedule to my Date2CalDaySchedule(oSchedule, dteCalDate)
	if oCalDaySchedule is not missing value then
		set strStart to start time of oCalDaySchedule
		set strEnd to end time of oCalDaySchedule
	end if
end tell

on Date2CalDaySchedule(oSchedule, dteCalDate)
	using terms from application "OmniPlan"
		tell oSchedule
			set lstCalSchedule to calendar day schedules where specific date = dteCalDate
			
			if length of lstCalSchedule > 0 then
				first item of lstCalSchedule
			else
				missing value
			end if
		end tell
	end using terms from
end Date2CalDaySchedule

Last edited by RobTrew; 2010-03-21 at 06:04 AM.. Reason: (redrafted as a function)