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

 
Setting Task Custom Data using Applescript Thread Tools Search this Thread Display Modes
I want to use some external scripting to set the custom data field "Username" to some value. I can set the other fields like note or name, but I am having trouble setting the custom data. I used AS Dictionary to generate some form of documentation for the Applescript library, but it doesn't give me too much information about what parameters the method is expecting. Can someone help out by giving me a snippet to use?

Also, is there a place for the official AS documentation for Omniplan?

Thanks,
Curtis
 
The dictionary itself contains the only documentation I know of.

You can assign anything, regardless of type, to the "custom data" property of any task, project, or resource. Its up to you to structure the data yourself.

Code:
tell application "OmniPlan"
	tell first document
		set oTask to make new task
		
		set strAnything to "This could be any string"
		set custom data of oTask to strAnything
		
		--Or, for example ...
		
		set lstAnything to {"this", 45, "could", "B", "any", {"list"}}
		set custom data of oTask to lstAnything
		
		--Or perhaps more usefully ...
		
		set lstAnything to {{"name", "schweik"}, {"rank", "private"}, {"age", 35}}
		set custom data of oTask to lstAnything
		
	end tell
end tell
 
I am running this script and it indeed creates a new task in Omniplan, but none of the custom data fields get set or created when I run the snippet above. Any ideas?
 
Try assigning a record as below, then check the Custom Data inspector in Omniplan.

Code:
tell application "OmniPlan"
	tell first document
		set oTask to make new task
		
		set recCustom to {surname:"Svejk", rank:"footsoldier", age:"28"}
		set custom data of oTask to recCustom
		
	end tell
end tell
 
It can't really be just any list. It should be a record, like so:

Code:
		set newData to {bugID:12345, customer:"Joe Smith"}
		set custom data of oTask to newData
That will give you two custom data keys called "bugID" and "customer" which are available to all tasks, not just this one.
 
There seems to be a GUI refresh bug here.

If you create new fields through Applescript, their data is not displayed until the user explicitly clicks in each field, or closes and reopens the document.

I have filed a bug report through the feedback dialog.
 
Quote:
Originally Posted by RobTrew View Post
There seems to be a GUI refresh bug here.

If you create new fields through Applescript, their data is not displayed until the user explicitly clicks in each field, or closes and reopens the document.

I have filed a bug report through the feedback dialog.
Received your bug report. Thanks RobTrew!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can custom data be printed jethiele OmniPlan General 5 2012-04-20 10:27 AM
Project Custom Data jotapes OmniPlan General 13 2011-11-29 07:46 AM
Custom data didn't migrate to 2.0? workinprogress OmniPlan General 1 2011-07-27 02:08 PM
Searching for Custom Task Data MichaelK OmniPlan General 4 2011-04-03 03:04 PM
what is the fastest way to search tasks based on custom data in AppleScript cope360 OmniPlan Extras 2 2009-07-16 02:57 PM


All times are GMT -8. The time now is 04:59 AM.


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