title: How to update a Solidworks Macro file from python
body: <p>The idea is to create n CAD models as per the sampling algorithm, each of those n CAD models are saved in separate directories along with a equations.txt file and a Macro.swp file.</p>
  <p>So, I am writing a loop in python that
  a) goes to each directory
  b) updates the equations.txt file taking values from the sampling algorithm output.
  c) run a batch file that (opens solidworks, builds the model after the equations.txt update, saves sldprt)</p>
  <p>Now, in c), the steps of opening building and saving a sldprt are in macro.swp file, which has a path mentioned in it to open the CAd file. As I have n directories, I need to be able to update this path for each macro.swp file as well.</p>
  <p>Unfortunately macro.swp does not open as a text file to be updated by python.
  I tried changing the extension from swp to bas, which is text format, but then the extension cannot be changed back to swp, making it impossible to update the path in the macro as a text update.</p>
  <p>Can anyone suggest, how can I change the path in the macro file?</p>