7 Replies Latest reply on Sep 20, 2016 3:34 PM by Sanya Shmidt

    Restore SW settings via API

    Sanya Shmidt

      Hello Everyone!

       

      Is there a way to restore silently via API solidworks settings *.sldreg? We are experiencing anomaly on some computers at work. We tried different solutions (re-installing/restoring ) . Seems like it randomly happens. The command manager tabs disappear, task pane EPDM icon disappears. Just tired of this behavior.

      We also tried to completely remove registry and adjust SW from zero. It worked for a while and then stopped......

       

      Thank you,

      Alex.

        • Re: Restore SW settings via API
          Deepak Gupta

          Once you set up SOLIDWORKS as desired, then you can export the registry keys. And then can set up to run the registry file (bat file) via Windows API  on system start.

          • Re: Restore SW settings via API
            Christian Chu

            I have my own settings via API, mostly from system options (files location, templates etc) - I'm not sure if you can restore things like tab missing via API ?

            • Re: Restore SW settings via API
              Sanya Shmidt

              ok, after playing with the batch/reg files, I come up with the following script that basically runs the SW_DefaultRegistry.bat file which fires the registry file SW_DefaultRegistry.reg every time I run our configurator app.

               

              Solidworks *.sldreg files are same as *.reg file. you just need to rename extension.

               

              ' Restoring Registry every time app starts only for "SpecificMachine" machine

                         If (System.Environment.MachineName) = "SpecificMachine" Then

               

                             My.Computer.FileSystem.WriteAllBytes("C:\Users\Public\SW_DefaultRegistry.reg", My.Resources.SW_DefaultRegistryREG, False)

                             My.Computer.FileSystem.WriteAllBytes("C:\Users\Public\SW_DefaultRegistry.bat", My.Resources.SW_DefaultRegistryBAT, False)

               

                             Process.Start("C:\Users\Public\SW_DefaultRegistry.bat")

               

                         End If

               

               

              SW_DefaultRegistry.bat file see below:

              >---------------------------

              echo off

              REM Registry restorer

              REGEDIT /S C:\Users\Public\SW_DefaultRegistry.reg

              >---------------------------

               

               

              I guess the bat file can be also added to AutoRun so it pushes the registry data when computer boots up.