5 Replies Latest reply on Apr 5, 2010 7:39 AM by french1

    Automation code for license availability

    patrick.escher

      Hi,

       

      I am looking for a solution or any hints on how to check if a specific license is available.

       

      Usecase:

      we are using the AutomatinPro engine to create PDF Plots of a PCB/Panel. If the Extended Print licenses (which is part of the FablinkXE license), then the .go() command just fails with an empty error message. The idea now is, to check the licenseApp if the ExtendedPrint (or any other license) is available so thatw e can go on with the process. If not, provide a 'usefull' error message to the user.

       

      Any idea on how to check if a license is available and also which exact license code needs to be sued (or where to get it from)

       

      Thanks,

       

      Patrick

        • 1. Re: Automation code for license availability
          fagrondin

          Patrick,

           

          just tried it and caught it. will send you how to write it.

          email me to my email at work as can't see yours anymore.

           

          Regards

           

          Fred

          • 2. Re: Automation code for license availability
            fagrondin

            Hey Patrick,

             

            Let's share it.

             

            I just tried and got to pass my own message to make sure it doesn't crash on the user.

            I will probably update it properly tomorrow as this could happen to my colleagues in Europe.

            I use C# in Visual Studio but Here is what I did:

             

            code here... and before to call ....go,

             

             

             

             

            try

            {

            oPDFEngine.Go();

            }

             

             

             

            catch (System.Runtime.InteropServices.COMException

            )

            {

             

             

             

            MessageBox.Show("License already used by Patrick...?");

            }

             

            a way to release or acquire licenses :

             

             

             

             

            // When in Expedition If license Fablink XE PRO acquired need to be released before to execute.

             

             

             

            if (docObj.Application.IsLicenseAcquired(EPcbLicenseFeature.epcbLicenseFeatureFablinkXEPro) == true)

            {

            docObj.Application.ReleaseLicense(

             

            EPcbLicenseFeature.epcbLicenseFeatureFablinkXEPro);

            }

             

            or in the opposite case :

             

            docObj.Application.AcquireLicense(

             

            EPcbLicenseType.epcbLicenseFablinkXEPro);

             

            I hope it helps.

            Regards

            Fred

            • 3. Re: Automation code for license availability
              yu.yanfeng

              Why not to use Application.IsLicenseAquired(epcbLicenseFeatureFablinkXE)?

              Yanfeng

              • 4. Re: Automation code for license availability
                patrick.escher

                Well, there are some drawbacks.

                it requires, that you have an application running to check if the license is available.

                This is fine, as long as you run your code out of expedition, a then always an application is available.

                but if you want  for example run the automation code externally and use let`s say the AutomationPro feature to create PDFExports, then there is no need to have an expedition running. But you need to be able to acquire teh FablinkXE and AutomationPro license.

                So, it would mean, that I have to start an expedition instance, which takes time ,  and then execute the license check.

                I would rather prefer to have the option to check the license server if a license would be available, if so, run the rest of the automation.

                 

                And, in fact, I still need to find a way to check if the Automation Pro licenses are available or not.

                 

                Thanks,

                 

                Patrick

                • 5. Re: Automation code for license availability
                  french1

                  you can get usage information from lmutil.exe lmstat

                   

                  no automation required, no opening expedition, and works for all flex licenses.  You can even get just specific feature usage information within a license.

                   

                  lmutil lmstat -a -c "<license file>" -f xefablink