5 Replies Latest reply on Jan 22, 2018 6:30 AM by Patrick Peschke

    Solidwork Start parameter?

    Patrick Peschke

      Hello

      I have a question about the additional applications.

      We have two additional applications that are not allowed to start together.

      Is it possible to specify which add-in application will be activated when starting solidwork?

      I thought that maybe it is possible to start pararmeter

      Sorry for my bad English

       

       

      greeting Patrick

        • Re: Solidwork Start parameter?
          Alexander Klammer

          Hi Patrick,

           

          For sure:

           

          BR

          Alex

            • Re: Solidwork Start parameter?
              Patrick Peschke

              Hello

              Sorry I may have mispronounced myself.

              We have two additional applications (EPDM and Autodesk Productsteam)

              If both additional applications are active there are problems.

              If I use EPDM then the EPDM add-on should be active and Autodesk Productsteam disabled.

              I thought that could be solved via a VB script or with a start parameter with a desktop link.

               

              I hope you can understand what I mean!

               

               

              greeting patrick

                • Re: Solidwork Start parameter?
                  Alexander Klammer

                  I understand,

                   

                  At

                  HKEY_CURRENT_USER\Software\SolidWorks\AddInsStartup

                  You can find the AddIns that are Loading at Startup and also change the value here (0 or 1)

                   

                  To find out which addin you are activating/deactivating look in

                  HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\AddIns\

                  and

                  HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\SOLIDWORKS 201x\Addins

                   

                   

                  so you could easily write a small startup script.

                   

                  To check it programmatically via api Elmar´s answer is all you need.

                   

                  BR Alex

              • Re: Solidwork Start parameter?
                Elmar Klammer

                Hi Patrick,

                 

                To start the addin from within SW use this code. You have to modify the path.

                 

                '---------------------------------------------

                '

                ' Preconditions: Dll must exist.

                ' Postconditions: Add-in is loaded if user clicks Yes; add-in is unloaded if user

                '                clicks No.

                ' SldWorks::LoadAddIn

                '       0   Success. Add-in load was successful.

                '       1   Add-in not loaded. However, this was not an error condition.

                '      -1   Add-in not loaded. Unknown error occurred.

                '       2   Add-in not loaded. Add-in is already loaded

                ' SldWorks::UnloadAddIn

                '       0   Normal return. Add-in unloading was successful.

                '      -1   Add-in could not be unloaded due to some error condition.

                Sub main()

                    ' Path to an existing add-in

                    Const sAddinName            As String = "C:\Program Files\SolidWorks\PDMWorks Client 2008\pdmwaddin.dll"

                   

                    Dim swApp                   As SldWorks.SldWorks

                    Dim nResponse               As Integer

                    Dim nStatus                 As Long

                    Dim bRet                    As Boolean

                   

                    Set swApp = CreateObject("SldWorks.Application")

                   

                    nResponse = MsgBox("Activate(yes)/Deactivate(No) PDMWorks Add-In?", vbYesNo)

                    If nResponse = vbYes Then

                        Debug.Print "Loading: " + sAddinName

                        nStatus = swApp.LoadAddIn(sAddinName)

                    Else

                        Debug.Print "Unloading: " + sAddinName

                        nStatus = swApp.UnloadAddIn(sAddinName)

                    End If

                   

                    Debug.Print "  Status = " & nStatus

                End Sub

                '---------------------------------------------

                To set the toggle for startup you use shell script. Use regedit and find the branch

                HKEY_CURRENT_USER\Software\SolidWorks\AddInsStartup\

                There is a bunch of GUID codes. The best way to identify is to go to SW and disable all but one for startup. Then look through the GUID until you find the one with a default value of 1. That's the GUID that you need to use in the code below.

                 

                 

                Dim myWS As Object

                Dim myRegKey As String

                Dim myValue As Integer

                 

                Set myWS = CreateObject("WScript.Shell")

                 

                myRegKey = "HKEY_CURRENT_USER\Software\SolidWorks\AddInsStartup\{1f97d880-9d20-44d9-99bc-5d4b26da2d81}\"

                 

                myValue = 1

                myWS.RegWrite myRegKey, myValue, "REG_DWORD"