When I asked about what messages can be sent to windows, and I read over the documentation given in response, it occurred to me the [mouse( message could possibly eliminate the problem of having to know exactly which number each object was in order to make connections. I threw together this little patch to illustrate. If your only concern was making it not overlap existing onscreen objects, you could place the objects like at -500 -500 or something.
I'm not sure how useful this would be, since you would instead have to know the exact position. But if you make the connections at the same time as placing the objects, you can figure it out. I added 1 to the x value and 16 to the y value to get to an outlet. Maybe this will give someone some useful ideas.
-Chuckk
-- "It is not when truth is dirty, but when it is shallow, that the lover of knowledge is reluctant to step into its waters." -Friedrich Nietzsche, "Thus Spoke Zarathustra"