View Single Post
Quote:
Originally Posted by viellieb View Post
Being able to copy all of it's children without intend into the note field of the current selection would be perfect.
Well you could experiment with this ...

(as drafted it doesn't delete the child nodes, but the comments contain instructions for changing the value of a property to do that, if it's really what you want, and if you are really working with a disposable copy of well backed up work). Personally I think that scripts are best used for gathering and integration, and deletion is always best done manually …

Code:
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
-- OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-- IF YOU *REALLY* WANT TO DELETE THE CHILD NOTES AFTER CAPTURING THEIR TEXT
-- CHANGE THE VALUE OF THIS PROPERTY TO TRUE …
-- BUT *ONLY* EXPERIMENT WITH DISPOSABLE COPIES OF MULTIPLY BACKED UP WORK ...
property pblnReallyDeleteDescendants : false

tell application id "OOut"
	set lstDocs to documents
	if length of lstDocs < 1 then return
	
	tell first item of lstDocs
		set lstSeln to selected rows
		if length of lstSeln < 1 then return
		tell first item of lstSeln
			if has subtopics then ¬
				set its note to its note & return & return & my GetSubText(its children)
			set its note expanded to true
		end tell
	end tell
end tell

on GetSubText(lstChiln)
	tell application id "OOut"
		set str to ""
		-- CAPTURE THE TEXT
		repeat with oChild in lstChiln
			tell oChild
				set str to str & its topic & return & return & its note & return & return
				if has subtopics of it then set str to str & my GetSubText(its children)
			end tell
		end repeat
		
		-- AND THEN DELETE THE CHILDREN ? 
		if pblnReallyDeleteDescendants then
			repeat with i from length of lstChiln to 1 by -1
				delete item i of lstChiln
			end repeat
		end if
		return str
	end tell
end GetSubText

Last edited by RobTrew; 2012-11-08 at 02:32 AM..