Selecting object with applescript

I am very new to using applescript with OG. I have managed to build a script that creates a lot of objects based on a CSV file and link some together with connect. Now I’m trying to have it build more for me and would like to figure out how to select an object that might have been built earlier without knowing in advance what object I might want to grab. In the process of building the objects I create a name for each object based on the item in the CSV file. I thought I could reference this to find it again easily. Here is an example of one object I might want to select to connect to another object I create. Can I find it based on the “user name” I’ve created?

tell application id "com.omnigroup.OmniGraffle7"
    tell canvas of front window
        make new shape at end of graphics with properties {user name: "CS2100_PBX_PRI_RG", corner radius: 14, draws shadow: false, size: {320.000000, 210.000000}, text: {alignment: center, color: {0.000000, 0.000000, 0.000000}, font: "HelveticaNeue", text: "CS2100_PBX_PRI_RG"}, text placement: top, origin: {10.000000, 875.000000}, stroke join: bevel, fill color: {0.921431, 0.921453, 0.921441}}
    end tell
end tell

Thank you,
Mike

When you run that script in Script Editor, under the result, you should get something like this
graphic id 7 of canvas id 1 of document id "d6EqsF2RafT" of application "OmniGraffle"

The result area contains the information that you need to select based on the graphic id, canvas id, or document id. If you can’t see the result, choose View>Show Result in Script Editor or Command + 2 to toggle it.

Good luck with your script!

Thanks,
Lanette

Thank you. I have been able to get the object information when I create it with set objectLocation to make new shape at end of graphics with properties {user name:objectName, ... but I am trying to find out if there is any method after the fact to “select” a shape based on the user name I assigned earlier. The thing is, I may generate something named OBJECT1 and then later in my CSV file find I want to connect a line between OBJECT5 to OBJECT1. How do I find OBJECT1 again unless I know something about it?
I’m still new to AppleScript but maybe I need to assign these object locations to some kind of array that I can lookup later? I guess I’m thinking something like a Python dict. I’m guessing AppleScript has that same concept.
Something like {OBJECT1: object1Location} where object1Location is assigned when creating the object?

Thanks,
Mike