Export Perspective on Mac to readable text

You’re very welcome.

Some useful links from Apple:

Mac Automation Scripting Guide

OS X 10.10 Release Notes

OmniFocus scripting dictionary (Javascript) is available through Script Editor. It’s a good place to start familiarizing with OmniFocus methods and properties (Javascript).

You can execute it in Script Editor setting language to Javascript. Additionaly, with Keyboard Maestro (as you found out), Alfred, etc…


Script update: now handles more perspectives and it is a little more polished. It returns a string with a plain text representation of a perspective. It can be used to set the clipboard to this string with Keyboard Maestro (output of an Execute a Javascript for Automation), for example.

33%20copy

3 Likes

I must be doing something wrong. The javascript will not compile on 10.13 here: Error on line 101: SyntaxError: Unexpected token ','

Thanks for letting me know, @TheWart. It’s fixed, now. Does it work for you?

1 Like

Yes, thanks!

1 Like

works like a charm, kudos!
1 question though:

Can I use a variable as input for this script to:

  1. ask user for which perspective to output
  2. have the jsa script use that for the "const strPerspectiveName = ‘Checklists’ "

Do you have an idea about this?

Of course, one possible route would be through Keyboard Maestro.

OmniFocus 3 Perspective As Text.kmmacros

2 Likes

Kudos again! :-)

1 Like

Love possibility here. However, it prompts me as expected but only returns the Inbox items despite naming a stock or custom perspective.

I simply downloaded the macro and placed it in my enabled OmniFocus macro group, running it with the indicated shortcut.

Thanks for letting me know. I think it’s fixed. Does it work for you, now?

1 Like

It does, thanks! Could it be further tweaked to toggle the task notes on/off when run?

Far from my desk now but will look into it.

Received great ideas from user @draft8 on passing information between KM prompt for user input action and a Execute a JavaScript For Automation action and creating specialised versions of a function to allow options.

Just implemented task notes on/off toggle. Is this what you had in mind, @TheWart ?

2 Likes

Can you share the new link? Or is it still the same?

It’s the same link. I updated the file.

1 Like

So, so good! Thank you very much for all the tweaking!

1 Like

Can someone help to create a text file to a specific directory
thanks in advance

Could you give more details about your request ?

Sorry for being terse.
I want to use the script to generate few types of text files to display using Übersicht for inbox, due soon etc
Also the perspectives text output produces “-” which results in two lines (one regular and one strikethrough) when Übersicht displays.

would like a text file written as

of3inbox.txt

Task-A
Task-B
etc…
and same for Due Soon or Due Now and other perspectives.

thanks in advance and appreciate the help
regards

@narabharath, you can set the output of the Execute a Javascript For Automation action to a variable named, for example, perspectiveText.

Then, setting up a Write To File action, in this way:

Great thanks a lot. will give it a try ( I got it working by assigning to clipboard and back :)) yours is better. BTW is it possible to avoid the - in front of the tasks list created?