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 1 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
AppleScript to create a Project inside a folder? Thread Tools Search this Thread Display Modes
Hello All,

Using an applescript, I would like to create a project inside a designated folder. but I am having difficulty with the correct way to tell Omnifocus where to create the project (it keeps placing it at the document (root) level).

I have the folderName and the folderID and am happy to use whichever (though I'd prefer the folderID).

the line for creating the project that I am using is

=========
make new project with properties {name:ProjectName, note:ProjectNote, XXX}
=========

I've tried:
container:FolderID
container:FolderName
folder:FolderID
folder:FolderName

and tried different keywords after the properties close-bracket, but to no avail. Any help would be greatly appreciated.

Thanks in advance!
Ricky
 
Code:
set myFolder to folder id folderID
set myProject to make new project with properties {name:ProjectName, note:ProjectNote} at end of projects of myFolder
 
Perfecto!!

Thank you so much. That was exactly what I was looking for
 
Is this the complete code necessary? Can I run the script with just this and it will work? Thankee.
 
Quote:
Originally Posted by Christian View Post
Is this the complete code necessary? Can I run the script with just this and it will work? Thankee.
Hi Christian,
This is what I am using. (Note that it is part of a bigger script, and so some variables are not properly declared in the example below)
-Ricky


Code:
(*  Since this code is copied from part of a larger script, 
it is missing the variable declerations. 
Make sure to  Set Variables as needed:
 
set FolderName to ... 
set ProjectName to ... 
etc… 
*)


tell application "OmniFocus"
	--activate
	set theDoc to default document
	
	tell theDoc
		
		set StatusContext to context "ContextInHere" of context "ParentContext" --modify as needed
		
		--Create the folder with Project and Task
		set NewAcctFolder to (make new folder with properties {name:FolderName} at end of folder id RootFolderID)
		set NewOppProject to (make new project with properties {name:ProjectName, note:ProjectNote, context:StatusContext} at end of projects of NewAcctFolder)
		set NewStatusTask to (make new task with properties {name:TaskName, note:TaskNote, context:StatusContext} at end of tasks of NewOppProject)
	
	end tell
end tell
 
Grand, thanks for the quick reply! I'll test this tomorrow, could save some time for work projects.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recovering project folder and tasks inside liz4cps OmniFocus 1 for Mac 3 2012-10-06 12:38 AM
How to create a project inside another project Don Richmond OmniFocus for iPad 7 2012-08-27 05:23 PM
How to I create a new folder and or project with mail rules? tlester OmniFocus 1 for Mac 2 2012-03-15 12:06 PM
Open or Create Project Folder Script ptone OmniFocus Extras 0 2008-08-11 11:17 AM
Create project in folder by Cmd-Enter Schimmi OmniFocus 1 for Mac 1 2008-01-08 04:02 PM


All times are GMT -8. The time now is 09:07 PM.


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