The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniOutliner > OmniOutliner 3 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Applescript help: Section copy Automating Thread Tools Search this Thread Display Modes
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
 
Quote:
Originally Posted by ptorngaard View Post
But I cannot figure out how to copy a section from a different part of the document
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
 
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
--

Last edited by RobTrew; 2011-02-01 at 08:08 AM.. Reason: pruning redundancy :-)
 
Thanks RobTrew - works like a charm :-)
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem: copy as applescript | osascript - gshenaut OmniGraffle General 7 2013-01-30 02:16 PM
applescript to copy an OmniGraffle graphic? supertwang AppleScripting Omni Apps 3 2011-12-08 09:56 PM
Glitch in: Edit > Copy As > AppleScript RobTrew OmniGraffle General 0 2010-04-15 08:11 AM
AppleScript automating creation of Finder & Mail folders omnibob OmniFocus Extras 4 2009-07-20 12:25 AM
Automating OO3 --> OG outline diagramming RobTrew OmniGraffle General 0 2008-04-12 03:33 AM


All times are GMT -8. The time now is 12:56 AM.


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