The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Does OmniFocus AppleScript support work properly yet? (http://forums.omnigroup.com/showthread.php?t=6983)

aleding 2008-01-30 09:22 AM

Does OmniFocus AppleScript support work properly yet?
 
The reason I ask is because I have been trying to figure out how to manipulate the tasks dates but I am having zero success. The entry in my scripts is:

[CODE]tell application "OmniFocus"
tell default document
set var1 to start date of task as date
end tell
end tell[/CODE]

And I keep getting errors - this is a very simple example but I would think that if this doesn't work, then more complex operations surely will not work.

Maybe I am not understanding the OmniFocus Dictionary properly - any help is greatly appreciated.

Thanks.

RobTrew 2008-01-30 02:03 PM

The applescript support is good and works well.

In your code fragment you have not specified which task you are referring to.

An inbox task ? A project task ? If so which project ?

Whether inbox or project tasks, which task specifically ?

The following, for example, would at least conform to the structure of the dictionary:

[CODE]tell application "OmniFocus"
tell default document
set var1 to start date of first inbox task
end tell
end tell[/CODE]

aleding 2008-01-30 03:28 PM

RobTrew - thanks for the insight and also for letting me know I'm likely not chasing my tail here.

So to your question - I would like to also be able to work an a task within a project - say the project name is "CTI", any idea how I would access certain tasks within that project?

RobTrew 2008-01-31 01:31 AM

[QUOTE=aleding;32175]say the project name is "CTI", any idea how I would access certain tasks within that project?[/QUOTE]

You can either recursively move down through the folders and their project lists until you find a project with a matching name, or you can use the "Complete" method of the Document class, which returns a list of records giving details of any projects or categories with names that fully or partially match some string that you have provided. You can then use the supplied id of a matching project to get a full reference to that project.

For example:

[CODE]tell application "OmniFocus"
set oDoc to front document
set oProject to my FindProject(oDoc, "CTI")
end tell


on FindProject(oDoc, strProjName)
using terms from application "OmniFocus"
tell oDoc
set recsMatch to complete strProjName as project maximum matches 1
if length of recsMatch > 0 then
set oProject to project id (id of item 1 of recsMatch)
end if
end tell
end using terms from
end FindProject[/CODE]


All times are GMT -8. The time now is 02:08 PM.

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