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 > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Today's Posts

 
Beyond OmniGraffle styles (Plist inside script bundle) Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
FWIW I have generalized the above with a function which serializes a specified sub-set of the properties of an object into a list of {property name, property value} pairs, which can be written to a plist file.

Inelegant, but serviceable enough, I think:

Code:
-- SERIALIZE THE RELEVANT PROPERTIES OF AN OBJECT AS A LIST OF KEY-VALUE PAIRS,
-- TO BE WRITTEN TO A PLIST FILE
on Serialize(oObject, lstProps)
	set lst to {}
	repeat with oKey in lstProps
		set end of lst to {oKey, my GetProp(oKey, oObject)}
	end repeat
	return lst
end Serialize

on GetProp(strPropName, oObject)
	run script "
		on run {refObject}
			get " & strPropName & " of refObject
		end run
" with parameters {oObject}
end GetProp
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Omnigraffle 5.4 - Apple Script Font Issue marxes OmniGraffle General 6 2012-06-13 09:17 AM
Script: Invert / toggle OmniGraffle selections RobTrew OmniGraffle General 1 2011-11-06 06:25 AM
Error Message for images inside omnigraffle? talber6 OmniGraffle General 0 2010-08-29 05:02 PM
Apple Script for layer visibility in OmniGraffle Pro 4? nicoledb OmniGraffle General 0 2009-02-04 07:52 AM
Learning to script OmniGraffle RobLewis OmniGraffle General 2 2008-03-19 08:26 PM


All times are GMT -8. The time now is 02:15 AM.


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