8 Replies Latest reply on Oct 16, 2015 10:32 AM by Chris Iannone

    Editing Shared Macros

    Chris Iannone

      I've come across a few old discussions about how sharing macros from a network location doesn't allow someone to edit them after others have used it without the others closing out Solidworks, unloading the macro.  I haven't found a solution to this problem, but I'm guessing there's one out there. I was just wondering what others have done as a work around to allow sharing of macros while retaining the ability to edit them without going around the office to find who used the macro, and asking them to restart Solidworks.

       

      I had an idea to write a macro that will copy the network folder with the macros and icons to their local drive, specifically their "My Documents" folder, and have everyone reference those macros.  When ever a macro gets updated, have them run the macro that copies the folder to their local drive, and everyone will have the latest files.

        • Re: Editing Shared Macros
          Josh Brady

          You could do this with a login script.  That's probably the best option. 

          • Re: Editing Shared Macros
            John Kangas

            I've gone down a similar path... The most robust method I've found is to keep those macros shared from a single file, but only run them through proxy macros with the RunMacro2 method, which has an 'unload after run' option that works. You can either set up single shared proxy macros or copy them to local files like you're thinking of doing, and all those proxy macros would do is run the actual shared macro. This way, you can post updates that will immediately run for everyone without interrupting their work for a solidworks restart, and you don't have to worry about responding when someone forgot to run the update macro a week ago and is now having mysterious trouble.

             

            The only blocking you'll run into is if you try to save your update at the exact moment someone is running the macro, but that's not an issue if you're revising from a copy.

              • Re: Editing Shared Macros
                Chris Iannone

                I like this idea.  I took a look at what was involved with creating a proxy macro and I've already developed one i think will be easy to impliment (I've got a lot of macros).  I've written it so that the only changes you have to make to it to run another macro was changing the file name and moving to the folder of the macro you want to run.  The file name for the proxy macro has "Run" in front of the name of the macro that it will run.  Using GetCurrentMacroPathName it generated the strings needed for RunMacro2.

              • Re: Editing Shared Macros
                Ivana Kolin

                we use textfile with macronames and path to ini. Add in creates with this texfile menu and toolbar. Each macro has own inifile, here is an example:

                 

                [Macro]
                sMacro =  Date-macroX.swp
                Parts = n
                Assemblies = y
                Drawings = n
                TooltipText = Tooltiptext
                HintstringText = HintString
                modulename = main
                procedurename =  main
                

                 

                When we have new revision, then we change name by sMacro. When user starts SW, then he has new macro. Benefit of this solution is, that I can enable and disable macro for particular user with file permissions