The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniOutliner 3 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=9)
-   -   Redirecting command line output into OO (http://forums.omnigroup.com/showthread.php?t=11825)

ptorngaard 2009-04-03 05:09 AM

Redirecting command line output into OO
 
I'm looking for a way to run a UNIX command and get the output of the command into a new default document in OO with a specified name.

did spend some time looking at the CSV export feature and wondered if there would be a way to from command line do the same with import, best would be to just do the following:

$ unix command | insert_into_oo -d';' DocumentName

And then get a document that contained the number of rows identified by the number of ';' in the input stream, all populated with data related to the specific row.

whpalmer4 2009-04-03 03:03 PM

Seems like you ought to be able to do something like piping your command through tr to change the delimiter character to a newline and sending it into a file, then using osascript to tell OmniOutliner to open that file.

A rough example:
[code]
df | tr '\r' '\n' > /tmp/foobar.txt ; osascript -e 'tell application "OmniOutliner Professional" to open "tmp:foobar.txt"'
[/code]

In this example, it isn't necessary to use tr, of course, but pretend that it was sticking a '\r' at the end of each line as the delimiter. You didn't actually say that you wanted the document opened on the spot, but that's how you would do it. Note that you have to use the old-style Mac file path syntax, not the Unix variety -- don't repeat my earlier mistake! This could all be bundled up into a shell script if you plan on doing such things frequently.

ptorngaard 2009-04-05 01:25 PM

Thanks for the reply - did get another solution from one of colleague where I can direct the command straight into OmniOutline:

$ ls -l | perl -pe 's/\s+/\t/g; print "\n"' | open -f -a "OmniOutliner Professional.app"

whpalmer4 2009-04-05 11:29 PM

Certainly fewer steps than my approach! I'll caution that my trial with that version just now took my filenames with spaces and split them into multiple columns, something to be aware of if you aren't expecting it...


All times are GMT -8. The time now is 08:04 AM.

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