SubMacro Create_Bounding_Box #Defines variables. Define Frame_Right as Float Define Frame_Top as Float Define MyLayer as Layer Define Frame_Center_X as Float Define Frame_Center_Y as Float Define Rectangle_Right as Float Define Rectangle_Top as Float Define Rectangle_Center_X as Float Define Rectangle_Center_Y as Float Define MoveX as Float Define MoveY as Float Define myElem as Element #Determines the frame extent. Frame_Right = ActiveDoc.window.pageX Frame_Top = ActiveDoc.window.pageY #Determines center of frame. Frame_Center_X = Frame_Right / 2 Frame_Center_Y = Frame_Top / 2 #Variables. Define LeftEnd as Float Define BottomEnd as Float Define PartOfRight as Float Define PartOfTop as Float #Sets active layer to art layer. Activate Layer "Art" #Unlocks all. Unlock #Clears selection. Select None #Defines location of bounding box. PartOfRight = Frame_Right - Frame_Right * 0.005 PartOfTop = Frame_Top - Frame_Top * 0.005 LeftEnd = PartOfRight/2 BottomEnd = PartOfTop/2 #Selects the bounding box. Select at PartOfRight PartOfTop #Checks if bounding box exists at the current location. If (Exists (ActiveDoc.FirstSelectedElement) = false) Then #Creates bounding box. myElem = create line 0 0 0 Frame_Top Append Line Segment Frame_Right Frame_Top Append Line Segment Frame_Right 0 Append Line Segment 0 0 myElem.line.segments[1].pen = "No pen" myElem.line.segments[2].pen = "No pen" myElem.line.segments[3].pen = "No pen" myElem.line.segments[4].pen = "No pen" #Scales the bounding box. scale selection 0 0 .995 .995 #Creates object info for the bounding box and determines the extent. Create object_info ActiveDoc.firstSelectedElement ActiveDoc.firstSelectedElement.info.view_context.type = "extent" Rectangle_Right = ActiveDoc.firstSelectedElement.info.view_context.rectangle.right Rectangle_Top = ActiveDoc.firstSelectedElement.info.view_context.rectangle.top #Determines center of bounding box. Rectangle_Center_X = Rectangle_Right / 2 Rectangle_Center_Y = Rectangle_Top / 2 #Determines difference in frame and element centers. MoveX = (Frame_Center_X - Rectangle_Center_X) MoveY = (Frame_Center_Y - Rectangle_Center_Y) #Moves elements to center of frame. Move Selection MoveX MoveY #Locks bounding box. Lock #Clears selection. Select None #Centers frame in view. Zoom Page Else #Locks the existing bounding box. Lock #Clears the selection. Select None End If End SubMacro