6 Replies Latest reply on Nov 7, 2014 12:33 PM by leezuhars

    VB script syntax and language

    leezuhars

      I use Sax Basic Engine that came without package. This engine cannot display help because WinHlp32.exe will not work on my W7 64 bit machine . I need to know how to program using this engine including all syntax, the language, object names and everything else.

       

      Is there an off line manual for this tool? Is there a better tool to use?

       

      Specifically how can I get my component location script to use variant information? I saw some reference to VMComponent.variant and Set comps = VMDoc.Components("variant1"). I tried to use VMComponent.variant and VMComponent."XY_OUT". Neither worked, and I really do not know what I am doing without a manual.

       

      Thanks

       

      Lee

       

       

        • 1. Re: VB script syntax and language
          jduquette

          Did you try this:  Error opening Help in Windows-based programs: "Feature not included" or "Help not supported"

           

          Also, have you tried the 'Browse Object ' button in the SAX Engine dialog box?

          • 2. Re: VB script syntax and language
            leezuhars

            I have tried the brose object button with the original object
            ActiveDocument.Components. I saw that I could change some attributes or whatever
            they are called. I did not see anything about VMComponents. Or how to use my
            variant XY_OUT. However I really do not know what I am doing so everything is a
            guess.

             

            Here is the currently working script. A little plagiarized from what was
            available. Also notice the fix to get Excel to not change certain part numbers
            (why did my company start with 0 in their PN scheme) to dates. Any way I was
            hoping I could get For Each part In ActiveDocument.Components to use the
            variant XY_OUT. And for that I am not sure of the formatting ActiveDocument.Components

            was giving to the script.

             

            Thanks for you help

            Lee

             

            'Array of column names. You can modify it to rename columns
            Const Columns = Array("RefDes", "Centroid X", "Centroid Y", "Orient.", "PartType", "SMD", "ENGLISH_UNITS")

            Sub Main
            tempFile = DefaultFilePath & "\temp.txt"
            Open tempFile For Output As #1

            'Output table header
            For i = 0 to UBound(Columns)
              OutCell Columns(i)
            Next
            Print #1
            'Output table rows
            For Each part In ActiveDocument.Components
              OutCell part.Name
              OutCell Format(part.CenterX, "0.000") 'Creates locations based on the outermost extents
              OutCell Format(part.CenterY, "0.000") 'of pins and part outline making up the decal.
              OutCell part.orientation
              OutCell part.PartType
              OutCell Format(part.IsSMD, "Yes/No")
              'The following block was added to pass these attributes out in the part list. The If... statements are needed to handle any
              'attributes that are blank. As it turns out, the non-existance of an object is an important case to handle!
              If part.Attributes("RefDes") Is Nothing Then
               Outcell ""
              Else
               OutCell part.Attributes("RefDes").value
              End If
              If part.Attributes("PartType") Is Nothing Then
               Outcell ""
              Else
               OutCell part.Attributes("PartType").value
              End If
              'End of the added stuff
              Print #1
            Next part

            Close #1
            ExportToExcel
            End Sub

            Sub ExportToExcel
            FillClipboard
            Dim xl As Object
            On Error Resume Next
            Set xl =  GetObject(,"Excel.Application")
            On Error GoTo ExcelError ' Enable error trapping.
            If xl Is Nothing Then
              Set xl =  CreateObject("Excel.Application")
            End If
            xl.Visible = True
            xl.Workbooks.Add
            xl.Range("A:E").NumberFormat = "@"
            xl.Range("D1:E1").NumberFormat = "@"
            xl.ActiveSheet.Paste
            xl.Range("A1:F1").Font.Bold = True
            'xl.Range("A1:E1").NumberFormat = "@"
            xl.ActiveSheet.UsedRange.Columns.AutoFit
            xl.Range("A1").Select
            On Error GoTo 0 ' Disable error trapping.
            Exit Sub   

            ExcelError:
            MsgBox Err.Description, vbExclamation, "Error Running Excel"
            On Error GoTo 0 ' Disable error trapping.   
            Exit Sub
            End Sub

            Sub OutCell (txt As String)
            Print #1, txt; vbTab;
            End Sub

            Sub FillClipboard
            ' Load whole file to string variable   
            tempFile = DefaultFilePath & "\temp.txt"
            Open tempFile  For Input As #1
            L = LOF(1)
            AllData$ = Input$(L,1)
            Close #1
            'Copy whole data to clipboard
            Clipboard AllData$
            Kill tempFile
            End Sub

            • 3. Re: VB script syntax and language
              leezuhars

              I did go the MS site and downloaded the current version WinHlp32.exe. It would not work. I noticed someone said it was already in Windows directory. I tried that. Had the same response as the download.

              Lee

              • 4. Re: VB script syntax and language
                jduquette

                Are you sure you got the right version (Windows6.1-KB917607-x64.msu)?  It fixed it for me. 

                • 5. Re: VB script syntax and language
                  jduquette

                  Sorry, I don't have a VM license so I'm no help from here. 

                  • 6. Re: VB script syntax and language
                    leezuhars

                    You were right I downloaded 32 bit first time. It works now. Now I need to work through the manual  to see if I can find what I need so that VM will drive SM component location output.

                    Lee