I made this draft. Maybe it helps.
You need to enter your calendar name in the property calendar_name.
Note: It would be painfully slow in calendars with lots of events.
-- unlocked2412
-- THIS SCRIPT MAKES CALENDAR EVENTS FROM OMNIFOCUS TASKS WHOSE
-- DUE DATES AND ESTIMATED MINUTES FIELDS HAVE VALID VALUES.
property calendar_name : "" -- ENTER NAME OF YOUR CALENDAR
tell application "Calendar"
set calendar_element to calendar calendar_name
end tell
tell application "OmniFocus"
tell default document
set task_elements to flattened tasks whose ¬
(completed is false) and (estimated minutes ≠ missing value) and (due date ≠ missing value)
repeat with item_ref in task_elements
-- GET OMNIFOCUS TASKS
set the_task to contents of item_ref
set task_name to name of the_task
set task_note to note of the_task
set task_due to due date of the_task
set task_estimate to estimated minutes of the_task
-- BUILD CALENDAR DATE
set start_date to task_due
set end_date to start_date + (task_estimate * minutes)
-- CREATE CALENDAR EVENT
tell application "Calendar"
tell calendar_element
if exists (first event whose (start date = start_date) and (summary = task_name)) then
tell application "System Events"
display dialog "The task: " & task_name & " is already in your calendar"
end tell
else
make new event with properties ¬
{summary:task_name, start date:start_date, end date:end_date} at calendar_element
end if
end tell
end tell
end repeat
tell application "System Events"
display dialog "Done"
end tell
end tell
end tell