The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   AppleScripting Omni Apps (http://forums.omnigroup.com/forumdisplay.php?f=46)
-   -   AppleScript Project's Resource Filtering (http://forums.omnigroup.com/showthread.php?t=15951)

MattHive 2010-04-14 12:25 AM

AppleScript Project's Resource Filtering
 
Is it possible to filter a project's tasks by resources within AppleScript? I understand to export a project as an iCal you first need to specify a filter; in this instance I'd like to filter by [FONT="Courier New"]Resource[/FONT] and the resource itself corresponds to the "person" [FONT="Courier New"]resource type[/FONT] so I can export each person's schedule to an individual iCal file.

I'm having troubles searching online and looking through OmniPlan's AppleScript library to in any way find the method to filter a project via AppleScript.

RobTrew 2010-04-14 11:41 AM

You might get a more informed response in the OmniPlan Extras or OmniPlan forums, but it's possible that code of the following pattern may be relevant to part of your question

[CODE]
tell application id "com.omnigroup.OmniPlan"
set oDoc to front document
set lstFredTasks to my PersonTasks(oDoc, "Fred")
end tell

on PersonTasks(oDoc, strName)
using terms from application "OmniPlan"
tell oDoc
set lstRes to (resources where (resource type is person) and (name is strName))
if length of lstRes > 0 then
task of every assignment of first item of lstRes
else
{}
end if
end tell
end using terms from
end PersonTasks
[/CODE]

MattHive 2010-04-20 10:13 PM

I've been working with RobTrew's particular piece of code and also experimenting and researching lots of other ideas that I've found within the forum. At one point I had an Applescript that would generate an HTML Full Report, went through and renamed each iCal to the resource's name and then deleted all the other files. However, when testing it with our full studio project file the exporting crashed Omniplan (mind you, this project file has over 30 resources and has tasks that go as far back to 2008) and rendered my Applescript useless (boo hoo).

Another method I attempted was to iterate through each resource, set the "filtered" value to "true" and then export the project as an iCal. The problem that occured with this method was that even though I was setting "filtered" to a boolean, it wouldn't take it and came back with the error:

[I]OmniPlan got an error: [<OPTask 0x28c6ab50> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key isFilteredOut[/I]

I'm about ready to call quits on this! I just haven't the time to invest in it further, especially with currently no proven methods to do this, so I'd like to request some way of being able to export each resource's scheduled tasks as an iCal file and the option to specify the start and end period would be nice too. If the export could also be named what the resource is named, then that would be pretty spiffy too.


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

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