The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniOutliner 3 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=9)
-   -   An Applescript to convert a note to a child row… (http://forums.omnigroup.com/showthread.php?t=11157)

Cornelius 2009-01-26 10:13 AM

An Applescript to convert a note to a child row…
 
Hello

I'm using OmniOutliner with pretty big documents full of notes. In order to export these documents to a database software, I need to convert each notes to a child row. I searched in the Scripts Folder if there was a solution. I didnt find. I do not know how to write a script but I can learn. If someone could help me to do a such script or show me hints, It would be very nice.
Thanks for reading.

Best regards

Cornelius

Cornelius 2009-01-27 12:04 AM

How creating a child row and assign it a value
 
Hi there

I start writing an applescript but i'm not expert so I copy and paste some sample of code.

I'm at this point :

[CODE]tell application "OmniOutliner Professional"
set MyDoc to front document
repeat with MyRow in every row of MyDoc
if (length of (note of MyRow as string)) > 0 then
set MyNote to (note of MyRow as string)
make child row of MyRow

end if
end repeat
end tell
[/CODE]

I dont know how to make a child row and assign him a value.

Thanks for helping

DerekM 2009-01-27 01:13 PM

Try this:

[CODE]tell front document of application "OmniOutliner Professional"
repeat with MyRow in (every row whose note is not equal to "")
set NoteValue to note of MyRow
make new child at beginning of children of MyRow with properties {topic:NoteValue}

end repeat

end tell[/CODE]

I think this will create the child row in the correct location all the time

Cornelius 2009-01-28 12:51 AM

It works perfectly…
it's great. Thank you Derek.
your code is bright.
Big Thanks.

Now I have to delete the notes, I will try to do it by myself.

[CODE]tell front document of application "OmniOutliner Professional"
repeat with MyRow in (every row whose note is not equal to "")
set NoteValue to note of MyRow
make new child at beginning of children of MyRow with properties {topic:NoteValue}
end repeat
end tell


tell application "OmniOutliner Professional"
set MyDoc to front document
repeat with MyRow in every row of MyDoc
if (length of (note of MyRow as string)) > 0 then
delete note of MyRow
end if
end repeat
end tell[/CODE]

I do it this way in 2 times and it seems to work…
I try to put the delete command directly in the first loop but it gets errors…

Cornelius 2009-01-28 09:27 AM

One really cool function I discover… It's possible to give your scripts a cool Icon visible from the toolbar of OO by applying to the script himself an icon in the finder.

really cool stuff.


All times are GMT -8. The time now is 09:05 PM.

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