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

 
Applescript return resources in group? Thread Tools Search this Thread Display Modes
Hello again,

I have a list of human resources (with unique names) that have been grouped together under a unique group name. Is there a simple way to get applescript to return the list of names under the specified group name, or count the number of resources under the group?

Thanks

Dexterama
 
In addition to the above problem, I am trying to get a count of number of tasks assigned to a specific resource. I have a schedule of 9 tasks and a resource called "Frank" who has 5 of the 9 tasks assigned to him. I am trying to run something like the following...

tell application "OmniPlan"
set resourceName to "Frank"
tell front document
set numTasksAssigned to (count of tasks with resource whose name is resourceName)
if ((count of numTasksAssigned) < 1) then
display alert "There are no tasks assigned to resource " & resourceName
return
end if
end tell
end tell


But I get a 'Can't get 9 whose name = "Frank"' error. Ultimately, it should just return the number 5. I am sure my syntax is wrong. Any help would be greatly appreciated.

Thanks

Dexterama
 
Here's a rough idea of how you might do something like this:

Code:
tell application "OmniPlan"
	tell front document
		set my_group to first resource where (resource type is resource group) and (name is "3 Stooges")
		my print_group(my_group)
		set my_resource to first resource where (resource type is person) and (name is "Bill")
		set my_count to number of assignments of my_resource
		display alert "Bill has " & my_count & " task(s) assigned"
	end tell
end tell

using terms from application "OmniPlan"
	on print_group(this_resource)
		if (resource type of this_resource is resource group) then
			set group_count to number of (child resources of this_resource)
			display alert "found a group named " & name of this_resource & " with " & group_count & " items"
			repeat with a_resource in child resources of this_resource
				print_group(a_resource)
			end repeat
		end if
		if (resource type of this_resource is person) then
			display alert "found a person named " & name of this_resource
		end if
		if (resource type of this_resource is equipment) then
			display alert "found equipment named " & name of this_resource
		end if
		if (resource type of this_resource is material) then
			display alert "found material named " & name of this_resource
		end if
		
	end print_group
end using terms from
 
This is exactly what I needed....thank you so much whpalmer4! Works like a treat.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applescript: How to create a group or subgraph? Sophie OmniGraffle General 2 2012-11-27 01:19 AM
Return key and Inbox Daniel Wessel Applying OmniFocus 9 2012-05-23 12:05 PM
Group Name for Tasks in "Resources" View Mode Promo OmniPlan General 3 2012-04-21 01:21 PM
AppleScript - How to Operate on Group of Selected Graphic Objects? trouble clef OmniGraffle General 1 2011-08-17 06:24 AM
Applescript question for Omni Group pvonk OmniFocus 1 for Mac 3 2009-10-06 09:16 AM


All times are GMT -8. The time now is 08:25 AM.


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