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)
-   -   Applescript help: Section copy Automating (http://forums.omnigroup.com/showthread.php?t=19961)

ptorngaard 2011-02-01 05:21 AM

Applescript help: Section copy Automating
 
Keeping different standard meeting minutes in OO where the meetings has a standard agenda I'd like to do the following:

* Open the document that has the minutes for a specific meeting.
* Click the button backed by a applescript that makes a new section with a date stamp and heist that section. Script would copy the section in the document named 'Template' into the newly created section.

I have the first part of the script that created that section with the date stamp. But I cannot figure out how to copy a section from a different part of the document.

Here is the code - but cannot get the template copied.

[CODE]
set _today to current date

tell application "OmniOutliner Professional"

set resp to display dialog "Activity" default answer "" buttons {"OK"} default button 1
set entryTitle to text returned of resp


tell front document
unhoist
set tt to every child whose value of cell "Type" is "Template"
log children of tt

make new row at end of rows
set selected of every row to false
set selected of last row to true
set value of cell "Date" of selected rows to _today
set value of cell "Topic" of selected rows to entryTitle
hoist first selected row

duplicate every row of tt
end tell

end tell
[/CODE]

RobTrew 2011-02-01 07:17 AM

[QUOTE=ptorngaard;92563]But I cannot figure out how to copy a section from a different part of the document[/QUOTE]

Something along these lines, for example.

[CODE]set _today to current date

tell application "OmniOutliner Professional"
set entryTitle to text returned of (display dialog "Activity" default answer "" buttons {"OK"} default button 1)
tell front document
unhoist
try
set rowTT to first row where value of cell "Type" contains "Template"
on error
return
end try

set selected of rows to false
set rowNewDay to make new row at end of rows
tell rowNewDay
set selected to true
set value of cell "Date" to _today
set topic to entryTitle
hoist
duplicate children of rowTT to after children
end tell
end tell
end tell[/CODE]

RobTrew 2011-02-01 07:50 AM

or, trading clarity for parsimony:

[CODE]tell application id "com.omnigroup.OmniOutlinerPro3"
tell (make new row at end of rows of front document)
set {value of cell "Date", topic} to ¬
{current date, text returned of (display dialog "Activity" default answer "" buttons {"OK"} default button 1)}
duplicate children of (first row of parent where value of cell "Type" contains "Template") to after children
hoist
end tell
end tell[/CODE]

[COLOR="White"]--[/COLOR]

ptorngaard 2011-02-01 10:13 PM

Thanks RobTrew - works like a charm :-)


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

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