INControl Functionality with Applescript?
Hello,
I have been looking at OmniOutliner and was trying to figure out if it had the ability to easily filter by a column, which it does not seem to natively do. INControl used to do this, which made it easy to filter items by date or by other category for quick reference. This was especially useful if creating an outline of to-do tasks. I was looking for a way to achieve this through Applescript or perhaps even Automator. I haven't looked much into what is available as far as funciton calls for either of these, but I was hoping someone might be able to point me in the right direction, or know of something pre-existing that would allow me to do this. Thanks. |
Filtering isn't possible in OO3, but it's a feature planned for OO4. I believe the only way you could simulate this with AppleScript is by copying all the items that meet your criteria to a new document.
|
Derek,
Can you provide an example of a script that would do that. I'd like to be able to copy the contents of items where an assigned column was assigned to a certain person. But I want all the other columns copied. Thanks in Advance, George |
Are you wondering how to set the data in additional columns? Or are you looking for a script that takes a blank document and adds the columns in?
If you're copying to a document that already has the columns set up, all you need to do so set column cell is something like: set value of cell "columName" of theRow to myData to add a column in you can do: make new column with properties {name:"new column"} |
[QUOTE=DerekM] Or are you looking for a script that takes a blank document and adds the columns in?
[/QUOTE] Close :) Actually, I'd like to find any row that has a column set to a particular persons name and then copy those rows to a new blank document. Does that make sense? |
So here's a rough script:
tell application "OmniOutliner Professional" set sourceDoc to front document set destDoc to (make new document) set columnList to columns of sourceDoc set columnCount to count of columnList repeat with i from 3 to columnCount -- starts at 3 to account for the note (#1) and topic (#2) column tell destDoc make new column with properties {name:name of item i of columnList as string} end tell end repeat tell sourceDoc repeat with myRow in every row if value of cell "Topic" of myRow contains "find me" then set value of cell "Topic" of (make new row at end of destDoc) to value of cell "Topic" of myRow repeat with j from 3 to columnCount set value of cell j of last row of destDoc to value of cell j of myRow end repeat end if end repeat end tell end tell This will always make a new document when run and it doesn't take into account column types |
Thanks Derek
Thanks Derek,
The script was very useful. I had "number" type columns so I had to make a few changes. I also tried to preserve the indenting, but note that all the parents of the "findme" row should also match, or else indenting will fail. [CODE] tell application "OmniOutliner Professional" set sourceDoc to front document set destDoc to (make new document) set columnList to columns of sourceDoc set columnCount to count of columnList repeat with i from 3 to columnCount -- starts at 3 to account for the note (#1) and topic (#2) column tell destDoc set newMe to (make new column with properties {name:name of item i of columnList as string}) if the type of item i of columnList as text is "number" then set the properties of newMe to {type:number} end if end tell end repeat tell sourceDoc repeat with myRow in every row if value of cell "Topic" of myRow contains "findme" then set value of cell "Topic" of (make new row at end of destDoc) to value of cell "Topic" of myRow -- copy the indenting from the sourceDoc set indentLevel to the level of myRow if indentLevel is greater than 1 then repeat with remainingIndents from 2 to indentLevel indent the last row of destDoc end repeat end if repeat with j from 3 to columnCount set value of cell j of last row of destDoc to value of cell j of myRow end repeat end if end repeat end tell end tell --This will always make a new document when run and it doesn't take into account column formatting [/CODE] |
All times are GMT -8. The time now is 11:07 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.