Omnifocus2-Tyme2-Fantastical2-Version2 ; )

Dear All,

I have updated my script to fit with the new update of Tyme 2. The script is now more powerful than ever!

###Features

From Omnifocus 2 to Tyme 2

  1. Select any number of any task (w/wo child/due date/estimated time), add the select task (if it contains no child) or all leaf task in its child (which means those contains no child tasks —representing all the single actions you can do.) to Tyme 2. [Caution: Please do not select both a parent and its child, it might lead to double adding of the child.] (The subtask feature is not accessible from the Applescript interface, so sorry, the task hierarchy can’t be reserved, but I believe my workaround above should be reasonable and usable).

  2. If the task contains any info, like estimated time/ due date, it will be pass to tyme 2. (notes won’t be passed since tyme 2 only allows notes in time records).

  3. If the parent project in omnifocus is not present in tyme 2, it will create one for you.

  4. You asked, I did it (with the modified applescript interface of tyme 2)! Completion status sync with Omnifocus (or Reminder.app, see the commented line in the tail of tyme2_applescript_hooks file.)

####From Tyme 2 to Fantastical 2
The update notes stated that Tyme 2 can two-way sync with iCal. unfortunately I can’t got that work and currently I’m mainly using fantastical. The scripts only implement one-way sync. But it should works fine and notes in time record also got synced.

Usage

See the README in github repository. Basically, add the two scripts to corresponding folder (you need to change the file extension to .scpt and open&save with Script Editor).

Github Repository

Continuing the discussion from Applescripts that made Omnifocus, Fantastical 2 and Tyme work together [time tracking]:

1 Like

By the way, can somebody suggest a way to hook the ‘completion status’ change in OmniFocus so that we can make the two-way sync of completion status possible?

1 Like

Hey lifeisfanIv,

great script! Can a direct sync between tyme2 and OF be done, without involving Fantastical2?

As for now, when you mark a task in Tyme2 as completed, the corresponding task in OF is still available. As much as I understand, one could, at least, get the name of the completed task in Tyme2, search for the name in OF and mark it completed (a crude solution, maybe there is a better one). I’ve done it similarly for projects and it works pretty good (assuming, the task name is saved in listItem):

tell application "OmniFocus"
tell default document
		--get list of flattened projects
    set projectList to (flattened projects whose name contains listItem and its completed = false)
          --THEN DO SOMETHING

Actually I’ve coded that part and it should work out of the box. And i mentioned it in the readme as “completion status sync”. Currently the sync is only one-way: you mark a task as done in tyme, and you get the omnifo mark that task done too. The reverse is currently not easy to implement since no hook is provided by OmniFocus.

Strange, it is not really working here… Is it for single tasks, or only on the project basis - so I have to complete the whole project in Tyme2 to trigger it?

P.S.: Sorry, completely my fault. I’ve used the default hooks file for Tyme2… Now it works, thank you for your work.

1 Like

Hey just logging in to say thanks! It’s been working nicely so far!

1 Like

Could someone remind me how to add a button in the OmniFocus toolbar. I tried:

Customize Toolbar and drag the applescript, but that didn’t work.

Thanks

Hi, I tried to use the script but it pops up this message error:

“It is impossible to complete the operation. /Users/pietropaolomorrone/Library/Application Scripts/com.omnigroup.OmniFocus2.MacAppStore/Add to Tyme.scpt: execution error: Tyme2 found an error: Impossible to create a class ¬´class TAsk¬ª. (-2710)”

It happens only inside the Inbox

How can I fix it?

Thank you so much

Pietropaolo

Sorry I’ve been very busy with my term final… This bug seems to be caused by the void project name of inbox tasks. You can add a “if” statement to specify the “proj” variable to be “Inbox” when the task is in inbox. Or you can just begin timer only when you archived them to projects (like me)

The script works fine but this is the one I can´t make to work. If I complete a task in Time 2. How does it syn in omnifocus and changes the status to complete?

Sorry that I only got time recently to reply.
Basically you need to put the tyme2 hook AppleScript in the Application script folder
http://tyme-app.com/scripting2/

1 Like

hello @lifeisfanlv,

Thanks for your script, I had put the two script into the related folder as you mentioned in your website. The tyme2 -> omni sync works well, but when I tried to stop the timer, one error window just pop up, it says

Error Domain=NSPOSIXErrorDomain Code=2 “No such file or directory” UserInfo={NSURL=file:///Users/mmni/Library/Application%20Scripts/de.lgerckens.Tyme2/tyme2_applescript_hooks.scpt, NSLocalizedFailureReason=/Users/mmni/Library/Application Scripts/de.lgerckens.Tyme2/tyme2_applescript_hooks.scpt: execution error: Tyme2 got an error: The handler some object is not defined. (-1717)
}

I checked the “timerStoppedForTaskRecord(tskRecordID)” part in the script, it is the same as the one in your github repo. What I can do to solve the issue?

Thank you so much.

Do you mean that when you finish a task in omnifocus, Tyme 2 won’t stop the timer and show an error?

Hi, the situation happens when I tried to stop a timer. the error message popped up, but the timer itself is stopped.
and by the way, it seems the Tyme2 does not pass the record to Fantasitical2 too.

a quick update, I was trying to locate the problem in the tyme2_applescript_hooks file, then I found out that, even I commented out the content in the "if recordType of lastFetchedTaskRecord is equal to “timed” then " structure, the error still exists. Strange.

Just to check. What version of Tyme2 do you have?

Tyme2 Version 1.9.1 (1000)
OmniFocus 2.11.2
Mac OS X 10.12.16

I ask because I had some problems with version 1.9.1 (the same as yours). Whenever I tried to stop the timer, I got an error. You can try updating to the latest version (1.9.6).

Thank you for the suggestion here!
Actually I haven’t been using Tyme2 and Omnifocus 2 for a while now 😂thus unaware of such bugs…

Maybe later I’ll come back to this combo (after omnifocus 3 and multi-context is out), but for now I using Org mode http://orgmode.org/ for all those GTD stuff. Also would like to recommend to you guys ;-)

thanks, problem solved. I was trying Tyme2 before buying it in the APP Store.