6 Replies Latest reply on Dec 2, 2013 6:05 AM by andrew.french

    Scripting and iCDBPartsLister.exe

    andrew.french

      My engineers have about 20 different (slight exageration) BOM outputs they want to see from DxDesigner.  Using the corporate WDIR I can control only one default ipl file so my solution is to create custom scripts available in my own drop down menu in DxDesigner that are preconfigured for specific outputs using icdbPartsLister.exe and the appropriate flags.

       

      The issue I am having is when I try to specify the output file's name when the ipl file is configured to output an excel file.  I cannot get this to work for the life of me but I am having no problems when the output is a plain text file.  Has anyone else experienced this?  Is this a known bug or am I doing something silly?

       

      Thanks for your time.

       

      Option Explicit

      dim WshShell, vdapp, vdpd, prjPath, prjFilePath, SDDHOME, WDIRPath, boardName, command

       

      set vdapp = GetObject(,"ViewDraw.Application")

       

      set vdpd = vdapp.GetProjectData

       

      prjPath = vdpd.GetProjectPath

       

      prjFilePath = vdpd.GetProjectFilePath

       

      WDIRPath = \\Some\network\location\wdir

       

      boardName = VdApp.ActiveView.GetTopLevelDesignName

       

      set WshShell = CreateObject("WScript.Shell")

       

      SDDHOME = WshShell.ExpandEnvironmentStrings("%SDD_HOME%")

       

      command = SDDHOME & "\wv\win32\bin\icdbPartsLister.exe -prj=" & chr(34) & prjFilePath & chr(34) & " -board=" & boardName & " -cfg=" & chr(34) & WDIRPath & "\PartsLister\someiplfile.ipl -out=" & chr(34) & prjPath & "\configuredBOM.xlsx" & chr(34)

       

      WshShell.Run command, , TRUE

        • 1. Re: Scripting and iCDBPartsLister.exe
          Satoru

          Hi andrew-san,

           

          I found one mistake in your code.

          One double quotation was lacking.

           

          command = SDDHOME & "\wv\win32\bin\icdbPartsLister.exe -prj=" &  chr(34) & prjFilePath & chr(34) & " -board=" & boardName  & " -cfg=" & chr(34) & WDIRPath &  "\PartsLister\someiplfile.ipl" & chr(34) & " -out=" & chr(34) & prjPath &  "\configuredBOM.xlsx" & chr(34)

           

          Please check.

           

          Regards,

          Satoru

          • 2. Re: Scripting and iCDBPartsLister.exe
            andrew.french

            Hey Satoru-San,

             

            I switched to using chr(34) to try and be less confusing for myself and yet I still managed to forget one.  Good catch, I had been starring at that  line of code for too long and just wasn't seeing the issue.  Thank you for your time!

             

            Andrew

            • 3. Re: Scripting and iCDBPartsLister.exe
              andrew.french

              With Satoru-san's find the code started working as expected for projects on my local computer and would write the output in the appropriate location.

               

              My company keeps all our projects on a network location and there is no garantee that the drive will be mapped.  So likliness is that the output file will be a unc path.  When I run the updated code on a project stored on the network, excel wants to write the file to my local User's Documents folder.  Is this the expected behavior and/or are others experiencing this as well?  Or am I doing something silly again?  Thanks again in advance!

              • 4. Re: Scripting and iCDBPartsLister.exe
                andrew.french

                If I open the project through a mapped drive the excel output is written correctly to the network location.

                 

                If I open the project through a unc path the excel output will not write out to the specified network location.

                 

                fun times...

                • 5. Re: Scripting and iCDBPartsLister.exe
                  jonathan.frisby

                  Hi Andrew, not saying it will work, but this is worth a try, it stop me getting errors on BoM creations etc from UNC paths :

                   

                  Search for this and it's a regedit job:

                  Review Microsoft Knowledge Base Article - 156276 for a solution to this problem. You can use the instructions provided by Microsoft to allow the CMD.EXE console to deal with UNC paths correctly.

                   

                  Thanks

                   

                  Jon

                  1 of 1 people found this helpful
                  • 6. Re: Scripting and iCDBPartsLister.exe
                    andrew.french

                    That's actually helpful on a few levels for me.  Thanks for the pointer!