VDX format and Custom Properties
Joel Page
jpage at omnigroup.com
Thu Feb 14 08:44:49 PST 2008
This is just me cutting and pasting from Wim, but it should answer
your questions:
[Brief summary of using UserData from AppleScript]
OmniGraffle has allowed arbitrary key/value pairs to be attached to
objects since version 4.x, but they were only available through
AppleScript. In version 5, these values have been made accessible
through the GUI (in the "Notes" inspector) and the AppleScript support
has been improved a bit.
Right now, user data items must be strings; they cannot be values of
other types. (Of course, you can often use coërcions to convert other
types to strings for storage and convert them back later.) Other
datatypes may be supported in the future.
There are two ways to manipulate user data from AppleScript.
1. As an AppleScript 'record'
The user data can be retrieved or set in bulk using the 'user data'
property of each graphic.
-- Get the user data record, and get some individual values from it
set D to the user data of SomeGraphic
say "The part number is " & (the partnumber of D) & " and the price is
" & (the price of D)
-- Completely replace all user data with some new values
set the user data of SomeOtherGraphic to {knit:"5", purl:"1"}
2. As a collection of 'user data items'
Starting with Graffle version 5, the same information can also be
viewed as a bunch of named values contained by the graphic. This is
convenient when you want to read or change a single value without
worrying about what other user-data items an object may have.
-- Retrieve a user-data value and do something with it
set ISBN to the value of user data item "isbn" of SomeGraphic
open location "http://worldcat.org/isbn/" & ISBN
-- Read, modify, and store the modified value
set P to user data item "pagecount" of SomeOtherGraphic
if the value of P is "Unknown" then set the value of P to "42"
-- Create a new user data item
tell SomeOtherGraphic to make new user data item with properties
{name:"fnord"}
set Fnord to the result
set the value of Fnord to "do you see them"
Unlike the "user data" record, a "user data item" remains part of the
object even after you get it— so you can change its value and that new
value will be stored in the graphic. In contrast, if you retrieve a
"user data" record, and then modify it, those modifications won't be
stored in the object until you explicitly set the object's user data
to be the new, modified record.
Joel Page
Product Manager, OmniGraffle
The Omni Group
On Feb 14, 2008, at 1:38 AM, Vadim E. Sabashny wrote:
> Hello,
>
> I use OmniGraffle Pro Version 4.2.2 (with Mac OS X 10.4.11) for
> working
> with files converted from native Visio format into XML Visio (VDX).
>
> Microsoft Visio allows to assign custom properties to almost all
> items, usually that properties are represnted by strings. But I failed
> to find such functionality in OmniGraffle.
>
> Does anyone know if OmniGraffle supports Custom Properties?
>
> And how does OmniGraffle support them?
>
> --
> Best regards,
> Vadim mailto:sabashny at oktetlabs.ru
>
> _______________________________________________
> OmniGraffle-Users mailing list
> OmniGraffle-Users at omnigroup.com
> http://www.omnigroup.com/mailman/listinfo/omnigraffle-users
More information about the OmniGraffle-Users
mailing list