The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Script: FoldingText to OmniFocus Thread Tools Search this Thread Display Modes
FoldingText is a very quick and fluid outliner (in the Markdown idiom, with a powerful XPath-modelled filtering engine beneath the hood, and a scripting interface to use it with).

I find it an unusually good environment in which to think and write, and in which to quickly outline and reorganise a project before committing it to OmniFocus.

Here is an early draft of a script which exports a sub-tree from FoldingText to OmniFocus, avoiding any duplication, and reporting (through Growl or an Applescript dialog) on the existing matches which it has found, and on any new Folders, Projects and Tasks which it has created in OmniFocus.

Usage:
  • In FoldingText, place your cursor in the first line (the top level line) of the outline which you wish to export to OmniFocus,
  • run this script,
  • and exercise a little patience – creating tasks through Applescript works well, but can never be fast.
  • In a while, a report will appear …

Approach:
Which levels of the FoldingText outline will be treated as folders, and which as projects and tasks ?

The first line in the outline which ends with FoldingText's special .todo tag will be interpreted as a project. Any ancestors of this line will become nested folders in OmniFocus, and any descendants will become nested tasks.

Outlines which contain no .todo tag will be interpreted as projects - the top level line will be exported as a project, and its descendants as nested tasks.

Non-duplication. The script checks to see whether the outline, or part of it, is already in OmniFocus. If it finds any existing matches, it will add any new material, but will not duplicate. The report at the end gives counts of objects found and created.
Note:
For reasons internal to the OmniFocus Applescript interface, when the script is updating an existing set of nested tasks in OmniFocus, any existing task which gets new children will initially be collapsed rather than expanded in the GUI, so you may not immediately notice the new additions :-)
Feedback:
Very much a first draft, so test it cautiously with toy data, until you get a sense of how it works. Bug reports and suggestions welcome.
Update:
  • I have updated this script to a version which also offers exports to OmniOutliner or OmniGraffle, so it now starts with a menu of three export targets.
  • Anyone who prefers to disable the menu and make three separate copies (giving each, for example, a different key assignment in Keyboard Maestro) can first edit pblnMenu, near the top of the script, to false, and then set plngTarget to one of the three appropriate values. (See below).

Code:
property plngOFOC : 0 -- OmniFocus
property plngOOut : 1 -- OmniOutliner
property plngOGfl : 2 -- OmniGraffle

property pblnMenu : true -- IF FALSE, SKIPS MENU AND EXPORTS TO APP indicated by plngTarget (below)
property plngTarget : plngOOut
The current version is in a Github repository.

--

Last edited by RobTrew; 2012-12-25 at 02:49 PM.. Reason: Ver 018 - Link to Github version
 
Excellent! Works exactly as advertised.
Thank you very much.
 
In Ver .006 (above) you should now be able to select and export more than one outline at a time.
 
Rob, wonderful! Bridges two excellent tools.

Three suggestions: include a property to disable Growl. Instead of not finding Growl and simply moving on, the Applescript interpreter is opening it's pointless "where is it ..." dialog.

Second, perhaps someday the script could parse FT tags (@tag), interpret them as contexts if the line is a task, and assign the relevant context in OF. Ultimately, maybe parsing json-ish strings for start and due dates, such as:

{start:201210050800} and {due:201210101500} where time is the last 4 digits of the string, in 24 hr notation.

If a task in FT is checked done, then it probably shouldn't import into OF. Checking for doneness and ignoring it also makes the FT document more flexible (don't have to start a new .todo mode section, just append the existing lists).

Last edited by korm; 2012-10-05 at 01:39 PM..
 
Thanks for the feedback - that's very helpful.

Ver 007 above should, I think, use the Applescript dialog when Growl is not installed (and avoid the compile-time error message). Let me know if that doesn't seem to fix it.

Processing FT tags, including some form of date – yes, good thought, and that was at the back of my mind as something to do. I may look at my old TaskPaper parser to see how that handled things. I think it treated the first user-defined tag on the line as the context.

(And yes, a default of suppressing the import of @done lines sounds helpful – thanks)

Postscript - the built-in OmniFocus to TaskPaper exporter is (like my earlier scripts) using these conventions:
test date @flag @mins(15) @start(2012-10-05) @due(2012-10-07 17:00)
So by default I think I'll stick to them for FoldingText export/import.

--

Last edited by RobTrew; 2012-10-05 at 11:24 PM..
 
Quote:
Originally Posted by RobTrew View Post
test date @flag @mins(15) @start(2012-10-05) @due(2012-10-07 17:00)
So by default I think I'll stick to them for FoldingText export/import.

--
I'd suggest one other
@note(text)
which could go into the Note field of an OF action or OO3 list item. I tried this with a test FT script and if the "text" portion of @note is merely a standard Markdown link, then it would be pretty straightforward if the FT2OF parser could put that link into the note. I'm thinking something like this would be really useful for an FT-OF-DEVONthink toolset:

@note([ReadMe](x-devonthink-item://%3COF33248CED.6F073C46-ON85257A7F.0050FAC8-85257A8E.006AB107@faa.gov%3E))

For example, a DEVONthink triggered script applied to a smart group could write its own FT action plan, and add it to a group where I'm putting the annotations for those documents, and then Rob's script could nicely put the work plan into OF.
 
Can certainly add recognition of a @note() tag, destined for OmniFocus/OmniOutliner notes.

(FoldingText seems happy with long strings inside tag parentheses, though not with line breaks – tags can't span paras/outline-nodes)
 
Trying to run v 0.08 and get the following syntax error:

Can’t get application id "OGfl".

Have set:

property pblnMenu to "false"
property plngTarget to "plngOFOC"
 
If you don't have OmniGraffle on your system, you will need to edit the .applescript text version to comment out any functions containing references to application id "OGfl"

(i.e. ExportToOG() and DrawTree())

Once it is working, you can save an .scpt (compiled) copy.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script: Pasting from FoldingText Markdown to oo3 nesting and columns RobTrew OmniOutliner 3 for Mac 5 2014-05-11 10:34 AM
Copy OmniFocus selection in FoldingText format RobTrew OmniFocus Extras 2 2012-12-08 04:36 AM
Draft Script: Save as FoldingText RobTrew OmniOutliner 3 for Mac 2 2012-10-31 01:14 PM
Script: Export from a FoldingText outline to OmniOutliner RobTrew OmniOutliner 3 for Mac 0 2012-10-04 12:46 PM
Script: Export from FoldingText outline to OmniGraffle diagram RobTrew OmniGraffle General 0 2012-10-04 12:44 PM


All times are GMT -8. The time now is 07:25 PM.


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