Thank you MullinRJ but it doesn't work.
H := FInGroup(GetVPGroup(VPHnd, 2))
can't get my first selected object while inside a Viewport annotations
However, I completely changed the approach to the problem.
The following script works :
PROCEDURE GetObjectWhileInsideVieportOrGroup ;
VAR
h:handle;
FUNCTION ruota(hand:handle):BOOLEAN;{====ForEachObjectInList needs a function that returns a boolean=======}
BEGIN
Hrotate(hand,0,0,#45);
END;
BEGIN
ForEachObjectInList(ruota,2,0,h);{====h is an handle to the first object in the list====}
END;
RUN(GetObjectWhileInsideVieportOrGroup);
Alberto.