View Full Version : Create Calendar Toolbar script
ptone
2007-12-21, 02:12 PM
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
Craig
2007-12-22, 08:09 AM
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
sprugman
2007-12-22, 09:44 AM
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.
ptone
2007-12-22, 09:56 PM
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?
tell application "iCal"
set targetCal to make new calendar with properties {title:"testing"}
end tell
-P
ptone
2007-12-22, 09:59 PM
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
Craig
2007-12-23, 10:45 AM
Craig,
What happens if you run this snippet in script editor?
tell application "iCal"
set targetCal to make new calendar with properties {title:"testing"}
end tell
-P
Works - iCal creates a new calendar called testing.
acollins
2007-12-23, 08:41 PM
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!
sprugman
2007-12-24, 10:57 AM
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)
ptone
2007-12-24, 04:06 PM
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
GreenCountry
2008-01-01, 10:12 AM
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?
GreenCountry
2008-01-01, 10:15 AM
Hmm. Ok I can't help any further with diagnosis, but I seem to have fixed the problem by deleting the newly created (but empty) calendar that the script created when it errored out. Ran it a couple times more, no problems so far.
kthakk4
2008-01-01, 12:53 PM
Thanks ptone for the great script. I was wondering if it was possible to enhance it a little.
1. Set a default alarm if that option is set in iCal preferances.
2. Right now the events being created in iCal are half an hour long by default. Is there a way to change this behavior based on the Duration field in OF?
ptone
2008-01-04, 03:37 PM
Sorry for the delay in getting back to this feedback.
1. Set a default alarm if that option is set in iCal preferances.
I'm surprised iCal doesn't respect this pref when events are created via AS - I'll look into this.
2. Right now the events being created in iCal are half an hour long by default. Is there a way to change this behavior based on the Duration field in OF?
Would you do that for both the start and due dates? (I would guess just the start dates).
My plans for this script are to merge it with another unreleased script I have that syncs a perspective with an ical (so that events created in ical goto inbox, and the completion status gets synced back to OF).
-P
kthakk4
2008-01-04, 08:05 PM
Sorry for the delay in getting back to this feedback.
I'm surprised iCal doesn't respect this pref when events are created via AS - I'll look into this.
Would you do that for both the start and due dates? (I would guess just the start dates).
My plans for this script are to merge it with another unreleased script I have that syncs a perspective with an ical (so that events created in ical goto inbox, and the completion status gets synced back to OF).
-P
I'd have to say for start date only. I am thinking that most of the time when people have due date, it's something noncontinous. They would finish it in multiple phases before the due date.
Start date/Duration combination on the other hand will be used mostly to mark things like meetings and appointments.
Your script about ical events linking back to inbox sound real awesome. I am wondering if we can request to make your final script part of the standard release.
My last request may sound like growing grass before buying a cow, but being a keyboard-slave I have to say that it'd really awesome if there was a keyboard shortcut to run the script.
GreenCountry
2008-01-06, 06:20 PM
Ok, I'm having basically the same error again, and I've narrowed it down a *little* bit. I'm always running the script's option to "Create Events for Due Dates," and I use a calendar called "OmniFocus" in iCal to designate the script's output.
Here's the error message:
Can’t get id of value of tree 1 of content of document window id 496088 of document id "liw8Dlb_jcg".
The result after running the script which quits with the above error, is that I get either an iCal calendar with no events in it. I've tried both deleting the "OmniFocus" calendar, hiding it, etc. Was getting the same error repeatedly. Then, I toyed around with the view in OF in which I run the script, and was able to locate what I think is the problem.
The error seems to be isolated to when, in Planning Mode, the left-hand pane is set to show the Inbox (either alone or with other projects/actions) **and the Inbox is empty**. Script runs fine in: Context Mode; Planning Mode in any view not showing an empty Inbox (including if other projects are "empty" and have no actions in them); and Planning Mode in any view showing a non-empty Inbox.
Hope this helps, and thanks again for your work!
paulduv
2008-01-24, 12:09 PM
A lot of people seem to be saying "OmniFocus is just not about hard dates". Well, I can't see why it wouldn't be.
For me, if I book a date with a plumber (which I just did), I want to do that through OmniFocus, because well, I just do. That's where I do everything. Others may not be so inclined, but I don't "feel like" jumping to some other paradigm to schedule that day. That could be because OF is so cool... Who knows.
Having "Plumber at 1:00 on the 29th" as a To Do among a list of To Dos is weird, I think most would find. So it's a hard date, and I want to see it that way in iCal. People who are saying that are right, I think. But: why force me to use something other than OF to input those hard dates?
Yes, it adds another layer, and the quest for simplicity is good. How about doing it this way:
In the inspector, add a "sync" tab, where the user checks off "add this as an event in iCal on sync", and checks one or both: "event appears on Due date", "event appears on start date".
Anyway, that script is great, and makes me even happier with OmniFocus. Thanks ptone!
farfelu5251
2008-01-26, 08:56 AM
This is an awesome script. It's exactly what I needed for school deadlines and such. I definitely think a feature like this should be included in OmniFocus. I found the current integrated iCal sync quite unintuitive and awkward.
zachware
2008-05-06, 05:22 AM
Say if we use the flags to define our MITs for the day. How can we modify this script to only place flagged items in the calendar?
tdehnke
2009-02-22, 10:47 PM
I am trying to set this up to put the reminder into my default calendar (Personal), but it seems to hang ical and OF when I do?
Any ideas?
amelchi
2009-05-20, 01:19 AM
it is very good,
thanks...
perhaps one thing missing: the possibilty to add an alarm...
any way?
TIA
Alessandro
oldvill
2009-06-23, 04:50 AM
Please note:
To Install:
Copy to ~/Library/Scripts/Applications/OmniFocus/
-P
Hello,
what should i do if i i can't find/don't have the location you're describing above? i'll type out what i do have:
1. macHD/Library/scripts/---and then no applications folder
2. user/library/---and no scripts folder
I'm running leopard with all updates on a 1.5yr old MBP.
not sure how to install. thanks for any and all help.
curt.clifton
2009-06-23, 05:40 AM
Just create the folders as needed.
oldvill
2009-06-23, 10:04 AM
that’s great. thanks curt!
Thanks for this great script.
May I abuse ?
Is it possible to have the name of the project in Ical ? I have a lot of project and the task is not enough for me.
Best regards
jean-marc
nutellacrepe
2010-01-27, 10:16 AM
Just what I was looking for.
nickwild
2010-01-28, 06:02 AM
Hi,
Can this be modified to work with an exchange calendar in SL?
Thanks
Nick
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.