' Closed.vbs - 20.02.2012, 09:35:04 - Page 1 ' VB Script to check unclosed Polylines script and Loop Version of the ' unclosed macro of Tom Snape ' Version 1.0.0 - first release mike kuhn ' ' Error-checking is minimal ' option explicit Dim TCApp ' the TurboCAD application -- must be running for this script to work' Dim TCDraw 'the active drawing - must be an open drawing for this script to work Dim TCSel ' the current selection. If nothing is selected the script will exit Dim TCGrf ' used to cycle through each selected graphic' Dim i ' counter for each selected graphic Dim j ' counter for each unclosed graphic Sub Main On Error Resume Next ' hook up to the running instance of TurboCAD Set TCApp = GetObject("", "TurboCAD.Application") If Err.Number <> 0 Then MsgBox "Kein Zugriff auf TurboCAD. Error " & Hex(Err.Number) & ": " & Err.Description Err.Clear Exit Sub End If ' get the active drawing Set TCDraw = TCApp.ActiveDrawing If Err.Number <> 0 Then MsgBox "Keine offene Zeichnung. Nichts zu tun." Err.Clear Exit Sub End If ' get the current selection. If empty, complain and exit. Set TCSel = TCDraw.Selection If TCSel.Count < 1 Then MsgBox "Keine Objekte ausgewählt. Nichts zu tun." Exit Sub End If msgbox Tcsel.count & " Objekte ausgewählt" j = 0 For each TCGrf in TCSel Set TCGrf = TCSel.Item(i) if TCGrf.Closed = FALSE then TCGrf.Properties("Pencolor") = vbred j = j + 1 end if Next msgbox "fertig " & j & " Objekte nicht geschlossen " TCGrf = Nothing TCSel = Nothing TCDraw = Nothing TCApp = Nothing End Sub Main