Message 1 of 9
[iLogic] Pack&Go rule problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi.
I am trying to make a pack and go rule that works as following:
- Create pack and go (in a folder with current date and time in it's name)
- Create ZIP
- Delete pack and go folder
- Ask to open ZIP
The problem: It generates pack and go, but with only main assembly. It does not search for additional files. Why?
Here is complete rule:
If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then
MessageBox.Show("Apenas pode executar esta macro num ficheiro *.iam", "Erro!")
Return
End If
ThisApplication.ActiveDocument.Save2
Dim oFolder As String = System.IO.Directory.GetParent(ThisDoc.Path).ToString & "\8-BACKUP [ZIP]\PG_" & IO.Path.GetFileNameWithoutExtension(ThisDoc.ModelDocument.FullFileName) & "_" & DateTime.Now.ToString("yyyy.MM.dd_HH.mm.ss")' & "\"
Try
MkDir(oFolder)
Catch
End Try
Dim oPacknGoComp As New PackAndGoLib.PackAndGoComponent
Dim oPacknGo As PackAndGoLib.PackAndGo = oPacknGoComp.CreatePackAndGo(ThisApplication.ActiveEditDocument.FullFileName, oFolder)
'oPacknGo.ProjectFile = ThisApplication.DesignProjectManager.ActiveDesignProject.FullFileName
Dim oReferencedFiles = New String() {}
Dim oMissingFiles = New Object
'Dim oSearchedFiles = New String() {}
'Dim oReferencingFiles = New String() {}
oPacknGo.SkipLibraries = True
oPacknGo.SkipStyles = True
oPacknGo.SkipTemplates = True
oPacknGo.CollectWorkgroups = False
oPacknGo.KeepFolderHierarchy = True
oPacknGo.IncludeLinkedFiles = True
oPacknGo.SearchForReferencedFiles(oReferencedFiles, oMissingFiles)
oPacknGo.AddFilesToPackage(oReferencedFiles)
'oPacknGo.SearchForReferencingFiles(oSearchedFiles, oReferencingFiles, False, ThisDoc.WorkspacePath & "\", True)
'oPacknGo.AddFilesToPackage(oReferencingFiles)
oPacknGo.CreatePackage()
System.IO.Compression.ZipFile.CreateFromDirectory(oFolder, oFolder & ".zip")
Dim oCommand As String = CStr("cmd.exe /c rmdir /s /q " & """" & oFolder & "\""")
Dim oShellCommand As Object = CreateObject("WScript.Shell")
oShellCommand.Run (oCommand)
If MsgBox ("Deseja abrir o ficheiro ZIP do Pack And Go?",vbYesNo) = vbYes Then
oCommand = CStr("cmd.exe /c """ & oFolder & ".zip""")
oShellCommand.Run(oCommand)
End If
