//-- Removes graphics from the current doc. //-- v0.1, 2009-04-08 //-- Klaus Müller, itl AG //-- Remove not only copied insets, //-- but also referenced graphics: Set gvRemoveReferencedGraphics = False; Set gvDoc = ActiveDoc; If (not gvDoc) LeaveSub; EndIf //-- Collect graphic insets: New IntList NewVar(lvInsetObjList); Set lvGraphic = gvDoc.FirstGraphicInDoc; Loop While(lvGraphic) If (lvGraphic.ObjectName = 'Inset') If (lvGraphic.InsetFile = '' or gvRemoveReferencedGraphics) New Integer Value(lvGraphic) NewVar(lvInt); Add Member(lvInt) To(lvInsetObjList); EndIf EndIf Set lvGraphic = lvGraphic.NextGraphicInDoc; EndLoop //-- No graphics ... If (lvInsetObjList.Count = 0) If (gvRemoveReferencedGraphics) Display 'No graphics found.'; Else Display 'No copied graphics found.'; EndIf LeaveSub; EndIf //-- Really? MsgBox 'Remove '+lvInsetObjList.Count+' graphics '+ 'from the current document?' Button(lvButton) Mode(YesNo); If (lvButton = NoButton) LeaveSub; EndIf //-- Delete graphics: Loop While(lvi <= lvInsetObjList.Count) LoopVar(lvi) InitVal(1) Incr(1) Get Member Number(lvi) From(lvInsetObjList) NewVar(lvInt); New Object IntValue(lvInt) DocObject(gvDoc) NewVar(lvGraphic); Delete Object(lvGraphic); EndLoop