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 > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
OO3 Move items script Thread Tools Search this Thread Display Modes
Hi, I have searched the web for an answer to this question and found nothing so I guess that the answer is obvious....

I wish to move ticked item rows to a different section in my document. I thought that changing the value of the ancestor topic might make the items move but it just changed the parent topic :

Code:
set the topic of ancestor of oneRow to "Completed Actions"
Any ideas of how to move the row to a new location and also to restrict the script to a section ?

Thanks
Simon
 
Yeah, as you've discovered, you're just renaming the parent with that construct, not assigning the child a new parent.

Have a look at the Move Completed Items script in the collection of Useful Scripts on the OmniOutliners Extras page: http://www.omnigroup.com/products/omnioutliner/extras/

One obvious way to restrict the scope of action would be to make it only work on the selected rows at the time of invocation.
 
I have had a look at the example script and have quoted part of it below along with my thoughts on what the code is doing. I would like to know if I am correct:
Code:
-- create the entry for today in the done document if it isn't already there
	if not (exists (last child of doneDoc)) then
		tell doneDoc
			make new row at end of rows
		end tell
	end if
I think he children of a OO3 document are its top level rows, a new document has no rows so has no "last child". If I'm correct then this block is saying "add a new top level row to the new document"

Code:
	set newRow to last child of doneDoc
	if dateString is not equal to (topic of newRow) then
		set newRow to make new row at end of rows of doneDoc
		set topic of newRow to dateString
	end if
This section compares the text value (topic) of the final section with todays date. If they are different a new row is added. The line "set newRow to make new row at end of rows of doneDoc" seems to be doing two actions the first is to add a new row to the document the second is to set that row to the variable newRow which allows the subsequent line to set the value to todays date.

Code:
	
	-- copy the checked items
	duplicate (every row of original whose state is checked and has subtopics of it is false) to end of children of newRow
newRow was created above and this code duplicates every checked row in the list document and pastes them into done.oo3 as children of newrow
Code:
	delete (every row of original whose state is checked and has subtopics of it is false)
	set expanded of newRow to true
Looking at this code am I correct in thinking that OO3 does not associate rows with other rows other than by their position and level in the list. My code in the original post failed to work in the way I expected because the section headers are not containers in any way and have no knowledge of the rows under them in the document? In order to move a row to a new position in the document I need to write code that locates where the target section is and set a variable to that section. Code can then add new rows as children this row as described above.

Am I alone in finding Applescript both powerful and obscure? The ability to duplicate every selected row in a single command is powerful but I would have never found the command or understood it from reading its dictionary entry.

Thanks for the steer to the example script.

best wishes
Simon
 
Just in case anyone is interested I posted details of my latest ToDo list in the general OO forum pages.


http://forums.omnigroup.com/showthread.php?t=22357
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot move items in gantt timeline mexx OmniPlan General 0 2013-05-06 12:52 AM
Move Inbox Items to Folders w/o Mouse Geordan OmniFocus 1 for Mac 5 2011-02-01 09:55 AM
script to make an inactive project active and move it to a selected folder kingsinger OmniFocus Extras 2 2010-11-15 08:52 PM
How to edit "Move Completed Items" helpful script rogbar OmniOutliner 3 for Mac 2 2009-11-03 01:08 PM
Script to Move Checked Items to Another Section? bimden OmniOutliner 3 for Mac 0 2006-09-23 04:33 AM


All times are GMT -8. The time now is 05:35 AM.


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