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

 
Applescript to move "maybe someday" projects to separate .ofocus file Thread Tools Search this Thread Display Modes
Anyone have any success in emulating the "copy" (or cut) and "paste" menu commands in OmniFocus, using Applescript?

Here's the background of what I'm trying to do...

I have a non-default .ofocus document (~/Documents/Projects/maybe someday.ofocus), where I keep my maybe someday projects. Yes, I know I could just keep them in my default omnifocus document, put them on hold, and hide them, but I use on-hold projects a little differently - I use them to maintain loose dependencies between projects, i.e. when a project blocks another (see this thread for more on how I do this). All projects in my default/main ofocus document represent some concrete commitment I've made for completion, even if they're on hold. I can be pretty fanciful with my maybe-someday projects, so there are a lot of them, and having them in my default document bogs down my review cycle (not to mention my MobileMe/iPhone sync). I recall that DA has a large number of maybe-someday projects, in comparison with those he considers active. Anyway...

I want to create a script to help with this part of my workflow. When I create or identify a project to which I have no concrete commitment to ever complete, I want to move the project to my "maybe someday.ofocus" document. The project may already reside in its appropriate sidebar folder, if I've clarified its meaning to me and its place (area of focus) in my life overall - so I want to preserve the parent hierarchy - I actually want to maintain (roughly) the same folder structure in both documents. Eventually I also want to script to move projects the other way - i.e., when a maybe-someday project gets some traction and I make a commitment to getting it done.

What I want to do is quite similar to what jharrison did in his cool Project Folder script, except, instead of opening (or lazily creating) folders on the filesystem, I want to lazily create the parent folders in the sidebar of the "maybe someday.ofocus" document, and put the moved project in the same spot there.

"Why not just drag them in?" If you've ever tried dragging anything from one ofocus document to another, you've probably noticed the weird thing that happens - all parent folders for the dragged item in the one document are created in the other, but they're created flat - as siblings at the top level - and the project also winds up at the top level. Obviously a bug, but I'd rather do this via a script anyway - I need to be able to sling maybe-someday projects out of the way quickly to keep the (daily) review as slick and quick as possible. Mousing and dragging are too slow, so I want to assign a keystroke (i.e. using FastScripts).

I've gotten started and have made some progress. I'm able to lazily create the parent folder structure in the "maybe someday.ofocus" document. However, when it comes to actually creating the project there, I'm at a crossroads...

  • I'd hoped to be able to use the "duplicate" command, but it doesn't work across ofocus documents (an error dialog appears specifically saying that it isn't supported).

  • When I select a [set of] project[s] in OF, and press Cmd-C, then go to the maybesomeday.ofocus document and press Cmd-V, it does exactly what I want - the whole project[s], including notes, child tasks, and groups, are pasted. The trick is doing this programmatically using Applescript. I've messed around with using the pbcopy command and "set the clipboard". It's pretty fussy about object types, and I get unhelpful error messages like:
  • "Can't make some data into the expected type" (on paste operation)
  • "Canít make project id "hWcay7__OP4" of document id "kWSTxCKhYfE" into type project."
  • "Can't make {specifier:project id "hWcay7__OP4" of document id "kWSTxCKhYfE"} into type specifier."
I'm not done exploring this yet, but I've been having trouble finding examples of using the clipboard for anything but text. I've thought of using AppleScript to activate the document windows in order and invoke the keystrokes to do the copy/paste - I may try this, but it feels a little dangerous.

  • could reconstruct the graph of data for the project using AppleScript - I'm willing to slug it out and write the code recurses the original project and builds the copy, and its notes, child tasks, groups, etc, from the top down. However, it occurs to me that if I could just invoke the existing Copy/Cut and Paste, it would be much easier.
Any thoughts or hints on how to do this in Applescript would be most welcome. Cheers...
 
fyi the genesis for me of the way I'm using the .ofocus file is here.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Someday/Maybe Projects vs. "On Hold" achamess OmniFocus 1 for Mac 9 2012-12-10 09:58 AM
Inbox Entries Don't "Move" to Projects lfw OmniFocus for iPad 2 2011-06-22 12:04 PM
How to move project into folder? [A: Tap Edit, tap item, tap "move" button in Tbar.] Avis OmniFocus for iPhone 4 2010-07-07 10:27 AM
"indent" versus "move right" rhillcfi OmniFocus 1 for Mac 2 2009-12-15 07:52 AM
How does OF for iPhone handle "Someday/Maybes" and "On Hold"? JRArseneau OmniFocus for iPhone 12 2008-08-04 05:56 PM


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


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