Thanks for the suggestion Raymond. I tried using this, based on the example in the help files.
WHILE NOT GetPickObjectInfo(pX,pY,hPick,hSubObj,idummy) DO BEGIN
GetPt(pX,pY); { gets mouse posn}
END;
cText:= GetRField(hPick,'Terminal Record','Terminal');
SetRField(hPIO,'Wire Record','Start', cText);
It sort of works, in that I can read the data from the target object record and write it into my PIO record, but the pX, pY co-ordinates are always 0,0
I assume this is because VW is getting the co-ord relative to the PIO, not to the drawing. It always gets the data from the object at the drawing centre, even if I click on an object elsewhere.
So then I tried using MouseDown ( and extending the routine to get both ends of my wire)
Message('Click to place Wire Number text, Click on Start Item, Click on End Item');
REPEAT {Get Start Item}
UNTIL MouseDown(rPx,rPy);
bOK:=GetPickObjectInfo(rpX,rpY,hPick,hSubObj,idummy);
cText:= GetRField(hPick,'Terminal Record','Terminal');
SetRField(hPIO,'Wire Record','Start', cText);
REPEAT { Get end Item}
UNTIL MouseDown(rPx,rPy);
bOK:=GetPickObjectInfo(rpX,rpY,hPick,hSubObj,idummy);
cText:= GetRField(hPick,'Terminal Record','Terminal');
SetRField(hPIO,'Wire Record','End', cText);
It works! - except I have to click twice before anything happens, then it goes into the sequence as in the message.
I assume that's something else I'm doing wrong.
I've written a few scripts, but this is the first that really interacts with the user.
Thanks for your help
Steve