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 Search Today's Posts Mark Forums Read

 
Populate Template Placeholders, 0.6.1 Thread Tools Search this Thread Display Modes
Quote:
Originally Posted by curt.clifton View Post
those nodes have name properties, but if you take the name of the value of such a node you get an error.
A helpful distinction - I hadn't noticed.

Odd that the value fails to pass that property through - Bug ?
 
Not sure if this is a bug or just an inconsistency. Here's a script that demonstrates the issues (which I'll also send to the ninjas):

Code:
(* 
	Run this script with one of the built-in sidebar items selected (e.g. No Context 
	or Context in context mode, or Inbox or Library in planning mode).  The fourth
	set will yield an error.  Run it again with a project, context, or folder selected
	and everything is fine.  
	
	In the first case, bar is set to something like:
		value of tree 2 of sidebar of document window id 60308 of document id "jwv2Yzh3ZwG"
	
	In the second case, bar is set to something like: 
		project id "o-8rLx0w-T7" of document id "jwv2Yzh3ZwG"
	
	(To see this, run the script from Script Editor with the Event Log showing.)
*)
tell application "OmniFocus"
	tell document 1
		tell document window 1
			set foo to item 1 of selected trees of sidebar
			set bar to value of foo
			set blah to name of foo
			set baz to name of bar -- unexpected error
		end tell
	end tell
end tell
There seem to be a couple of issues. The sidebar in planning mode has properties "library" and "inbox", which return objects of class "library tree" and "inbox tree" respectively. These classes are subclasses of "tree", which has a "value" property. But it's unclear what "value" should return for these. Perhaps just the tree itself again?

Another inconsistency is that the sidebar in context mode doesn't have properties for No Context and Contexts, which it seems like it might in analogy with planning mode.
__________________
Cheers,

Curt
 
How would I modify the script so that the new project appears in the same folder as the template? For me it would be very helpful to set things up this way, because I'd like to keep the templates in the appropriate folders, (instead of putting them in a template folder).

Thanks in advance.

--Henri
 
Quote:
Originally Posted by henri View Post
How would I modify the script so that the new project appears in the same folder as the template? For me it would be very helpful to set things up this way, because I'd like to keep the templates in the appropriate folders, (instead of putting them in a template folder).
You would have to modify these two lines (from version 0.7.1 on my software page):
Code:
duplicate (value of item 1 of theSelectedItems) to after last section
set duplicatedItem to last section
Change the first line to specify the location of the duplicate relative to item 1 of theSelectedItems, which is the project being duplicated. Change the second line to capture a reference to the duplicate.
__________________
Cheers,

Curt
 
Quote:
Originally Posted by curt.clifton View Post
You would have to modify these two lines (from version 0.7.1 on my software page):
Code:
duplicate (value of item 1 of theSelectedItems) to after last section
set duplicatedItem to last section
Change the first line to specify the location of the duplicate relative to item 1 of theSelectedItems, which is the project being duplicated. Change the second line to capture a reference to the duplicate.
I'm afraid I need more help. I don't know enough AppleScript to know what to put after the "to"s...

--Henri
 
Here is what I tried. It seems the first line works, but the second doesn't:

Code:
        duplicate (value of item 1 of theSelectedItems) to after selectedItem
        set duplicatedItem to item after selectedItem
--Henri
 
Henri,

I'd have to implement it myself to get the second line exactly, and I'm afraid time doesn't permit that right now. You might try something like:

Code:
set duplicatedItem to item 1 of following siblings of selectedItem
Good luck!

Cheers,

Curt
__________________
Cheers,

Curt
 
Success! It turned out to be easier than I thought, once inspiration struck:

Code:
  set duplicatedItem to selectedItem
Once the item is duplicated, I can use the original as the duplicate, if you know what I mean.

Anyway, this is an awesome script! It saves a lot of work entering dates. Thank you so much.

--Henri
 
Doh! <slapsHead />

Very elegant. Nicely done.

Cheers,

Curt
__________________
Cheers,

Curt
 
One more refinement to this super-useful script: anyone (Curt?) know how to change the review frequency of a project via scripting? As it stands now, my defaults are to review templates every three months, and projects every three weeks. I'd love to change that property of a project accordingly after I've created it with this script.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate Template Placeholders script Not filling placeholders Tim1 OmniFocus 1 for Mac 2 2013-03-11 03:32 PM
Adding Due and Start Dates for Populate Template Placeholders jessicatmt OmniFocus Extras 1 2012-08-06 10:05 PM
'Populate Template Placeholders' could not complete. Solana OmniFocus 1 for Mac 5 2012-03-21 09:53 AM
Curt Clifton's Populate Template Placeholders bcap OmniFocus Extras 1 2011-02-17 09:31 PM
Populate Template Placeholders Script problem Danoz OmniFocus Extras 8 2007-09-11 03:34 AM


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


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