OmniFocus & Focus

I wish to have a macro copy an OmniFocus action as TaskPaper, extract the estimated duration from the resulting text, and use that value in a URL to be handled by another app (Brad Jasper's Focus).

Focus handles URLs. For example, you can send

focus://focus?minutes=20

and Focus will start a 20 minute session.

Copying the TaskPaper text is very easy (there's an OmniFocus menu command). The result looks like:

  • Do the thing. Comment: @flagged @estimate(20m) @tags(tagA,tagB)

I think some regex should be able to extract the "20" from that. Then I imagine simply storing that text (i.e. the "20") in a KM variable and passing it to the production of a new "Open a URL" command.

But I'm afraid the regex and variable handling are beyond my KM expertise at present. Any solutions would be much appreciated.

I got it! Finally figured out that I needed egrep rather than grep in the Execute Shell Script action. And I've had trouble with variables before, but I tried literally the most straightforward possible thing and it worked. If anyone happens to be interested in the macro I can share.