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

 
Selected Tasks to iCal Thread Tools Search this Thread Display Modes
snarke -- cool, but it only seems to return the collected tasks; looks like it doesn't go beyond

return collectedTaskInfo

-- in Script Editor, it produces a result list, no iCal change occurs.

Also, when running the installer, no icon was added to the toolbar, had to Customize Toolbar manually... And it does nothing from there as well.

Upd.: commenting out the above return line did the trick.

OmniBrian: there's a pending Sync Flagged to iCal feature request, can you please add all posters to this thread and the download count to the votes? :)

Also -- Things do exactly this with Today instead of Flagged. However, when you un-Today in Things, the Todo immediately disappears from iCal, and toggling Today star back on makes it reappear back (try it). Yet here, unflagging a task leaves it hanging in iCal...

Checking the iCal-synced task in Things makes it complete in iCal and vice versa, here if you check a todo complete in iCal, it still shows not complete in OF.

That's why we need it as a deeply managed feature, to keep track of it by flagging/unflagging event (try that in AppleScript).

A fun way to see this is to run Anxiety with the iCal calendar you sync to, and check-uncheck, today-untoday, flag-unflag tasks in OF or Things, and see the contents of the list and stati reflect the changes at once (Things) or not (OF with tasks to iCal script).

Last edited by braver; 2008-12-02 at 11:45 AM..
 
Quote:
Originally Posted by braver View Post
snarke -- cool, but it only seems to return the collected tasks; looks like it doesn't go beyond

return collectedTaskInfo

Upd.: commenting out the above return line did the trick.
What the ****? How the [yet another expletive deleted] does that keep getting in there??

Quote:
Originally Posted by braver View Post
Also, when running the installer, no icon was added to the toolbar
Well, that one's a mystery to me. The AppleScript command that does that is too simple to get wrong:

Code:
tell application "AppleScript Utility" to set Script menu enabled to true
If that isn't actually enabling the script menu, I don't know what I'd change. {scratch head}
Attached Files
File Type: zip tasks to iCal 2.1.zip (28.7 KB, 236 views)
 
The 2.1 version seems to be working fine for me-thanks! One question, how much trouble would it be to modify this script to also include the context in the item's title, just as it works if this option is checked in the OmniFocus>iCal sync preferences?

As example, "My Task" with a context of "Errand" located in the project "My Project" gets added to iCal as:

@Errand: My Task (My Project)
 
Quote:
how much trouble would it be to modify this script to also include the context in the item's title?
Oh, I suppose not all that much trouble. Did you try adding it yourself? Really, AppleScript is a pretty easy language to just fiddle around in. I strongly encourage anybody using this script to at least open it up once and look around inside.

I admit it's much easier to delete or change scripts than to add things to them.
So here's version 2.2: it includes the context by default, and now has "wantContext" and "wantProject" properties, so users can easily turn those parts of the ToDo title on or off by just editing the properties at the top of the script.

[carefully checks for unwanted debugging code left behind]

[has a brainstorm]

Oh, for crying out loud. You people have got to stop making me fiddle with this script. I keep thinking of new things to add. I have also added rudimentary 'completion' synchronization.

Until now, if the script found an existing ToDo item in iCal with the same name as the one it's trying to sync, it would delete the old ToDo before building the new one coming over from iCal. (This is especially important if you're syncing all flagged items.) Now, if it finds a matching existing ToDo, AND that ToDo item has been checked off, then instead of deleting/recreating it from OF, it will instead check off the task in OF as "completed."

A warning: this is done (somewhat imprecisely) by looking for a ToDo item in iCal that contains the title of the OF Task. (Because the iCal ToDo title has that project and context stuff in it too). If you have a task called "Buy Groceries at Safeway" and one called "Buy Groceries", the latter might mis-match to the former and delete/replace it.

One way to avoid this would be to use the URL of the iCal ToDo item to be able to uniquely identify which OF item it originally came from. But that would involve increasing the size of the script by 50% or so, and since I'm not actually using this script, I think I'll skip that function for now. Maybe when version 2.3 comes out . . . :cool:

Also, it'll only sync the 'completion' flag if you check it off in iCal, then highlight it in OF to copy it into iCal again. Or if it's flagged, and you're syncing flagged items.

But hey, it's a free bonus feature. Maybe somebody else would like to improve upon it a bit? {rueful chuckle}
Attached Files
File Type: zip tasks to iCal 2.2.zip (31.1 KB, 280 views)
 
Thanks snarkle, I'll take a looks at 2.2. Sorry if I sounded like I expected you to make the addition to the script. I'm not very proficient with scripting myself, but I should have worded my question "Do you know if it is possible to modify the script to..." to see if you had tried it already and found it was not possible. I do appreciate you taking the trouble to change it!
 
Quote:
Originally Posted by Greg Jones View Post
Thanks snarkle, I'll take a looks at 2.2. Sorry if I sounded like I expected you to make the addition to the script.
No, no, I didn't feel like you were asking for a change. I was just trying to encourage you and anybody else reading this thread to be a little more daring, I guess. I wasn't sure if you'd already looked at the script, but hadn't been able to figure out what was going on, or if you were asking before looking.

Something else I did with the 2.2 version was added comments to almost every line of code, so that even people who've never seen the inside of an AppleScript script before should be able to figure out how it works.

After you've used it for a while, some other little tweak or addition might occur to you, and even if I'm perfectly happy to make the tweak, I might not get to it for, well, look how long it took me to do version 2.0! {rueful chuckle}
 
Thanks snarke. Just downloaded the version 2.2 after reading this thread. Sounds like a very useful script. I will give this a try and definitely take a look at the script. Have never done any Apple scripting before, but i do write UNIX shell scripts. I do hope that they are similar in nature. I like your attitude in encouraging others to try experimenting with Apple script. Thanks again.

Well, I tried version 2.2 and it doesn't work :( Had a peek at the script but couldnt figure out what was wrong. It will most probably take me a while to figure out what the syntax for apple script. Most probably version 3.3 will be out before i am able to grasp apple script. :o

Last edited by jetleets; 2008-12-10 at 11:57 AM..
 
Excellent... a sync script. I just got a phone that makes this worthwhile, so I've made a few adjustments of the iCal loop to correct task creation; when I ran this script, it just checked to see if the tasks were already in iCal, then called it a day. It's attached, for your guaranty-free amusement.
Attached Files
File Type: zip tasks to iCal 2.21.zip (31.1 KB, 338 views)
 
Thanks for writing and sharing this. 2.21 works ok for me. Just a little buggy with removal of tasks though, other than that working fine.
 
Thanks so much for taking the time to create and modify this script.

It should perform a function I would love to have. Unfortunately, it does not work for me on SL.

When I activate the script in OF, the OF window loses focus for a moment. No task is created in iCal.

When I run the script in Script Editor, I get the following under Events-Replies:

tell application "OmniFocus"
get document window 1 of default document
--> document window id -1 of document id "hVhsjymKO7z"
get value of selected tree of content of document window id -1 of document id "hVhsjymKO7z"
--> {task id "o0k6TcJW67m" of document id "hVhsjymKO7z"}
get name of task id "o0k6TcJW67m" of document id "hVhsjymKO7z"
--> "Primary Care MD: Jim Avery"
get note of task id "o0k6TcJW67m" of document id "hVhsjymKO7z"
--> "Jim Avery

Al Hurwitz, MD

Primary care recommendations from Edward Diao

Bill Anderick
Randy Chase

Jennifer Ross

Robert Margolin
Steven Fugaro Union St."
get due date of task id "o0k6TcJW67m" of document id "hVhsjymKO7z"
--> date "Tuesday, September 22, 2009 5:00:00 PM"
get flagged of task id "o0k6TcJW67m" of document id "hVhsjymKO7z"
--> true
get name of context of task id "o0k6TcJW67m" of document id "hVhsjymKO7z"
--> "Phone"
get completion date of task id "o0k6TcJW67m" of document id "hVhsjymKO7z"
--> missing value
get containing project of task id "o0k6TcJW67m" of document id "hVhsjymKO7z"
--> project id "oe1lXcRPH6f" of document id "hVhsjymKO7z"
get id of containing project of task id "o0k6TcJW67m" of document id "hVhsjymKO7z"
--> "oe1lXcRPH6f"
get name of containing project of task id "o0k6TcJW67m" of document id "hVhsjymKO7z"
--> "Single Actions: Personal"
end tell
tell application "iCal"
exists calendar 1 whose name = "OF:Remind"
--> true
get calendar 1 whose name = "OF:Remind"
--> calendar id "FF7EA48A-782E-4BCC-9BB5-AB1A0A3CA0DE"
exists todo 1 of calendar id "FF7EA48A-782E-4BCC-9BB5-AB1A0A3CA0DE" whose summary contains "Primary Care MD: Jim Avery"
--> false
end tell


It appears to me that the script is picking up the correct information from OF, but short circuits after finding that the To-Do does not exist in iCal.

Am I missing something?

Thanks!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Omni Plan 2.0 - Set baseline for selected tasks kavehantio OmniPlan General 0 2011-07-24 12:20 PM
Scripting: Using a selected range of tasks aleding OmniFocus Extras 6 2009-12-06 09:01 PM
can OF tasks show up in iCal (in the calendar not as tasks) msim iCal Sync 2 2008-02-12 06:33 PM
Get selected tasks with script? curt.clifton OmniFocus 1 for Mac 1 2007-06-10 05:43 PM


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


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