The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Create Calendar Toolbar script Thread Tools Search this Thread Display Modes
Please note: if you type in the name of an existing calendar at the prompt, it will intentionally delete all the data from that calendar, this script is intended for creating or refreshing calendars specific to OmniFocus - read on for details.

The attached script can be used in the toolbar to create a calendar view of tasks being displayed in the current OmniFocus window.

The user is prompted to confirm the name of the calendar. The default is to use the perspective name, or the name of what is being focused on.

You can then tell the script to one or more of the following:

Create Events for Start Dates
Create Events for Due Dates
Create ToDos for tasks that have dates
Create ToDos for tasks that do not have dates
Create Events as All Day Events

In the script source you can also easily set the name of the created calendar so as not to be prompted, set any preference default, and turn off the prompt for preferences.

The script will then create the calendar if it does not already exist, or wipe it clean if it does and create the events and todos you requested.

This is not a sync, no information flows from iCal back to OmniFocus. If you complete a todo in iCal created by this script it does not complete it in OmniFocus (though this could be added as a feature).

An OmniFocus URL link is placed in each iCal item to link you back OmniFocus.

You could easily run the script twice to create a pair of calendars for start and due dates.

To Install:
Copy to ~/Library/Scripts/Applications/OmniFocus/

Then choose Customize toolbar by right clicking on the OmniFocus toolbar, drag this script's icon onto the toolbar

http://www.ptone.com/misc/CreateCalendar.zip

Please post your feedback here. :cool:

-P

Last edited by ptone; 2007-12-21 at 02:28 PM.. Reason: changed from attachment to URL
 
The script did not successfully create an iCal calendar for me where one did not exist. When run from Script Editor, I get "The variable targetCal is not defined."

But if I created the calendar in iCal before running the script, it worked as expected.

10.4.11
 
I think there may be some bug with the start date export on this. If I select "create events for start dates" and "create all day events" I get these strange icons (see attached image). If I don't select "create all day events", I get nothing, though I have plenty of tasks in view that have start dates.
Attached Thumbnails
Click image for larger version

Name:	create calendar start date icon.jpg
Views:	1031
Size:	6.2 KB
ID:	444  
 
Quote:
Originally Posted by Craig View Post
The script did not successfully create an iCal calendar for me where one did not exist. When run from Script Editor, I get "The variable targetCal is not defined."

But if I created the calendar in iCal before running the script, it worked as expected.

10.4.11
Craig,

What happens if you run this snippet in script editor?
Code:
tell application "iCal"
	set targetCal to make new calendar with properties {title:"testing"}
end tell
-P
 
Quote:
Originally Posted by sprugman View Post
I think there may be some bug with the start date export on this. If I select "create events for start dates" and "create all day events" I get these strange icons (see attached image). If I don't select "create all day events", I get nothing, though I have plenty of tasks in view that have start dates.
What are some system and version information? I saw a glitch once or twice in iCal when I was working on this, and I wondered if it wasn't related to rapid creation of events via AS.

When I had quit and relaunched iCal, and then reran the script it seemed fine. Please keep me posted.

-P
 
Quote:
Originally Posted by ptone View Post
Craig,

What happens if you run this snippet in script editor?
Code:
tell application "iCal"
	set targetCal to make new calendar with properties {title:"testing"}
end tell
-P
Works - iCal creates a new calendar called testing.
 
Not being an applescript guru, is there anyway to make the script differentiate between tasks with only due/start dates and tasks with both due/start dates AND times? It seems to make sense to have tasks with no time be shown as all day events and tasks with times have those times reflected in the calendar?

This is a GREAT script!
 
Quote:
What are some system and version information?
OS 10.4.11
iCal 2.05 (1069)
OF 96444

(quitting and relaunching iCal doesn't seem to make a difference)
 
Quote:
Originally Posted by acollins View Post
Not being an applescript guru, is there anyway to make the script differentiate between tasks with only due/start dates and tasks with both due/start dates AND times? It seems to make sense to have tasks with no time be shown as all day events and tasks with times have those times reflected in the calendar?

This is a GREAT script!
In OF, all due/start dates also have a time - you could perhaps check whether the task was using the default time - and assume that as "no-time set" and then make those as all day. It would be kind of tricky to present this question to the end user in a clear way. I think I'd also have to dig the default time pref directly from the OF pref file, since I don't think this is exposed through AS.

-P
 
Thanks so much for the script!

It worked for me once, but just now I tried it again and got this error:

Can’t get id of value of tree 1 of content of document window id 430 of document id "d2owK01yD2r"

Any ideas?
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script: Create Subcontext jeremyp OmniFocus Extras 1 2011-07-29 06:41 AM
Script to create Stencil lsamberg OmniGraffle General 0 2010-08-31 05:13 AM
New Create Calendar script posted ptone OmniFocus 1 for Mac 4 2009-12-29 09:13 AM
Automator script from toolbar not working hardcoreUFO OmniOutliner 3 for Mac 2 2008-04-03 07:13 PM
Script to create an email from a task in OF. Tinchohs OmniFocus Extras 3 2007-10-31 12:53 PM


All times are GMT -8. The time now is 07:26 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.