Export outline to OmniFocus project on iOS - tips?

I’m currently using OO3 on iOS and noticed that Dragging and dropping between OmniFocus and OmniOutliner is pretty rock solid in both directions.

OO3 is in fact now far superior to OF2 in terms of general editing and so I’d like to use OO to create projects/templates and then export to OF when I’m done.

Which brings me to my question - is this possible with OmniOutliner automation?

Having looked at the documentation here I found a sample that exports an outline as a text attachment to an email, but I can’t find how to bring up a share sheet or fire an OmniFocus URL. I’m also not sure if the format would be correct as when I perform a similar operation with the Editorial app, it requires the exported text to be in TaskPaper format.

Anyone tinkered in this area yet?

Thanks

Here’s an example of how to call a URL to run a workflow that uses the contents of the clipboard. It’s from the OmniOutliner page on scripting the pasteboard: https://omni-automation.com/omnioutliner/pasteboard.html

editor = document.editors[0]
editor.copyNodes(editor.selectedNodes, Pasteboard.general)
urlStr = ‘workflow://run-workflow?name=Clipboard%20to%20PDF&input=clipboard’
URL.fromString(urlStr).call(function(msg){})

The Omni Automation scripting support in OO can retrieve most data from a document, so that shouldn’t be an issue. And it should be able to insert data into URLs and then execute them.

Do you know the syntax of the OmniFocus URL you want to execute?

– SAL

P.S. Info concerning URLs in Omni Automation is here: https://omni-automation.com/shared/index.html

1 Like

Thanks, I’ll check that out.

(OMG Sal Soghoian just replied to me!!! Just breathe…)

1 Like

Woohoo!

Here’s all the pieces, your JavaScript

// Export clipboard
editor = document.editors[0];
editor.copyNodes(editor.selectedNodes, Pasteboard.general);
urlStr = 'workflow://run-workflow?name=ClipboardToOmniFocus&input=clipboard';
URL.fromString(urlStr).call(function(msg){});

And a workflow to create an OmniFocus project:

The text is exported in taskpaper format so all the indenting and structure are preserved. Moreover, if the document was created by dragging from OmniFocus in the first place, it has all the original flagged, context annotations etc, and they survive the round trip too.

:-)

Thanks!

1 Like

It’s like meeting a member of The Beatles!

1 Like

Just saw a twitter post about this with a full working solution bundled as an OO plugin:

https://omni-automation.com/omnioutliner/app-to-app-04.html

I’ve installed this on macOS but the script title is ghosted out under the Automation menu. Have you got it to work?

I think the call method it’s not opening the URL in macOS. In iOS, works as expected.

As a test, I tried running this line on macOS OO Automation Console and the URL does not open.

URL.fromString('https://omni-automation.com').call(function(result){})

@Sal, do you think this code is correct ?

I believe it is a bug related to changes in macOS. The Omni team is aware of the issue.

2 Likes

The script is designed to work when a single top-level item is selected. Otherwise it will be disabled.

I’ve just tried this script on iOS and it worked perfectly. I think it’s easier on iOS than macOS. Never thought that would happen!

Love this. But it feels a little strange that it takes a js plugin to achieve what really should be possible natively on IOS. Drafts and Workflow often offer greater flexibility than inter Omni app workflows themselves. I know this isn’t for want of trying on Omni’s part (soo glad that Sal is on board to save the day).

Luckily, it seems that IOS 12 finally has a pot of gold at the end of the rainbow for auto-omni folk (can’t wait to see how Workflow develops under Apple ownership).

On another note, great to see you on Triangulation last week Sal, from the sounds of things you had so much to share that we’re going to be treated to second servings this weekend. :)