How Do You Write to the Note of the PREVIOUS Row?

Hello,

I have lots of very large files that look like this:

I’m new to AppleScript and I can’t figure out how to move the location information into the note of the row above. It doesn’t look like I can use preceding sibling. Whenever I try, it operates on ALL preceding siblings at once. I haven’t had any success with things like currentRow - 1 either. Any help would be deeply appreciated.

You can try this. As always best to test on a sample doc first.

tell application id “OOut”
set d to document 1
tell d to repeat with i from (count children) to 1 by -1
tell child i
if topic contains “LOCATION:” then
set d’s child (i - 1)'s note to topic
delete
end if
end tell
end repeat
end tell

I really appreciate the suggestion, SGIII, and I apologize for not checking the forum sooner. Unfortunately, your code doesn’t run in OS X 10.11.4 as is. It will run if I change the first line to tell front document of application "OmniOutliner Pro" but will crash at line two with the following error:

“OmniOutliner Pro got an error: Can’t get document 1 of document 1.”

Did you mean row 1? After setting it to row 1 it doesn’t crash but it doesn’t do anything else either.

If your app is named “OmniOutliner Pro” then try changing just the first line to:

 tell application "OmniOutliner Pro"

Leave the rest of the script as is and see if that works in your version.

(I’m on 10.11.4 and my app is named “OmniOutliner” so in the first line I could also use this: tell application “OmniOutliner”.)

SG