Member
2007-11-14, 07:07 PM
OK Figured out how to pull the names from a column. I set the column to a popup and then can get the names from the enumeration. That snipet is here:
set enumcount to count of enumerations of column "Assigned"
set x to 0
repeat until x = enumcount
set x to x + 1
set enum_name to name of enumeration x of column "Assigned"
my rowCleanup(enum_name)
end repeat
Complete code is now:
tell application "OmniOutliner Professional"
tell front document
--- Clean up Topics of those I know of
set enumcount to count of enumerations of column "Assigned"
set x to 0
repeat until x = enumcount
set x to x + 1
set enum_name to name of enumeration x of column "Assigned"
my rowCleanup(enum_name)
end repeat
set enumcount to count of enumerations of column "Context"
set x to 0
repeat until x = enumcount
set x to x + 1
set enum_name to name of enumeration x of column "Context"
my rowCleanup(enum_name)
end repeat
repeat with theRow in every row
set theAssigned to value of cell "Assigned" of theRow
set theContext to value of cell "Context" of theRow
set theTopic to value of cell "Topic" of theRow
set theDuedate to value of cell "Due Date" of theRow
if theAssigned > "" then
set TheParent to the value of cell "Topic" of the parent of theRow
try
set theNewRow to make new row at end of rows of (first child whose topic is theAssigned) with properties {topic:theTopic}
on error
make new row at end of rows with properties {topic:theAssigned}
set theNewRow to make new row at end of rows of (first child whose topic is theAssigned) with properties {topic:theTopic}
end try
set value of cell "Project" of theNewRow to TheParent
set value of cell "Due Date" of theNewRow to theDuedate
end if
if theContext > "" then
set TheParent to the value of cell "Topic" of the parent of theRow
try
set theNewRow to make new row at end of rows of (first child whose first word of topic is theContext) with properties {topic:theTopic}
on error
make new row at end of rows with properties {topic:theContext}
set theNewRow to make new row at end of rows of (first child whose first word of topic is theContext) with properties {topic:theTopic}
end try
set value of cell "Project" of theNewRow to TheParent
set value of cell "Due Date" of theNewRow to theDuedate
end if
end repeat
beep
end tell
end tell
on rowCleanup(TheSection)
tell front document of application "OmniOutliner Professional"
set ThisSection to first child whose topic starts with TheSection
try
delete rows of ThisSection
on error
make new row at end of rows with properties {topic:TheSection}
end try
end tell
end rowCleanup