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
For people who don't have to sync OF tasks to any device via iCal the implemented syncing of all OF tasks to iCal seems to me pretty useless: To overcrowd iCal's todo list with all your OF tasks which are organized in a much better way in OF itself provides no benefit and creates redundancy.
On the other hand I have a couple of tasks in my OF projects which can be regarded as urgent or hard landscape tasks. These tasks I'd like to see in my hard landscape calendar. I also would like to set reminders for these tasks.

Therefore I wrote two scripts to send selected OF tasks to iCal. The first script sends one single task to a previously specified iCal calendar. The second one syncs all flagged tasks with iCal. For those who aren't afraid of nagging reminders both scripts offer the possibility to have set alarms for future todos automatically.
In both scripts OF URL linking is implemented.
(These are the first apple scripts I ever wrote, so I think the script codes aren't very smart. Perhaps someone could help me to optimize these scripts?)
Attached Files
File Type: zip Task to iCal.zip (10.9 KB, 1223 views)
File Type: zip Flagged to iCal.zip (8.1 KB, 1137 views)
 
Oops! - I forgot to mention that you have to open the scripts in scripteditor to find some configuration instructions.
 
Quote:
Originally Posted by uku View Post
Therefore I wrote two scripts to send selected OF tasks to iCal. The first script sends one single task to a previously specified iCal calendar. The second one syncs all flagged tasks with iCal.
How incredibly useful. Thank you. I never sync to iCal because there is no selection available. This works well for me.
 
Quote:
Originally Posted by uku View Post
(These are the first apple scripts I ever wrote, so I think the script codes aren't very smart. Perhaps someone could help me to optimize these scripts?)
Clever and handy! I like them.

I've rewritten your "Task to iCal" script. It's gone from 126 lines of code to 50. :) I took out unnecessary intermediate variables, converted all the variables holding parts of the highlighted task into a record, and un-nested the redundant "if" statements in the "iCal" section.

I think a fair argument could be made that changing this
Code:
	set theNewTask to the name of theSelectedTask
	set theNewNote to the note of theSelectedTask
	set theNewDueDate to due date of theSelectedTask
	set hasFlag to flagged of theSelectedTask
into this
Code:
set newTask to {name:name, TaskNote:note, TaskDueDate:due date, IsFlagged:flagged} of theSelectedTask
isn't inherently an improvement, since it means that later on, this
Code:
if theNewDueDate is not missing value then
becomes
Code:
		if TaskDueDate of newTask is not missing value then
but the reason I did that was it makes it much easier to create a list of new tasks, so you could highlight multiple tasks in the context window, invoke the script, and have all of them transferred to iCal at once.

I even wrote the code to collect multiple tasks. I did not rewrite the second half of my replacement script to install the multiple tasks: it will only do the first one. Why? Because I've already frittered away more than a couple hours on this, and I'm supposed to be doing other stuff. I might get back to it; you might finish the job before I do and repost it, thus saving me the effort. :)

I didn't look at your second script, but I hope you can see various tricks and techniques from this script that you could apply there as well.
Attached Files
File Type: zip new Task to iCal.zip (7.2 KB, 946 views)
 
I couldnt get the "improved" script to work, but the originals posted worked like a charm. A much needed capability in OmniFocus.

Thanks
 
My apologies for "improving" the script in an unfunctional way. I wonder why this bug took four months to appear. Possibilities: (1) It's very specific to Benn's situation/configuration. (2) It just appeared due to a recent change in OmniFocus. (3) Nobody else has bothered to try the revised version. (4) Lots of people have had the revised script fail, but nobody else bothered to report it. (5) Nobody else has been downloading the scripts in the first place.

I'd hate to leave a buggy script online if (2) or (4) are the case, but I don't want to invest the time if (3) or (5) are true. Sounds like Benn's satisfied with his solution of just using the original scripts, so if it's (1), I'm also off the hook. Guess I'll see if any other comments get posted.
 
Can anybody tell me how to use these 2 scripts from uku, please? Thank you very much in advance.
 
Quote:
Originally Posted by snarke View Post
My apologies for "improving" the script in an unfunctional way.
You apparently forgot to remove/comment out the line that reads "return newTaskList" (which was presumably there for debugging purposes). I eliminated that line and it works.

-Steve
 
Any update on this one? Just started using onminfocus for desktop and iPhone and i'd love to be able to set a default alert on iCal
 
Quote:
Originally Posted by Shotster View Post
You apparently forgot to remove/comment out the line that reads "return newTaskList" (which was presumably there for debugging purposes). I eliminated that line and it works.

-Steve
You hit the nail on the head.

OK, OK, due to, well, not "overwhelming demand," but at least a few inquiries, and a certain amount of trying-to-avoid-other-things on my part, here is a 2.0 version of the script, with rather a lot of changes.

First of all, I fixed the aforementioned bug. {wink} Also, I have riddled it with comments. For example, somebody asked uku "Do you know if there's a way to edit this script so that the to-do does NOT contain the note and URL? I just want those fields to be left blank." It should be quite easy for anybody who wants the script to do less than it currently does to just double-click the script icon, and delete the parts that do what they don't want to have happen.

I added the second half of the code for multiple items. So, if you option-click to select multiple tasks in an OF window, then run the script, all the selected tasks will be copied to iCal.

If there are NO tasks selected when you run the script, then it will instead become the "Flagged to iCal" script, copying all flagged tasks in OF into iCal. Well, it will specifically get all tasks that are flagged, are not blocked, and are not completed.

And I've also bundled in a bonus script, called "OmniFocus Script Installer." While "tasks to iCal 2.0" has been saved as a regular script, the Script Installer is an applet. When you double click it, it will copy all script files (specifically, all files that have an extension of .scpt) that are in the same folder over to the appropriate folder for appearing in the scripting menu. (It copies the files to ~/Library/Scripts/Applications/OmniFocus, or to be very specific, to the 'OmniFocus' folder of the 'Applications' folder of the scripting folder in the user's domain, wherever that happens to be.) This little applet also switches on the scripting menu in the menu bar.

If anybody finds any more bugs or problems, go ahead and post them. I'll probably get them fixed and a revised version up here in, oh, another 14 months. :eek:
Attached Files
File Type: zip tasks to iCal 2.0.zip (28.9 KB, 537 views)
 
 


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 03:31 PM.


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