Hallo Freunde,
könnt Ihr mir bitte bei einem Script helfen?
Hier sieht Ihr einen Script (von einem CAD.de User) mit dem man Part Number mit dem Dateinamen synchronisiert. Nach dem starten gibt man die Adresse von einem Ordner in dem sich die Daten befinden und alle Part's und Produkt's werden abgeglichen.
Nun möchte ich das auch die Unterordner mit untersucht werden.
Würde mich über eine Lösung sehr freuen.
Mit freundlichem Gruß
Gena
Sub CATMain()
Dim Eingabe As String
Eingabe = "D:\pf"
Eingabe = InputBox ("Bitte geben Sie den Öffnungs Ort ein.", "Alle Parts/Products Öffnen", Eingabe)
Dim oFileSystem As INFITF.FileSystem
Set oFileSystem = CATIA.FileSystem
Dim oFolder As INFITF.Folder
' Verzeichnisname für CATIA-Part
Set oFolder = oFileSystem.GetFolder (Eingabe)
Dim FileSep As String
FileSep = oFileSystem.FileSeparator
Dim i As Long
Dim j as Variant
Dim oFile As INFITF.File
Dim oActiveDoc As DrawingDocument
'Dim BackView As DrawingView
'Dim oText As DrawingText
For i = 1 To oFolder.Files.Count
Set oFile = oFolder.Files.Item(i)
If Right(oFile.Name, 7) = "CATPart" Then
Set oActiveDoc = CATIA.Documents.Open(oFolder.Path + FileSep + oFile.Name)
Dim document As document
Dim splitname As string
Set document = CATIA.ActiveDocument
splitname = Split(document.Name, ".")
Set pro = document.Product
pro.PartNumber = splitname(0)
oActiveDoc.Save
oActiveDoc.Close
End If
'For i = 1 To oFolder.Files.Count
Set oFile = oFolder.Files.Item(i)
If Right(oFile.Name, 10) = "CATProduct" Then
Set oActiveDoc = CATIA.Documents.Open(oFolder.Path + FileSep + oFile.Name)
'Dim document As document
'Dim splitname As string
Set document = CATIA.ActiveDocument
splitname = Split(document.Name, ".")
Set pro = document.Product
pro.PartNumber = splitname(0)
oActiveDoc.Save
oActiveDoc.Close
End If
Next
End Sub
[Diese Nachricht wurde von Gena am 02. Okt. 2009 editiert.]
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP