06-18-2020
02:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-18-2020
02:48 AM
Try this rule. It'll tell you which files it cannot find ![]()
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 Try tmp_str = "DEPT-" & user_input & Right$(sFilesToCopy(i), Len(sFilesToCopy(i)) -13) Call ThisApplication.FileManager.CopyFile(origin_path & sFilesToCopy(i), new_path & "\" & tmp_str) Catch MessageBox.Show("Please make sure the file: " & origin_path & sFilesToCopy(i) & " exists!", "Couldn't copy file") End Try Next MessageBox.Show ("I hope you like it", "KrA")
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website