6 Replies Latest reply on Sep 25, 2014 11:39 PM by Rapport

    Error:0x8004022d

    Rapport

      I am getting an error while running a script in Expedition PCB. The message shows "Error:0x8004022d 'the automation code does not contain the licensing call needed for authentication'". What is it and help me sort out this.

        • 1. Re: Error:0x8004022d
          kendall_hiles

          When you get the document object before you do anything you must ask the license server for authentication.

           

          Set app = GetObject(,"MGCPCB.ExpeditionPCBApplication") 'Use this if you are out of process

          Set app = Application 'Use this if you are in process

           

          Set docObj = app.ActiveDocument

          Set licenseServer =CreateObject("MGCPCBAutomationLicensing.Application")

          Key = docObj.Validate(0)

          LicenseToken =licenseServer.GetToken(Key)

          Set licenseServer = Nothing

          docObj.Validate (LicenseToken) 'This makes sure you have an authorized version of Expedition running

          • 2. Re: Error:0x8004022d
            nick_hong

            This is addressed in PCB Automation Reference Manual (expedition_pcb_auto.pdf).

            See "Chapter 1 Examples of PCB Automation > Using Automation Licenses and Document Validation" for more information

            • 3. Re: Error:0x8004022d
              Rapport

              This is error I am getting at the mentioned line. Where I have to add the coding for license server for authentication

              • 4. Re: Error:0x8004022d
                nick_hong

                I would suggest to create a validation function, such as GetLicensedDoc() introduced in PCB Automation Reference, and get pcbDoc from GetLicensedDoc(app)

                 

                It should be shaped like below:

                 

                Set app = GetObject(, "MGCPCB.Application")   ' or, just "Set app = Application" if you are running the script internally

                Set pcbDoc = GetLicensedDoc(app)

                 

                ' Place your codes here - remove your previous statement of setting pcbDoc

                 

                Public Function GetLicensedDoc(app)

                   ... ' Refer to PCB Automation Rererence Manual

                End Function


                Or, place Kendall's code snippet just after your pcbDoc definition, after changing variable 'docObj' to 'pcbDoc' so that it matches to your code.

                • 5. Re: Error:0x8004022d
                  Rapport

                  It should be above the line 72 or below the line 72?

                  • 6. Re: Error:0x8004022d
                    Rapport

                    I have called it as main

                     

                     

                    ' Get the application object

                    Dim pcbApp

                    'Set pcbApp = GetObject(,"MGCPCB.ExpeditionPCBApplication")

                    Set pcbApp = GetObject(,"MGCPCB.Application")

                     

                    ' Get the active document

                    Dim pcbDoc

                    Set pcbDoc = pcbApp.ActiveDocument

                     

                    Call main()

                     

                    then it should call the pcbApp at anywhere right?