3 Replies Latest reply on Jun 20, 2018 5:50 PM by Jacob Corder

    How to get userCommand of third party add-in without executing the command?

    Dennis Beeren

      Dear all,

       

      In my add-in I need to monitor if specific commands of third party add-ins are fired. If the commands are fired I need to run some code.

      What I am currently doing is to use CommandOpenPreNotify event to get the userCommand of the fired command. After I have the userCommand I store it in the user settings of my add-in. Since the userCommand can vary between users and I need three commands to monitor, it is a hassle for our IT guy to install the add-in for all the users (>20 users).

       

      I attached a movie clip in a zip file of the way I am handeling it now.

       

      What I would like to do (by code) is:

      • find a loaded add-in with a specific name
      • get all commands of that add-in
      • get a specific command by name
      • use the userCommand of that command in my code

       

      In this way it will work for all users, even if the commands have different userCommands across users.

       

      I hope my question is clear and that there is anyone out there to help me.

      Thanks in advance.

       

      Best regards,

      Dennis.

        • Re: How to get userCommand of third party add-in without executing the command?
          Jacob Corder

          Get the addin by name...  you will need the GUID.  if you have the name you can use the registry.

          HKLM\Software\Solidworks\AddIns.

          go through them to find a key with the addin name you want in the string registry string value named Title

          the GUID is the key that you find this string match

           

          then you call ISwapp.GetAddinObject("{1A49690A-CC1F-4C81-9B96-303C52F14AC3}")

          this will give you Solidworks Composer

           

          the rest your going to have to discover.

           

          the data is in the registry so you dont even need solidworks to find it all.

           

          start looking through the registry on a system with that addin installed.

          you will find the stuff your looking for

            • Re: How to get userCommand of third party add-in without executing the command?
              Dennis Beeren

              Dear Jacob,

               

              Thanks for you reply.

              I understand what you are saying, but I cannot see how this would help me to get what I need.

              I need to know when a command of a third party add-in is fired (and then do something). As far as I understand, you are describing how to get a handle to an add-in. How does that help me to get the command ID of the add-in's command?

               

              I looked at getting the command manager of an add-in, but then I need the cookie as a parameter, which I do not have.

              Looking through the Solidworks API, I cannot find a way to get the cookie of a third party add-in.

               

              Am I missing something here?

               

              I would be very grateful if you could clarify this a little more to me.

               

              Best regards,

              Dennis.