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 > OmniOutliner > OmniOutliner 3 for Mac
FAQ Members List Calendar Today's Posts

 
Applescript to identify if a Row has Children? Thread Tools Search this Thread Display Modes
I'm sure I have seen this somewhere but can some one provide me with the an applescript snippet that will Identify if a certain row has children. What I am looking for is if a row is named Completed and it has items in it to use a namedstyle called "Greyed" to change is color.

Thanks in advance,

George
 
Code:
tell front document of application "OmniOutliner Professional"
		if (exists child of first selected row) then
			display dialog "yes"
		else
			display dialog "no"
		end if
end tell
 
Derek,

Thanks for the help. I ended up with the below. My goal was to get a number beside each Project. The last thing I would like to be able to do is automatically pull the name of each top level item. Right now I have to manually put each name in.

Any guidance there?

Script thus far........

tell front document of application "OmniOutliner Professional"
my SectionCounter("Invoicing")
my SectionCounter("Goals")
my SectionCounter("Read")
my SectionCounter("Notes")
my SectionCounter("Opportunities")
end tell

on SectionCounter(TheSection)
tell front document of application "OmniOutliner Professional"
set ThisSection to first child whose topic starts with TheSection
delete (rows of ThisSection whose topic = "" and has subtopics is false)
set SectionCount to count of children of ThisSection
if SectionCount = 0 then
set topic of ThisSection to first word of topic of ThisSection
else
set topic of ThisSection to first word of topic of ThisSection & " (" & SectionCount & ")"
end if
end tell
end SectionCounter
 
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
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Identify Folder in Search jakobox OmniFocus 1 for Mac 2 2012-05-28 10:31 AM
Identify which filter blocked what Handycam OmniWeb Feature Requests 1 2008-02-22 10:22 AM
defaults.plist vs identify as... tvalleau OmniWeb General 1 2006-08-15 02:14 PM
identify target="_blank" links eugene OmniWeb Feature Requests 3 2006-04-17 09:36 PM


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


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