Here are two useful methods for getting and setting user-data items of an object. Note that the value set or retrieved is a string.
-- Returns value of user-data item itemName of graphic obj.
-- Returns null if data item doesn't exist, or obj is invalid.
on getUserDataItem(obj, itemName)
tell application id "OGfl"
try
set retval to value of user data item itemName of obj
-- force evaluation of retval to trigger the error:
set triggerError to retval
on error
return null
end try
return retval
end tell
end getUserDataItem
-- Sets user-data item itemName of graphic obj to val,
-- adds that user-data item if it doesn't exist.
-- Returns null if obj is an invalid, or value failed to set
-- (e.g., val isn't a string); else returns passed value.
on setUserDataItem(obj, itemName, val)
tell application id "OGfl"
try
set value of user data item itemName of obj to val
on error
return null
end try
return val
end tell
end setUserDataItem