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 > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Today's Posts

 
Applescript Duplicate command: how to use it? Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Hi,

I would need some help to use the duplicate command to duplicate a single task.

Here is what I got so far:
The [...] is the not relevant code that has been stripped out

Code:
property WForContext : "WFor"

tell application "OmniFocus"
	-- [...]
	tell front document
		tell document window 1
			set theSelectedItems to selected trees of content
		end tell
	end tell
	
	set theSelectedTask to value of item 1 of theSelectedItems
	
	set MyDoc to first document
	tell MyDoc
		-- [...]
		set contextList to complete WForContext as context maximum matches 1
		
		-- [..]
		set theWForContext to context id (id of item 1 of contextList)
		-- PROBLEM: what is the "to" arg expecting?
		-- (Arg that is optional according to the doc, but is expected by OF - Bug filled to support Ninjas)
		
		set theResult to duplicate (theSelectedTask) to (after last task) with properties {context:theWForContext}
		
		-- [..]
		
	end tell
	-- [..]
end tell
Any help would be greatly appreciated.
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
applescript to delete duplicate tasks jamesafoster OmniFocus Extras 1 2013-04-02 07:55 AM
reference of result of duplicate command in applescript? ericscheid OmniGraffle General 1 2012-09-05 10:25 PM
Duplicate Action (applescript request) steve OmniFocus Extras 7 2012-01-13 08:12 AM
AppleScript references with no set or command MLModel OmniOutliner 3 for Mac 1 2010-11-21 11:34 AM
duplicate the above row-- applescript? steve OmniOutliner 3 for Mac 2 2006-05-02 07:18 AM


All times are GMT -8. The time now is 07:30 AM.


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