[QUOTE=curt.clifton;62141]those nodes have name properties, but if you take the name [I]of the value[/I] of such a node you get an error.[/QUOTE]
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 [/CODE] 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. |
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=henri;70507]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).[/QUOTE]
You would have to modify these two lines (from version 0.7.1 on [URL="http://www.rose-hulman.edu/~clifton/software.html"]my software page[/URL]): [CODE] duplicate (value of item 1 of theSelectedItems) to after last section set duplicatedItem to last section [/CODE] 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. |
[QUOTE=curt.clifton;70510]You would have to modify these two lines (from version 0.7.1 on [URL="http://www.rose-hulman.edu/%7Eclifton/software.html"]my software page[/URL]):
[CODE] duplicate (value of item 1 of theSelectedItems) to after last section set duplicatedItem to last section [/CODE]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.[/QUOTE] 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 [/code]--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 [/CODE] Good luck! Cheers, Curt |
Success! It turned out to be easier than I thought, once inspiration struck:
[code] set duplicatedItem to selectedItem [/code] 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 |
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.
|
All times are GMT -8. The time now is 06:13 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.