The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Selected Tasks to iCal (http://forums.omnigroup.com/showthread.php?t=5089)

uku 2007-10-06 03:35 AM

Selected Tasks to iCal
 
2 Attachment(s)
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?)

uku 2007-10-06 03:46 AM

Oops! - I forgot to mention that you have to open the scripts in scripteditor to find some configuration instructions.

dhm2006 2007-10-11 11:38 AM

[QUOTE=uku;22357]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.[/QUOTE]

How incredibly useful. Thank you. I never sync to iCal because there is no selection available. This works well for me.

snarke 2007-10-12 01:56 PM

Suggested alternative script
 
1 Attachment(s)
[QUOTE=uku;22357]
(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?)[/QUOTE]

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
[/CODE]
into this
[CODE]set newTask to {name:name, TaskNote:note, TaskDueDate:due date, IsFlagged:flagged} of theSelectedTask
[/CODE]
isn't inherently an improvement, since it means that later on, this
[CODE]if theNewDueDate is not missing value then[/CODE]
becomes
[CODE] if TaskDueDate of newTask is not missing value then
[/CODE]
but the reason I did that was it makes it much easier to create a [I]list[/I] 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.

benn stratton 2008-02-28 05:13 PM

I couldnt get the "improved" script to work, but the originals posted worked like a charm. A much needed capability in OmniFocus.

Thanks

snarke 2008-03-03 09:00 AM

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.

9dragon 2008-03-06 04:05 PM

Can anybody tell me how to use these 2 scripts from uku, please? Thank you very much in advance.

braver 2008-03-12 08:26 PM

How one is supposed to invoke these scripts?

Craig 2008-03-13 05:54 AM

[QUOTE=braver;34395]How one is supposed to invoke these scripts?[/QUOTE]

[url]http://forums.omnigroup.com/showthread.php?t=7453[/url]

connie 2008-03-15 03:53 AM

script deleting calendars and returning an error message
 
Do I need to edit the script? Can't seem to get the script to work. It deletes all the names of my calendars in ical and gives me the following message:

Apple event handler failed:
make calendar with properties {name:CalendarName, writable:true, color:defaultRGB}

thanks!


All times are GMT -8. The time now is 01:50 PM.

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