So here's the code I cobbled together from other examples; I made a script that will expand notes of all selected tasks, and if none are selected it expands the notes on all of them.
Code:
ell application "OmniFocus"
-- set note expanded of selectedItem to true
tell document 1
tell (first document window whose index is 1)
-- check to see if there is a selection or not
set SelectionV to selected trees of content
-- display dialog (count of SelectionV)
if (count of SelectionV) = 0 then
--display dialog "no selection"
set SelectionV to trees of content
-- handle first node
repeat with i from 1 to (count of SelectionV)
set note expanded of item i of SelectionV to true
end repeat
-- now handle descendants
set dTree to descendant trees of content
repeat with i from 1 to (count of dTree)
set note expanded of item i of dTree to true
end repeat
else
--display dialog "there are selections."
-- set SelectionV to trees of content
set SelectionV to selected trees of content
repeat with i from 1 to (count of SelectionV)
-- set ItemV to value of item i of SelectionV
set note expanded of item i of SelectionV to true
end repeat
end if
end tell
end tell
end tell
Thanks to everyone who posts code here, i couldn't have figured this out without your help.
-Robert