06-16-2020
02:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-16-2020
02:21 AM
You can copy/paste this snippet into a rule (iLogic).
Hope it works for you.
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
If Not ThisApplication.ActiveDocumentType = kAssemblyDocumentObject Then
Messagebox.Show ("No assembly open..", "KrA")
Exit Sub
End If
Dim origin_path As String, new_path As String, user_input As String, tmp_str As String
Dim sFilesToCopy(9) As String
user_input = InputBox("What is the new numebr", "YYYY-XXX", "")
If Len(user_input) <> 8 Then
Messagebox.Show ("Invalid input..", "KrA")
Exit Sub
End If
origin_path = Left$(oDoc.FullFileName, InStrRev(oDoc.FullFileName, "\"))
Dim folderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog()
Dim path As String = ""
If (folderBrowserDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK) Then
new_path = folderBrowserDialog1.SelectedPath
Else
Return
End If
If new_path = "" Then
Messagebox.Show ("User cancelled out of dialog", "KrA")
Exit Sub
End If
sFilesToCopy(0) = "DEPT-YYYY-XXX-05-01 SUPPORT.ipt"
sFilesToCopy(1) = "DEPT-YYYY-XXX-05-01 SUPPORT.dwg"
sFilesToCopy(2) = "DEPT-YYYY-XXX-04-01 EXTERNAL PLATE.ipt"
sFilesToCopy(3) = "DEPT-YYYY-XXX-04-01 EXTERNAL PLATE.dwg"
sFilesToCopy(4) = "DEPT-YYYY-XXX-03-01 INTERNAL PLATE.ipt"
sFilesToCopy(5) = "DEPT-YYYY-XXX-03-01 INTERNAL PLATE.dwg"
sFilesToCopy(6) = "DEPT-YYYY-XXX-02-01 SIDE LEFT PLATE.ipt"
sFilesToCopy(7) = "DEPT-YYYY-XXX-02-01 SIDE LEFT PLATE.dwg"
sFilesToCopy(8) = "DEPT-YYYY-XXX-01-01 SIDE RIGHT PLATE.ipt"
sFilesToCopy(9) = "DEPT-YYYY-XXX-01-01 SIDE RIGHT PLATE.dwg"
For i = 0 To 9
tmp_str = "DEPT-" & user_input & Right$(sFilesToCopy(i), Len(sFilesToCopy(i)) - 13)
Call ThisApplication.FileManager.CopyFile(origin_path & sFilesToCopy(i), new_path & tmp_str)
Next
Messagebox.Show ("I hope you like it", "KrA")
regards,