I have an OmniOutliner Pro document with the following children/subchildren:
A
1
2
3
B
C
The script (below) takes a string from LaunchBar and then shows a prompt of the document’s rows (A,B,C), adding the string to the chosen row in OmniOutliner Pro. However, if I select ‘A’ from that first prompt I want the script to show me a second prompt with the children of ‘A’ (1,2,3). If you look at the script, there is a note that reads “–NOTE: The script seems to ignore the rest…” This is where the script seems to ignore my attempt to bring up a second prompt if ‘A’ is selected.
Could anyone suggest any solutions to make the second prompt come up? I am rather unskilled in this area.
Thank-you kindly,
Matthew
on handle_string(theString)
– theString is the text in Launchbar
-- Get the list of projects from OO
tell application "OmniOutliner Professional" to ¬
set projects to topic of every child in front document
-- Get a list of names of projects to append text items to
set userSelection to ¬
(choose from list projects with prompt ¬
¬
"Append to:" with multiple selections allowed)
tell application "OmniOutliner Professional"
set selectedRows to every child in front document
-- Same as above OO call, except we're
-- getting the rows here and not their topics
set newRows to {}
-- We use this later to
--select all the newly-created rows
repeat with r in selectedRows
if topic of r is in userSelection then
set newRow to make new row ¬
with properties {topic:theString} ¬
at beginning of children of r
set newRows to newRows & {newRow}
set expanded of every ancestor of newRow to true
--NOTE: The script seems to ignore the rest... (the following is just copied from above with slight changes to topic and first row)
else if topic of r is in userSelection and topic of userSelection is "A" then
-- Get the list of projects from OO
tell application "OmniOutliner Professional" to ¬
set projects to topic of (every child of (first row whose topic is "A")) in front document
-- Get a list of names of projects to append text items to
set userSelection to ¬
(choose from list projects with prompt ¬
¬
"Append to:" with multiple selections allowed)
tell application "OmniOutliner Professional"
set selectedRows to every child of (first row whose topic is "A") in front document
-- Same as above OO call, except we're
-- getting the rows here and not their topics
set newRows to {}
-- We use this later to
--select all the newly-created rows
repeat with r in selectedRows
if topic of r is in userSelection then
set newRow to make new row ¬
with properties {topic:theString} ¬
at beginning of children of r
set newRows to newRows & {newRow}
set expanded of every ancestor of newRow to true
end if
end repeat
end tell
end if
end repeat
end tell
end handle_string