savebang ?


    Mar 23 2011 | 3:56 pm
    does there is a simple way to trigger a bang when a patch is save ? the same way there is loadbang closebang
    Thanks, Maa

    • Mar 23 2011 | 4:15 pm
      One way would be to save your patches by sending the 'write' message to thispatcher. Then just use a trigger function: [t b write]
    • Mar 23 2011 | 5:25 pm
      I've been asking for savebang for a few years now. I want it because I manage some of my own state using coll, and knowing when a a patch is saved is important.
    • Mar 23 2011 | 10:33 pm
      There is probably a much more efficient way to write this in JS, but here is one way to do something vaguely like what you might want.
      It polls the dirty state of the patcher and will bang when it is "clean":
      save as savebang.js:
      ------------------------------------ var polling = new Task(saveState); var dirtFlag = 1;
      function saveState() { var dirt=this.patcher.wind.dirty; if(dirt==0 && dirtFlag==0) { outlet(0, "bang"); dirtFlag = 1; }
      if(dirt==1 && dirtFlag==1){ dirtFlag = 0; } }
      function poll() { polling.interval = 100; polling.repeat(); } ------------------------------------
    • Mar 23 2011 | 11:14 pm
      Another way is to use an even simpler js and [filewatch]. I'm not using thispatcher because the 'path' message strips off the name of the patcher.
      save as myLocation.js: --------------------------- autowatch = 1;
      function bang() { outlet(0, this.patcher.filepath) } ---------------------------
      patch:
    • Mar 24 2011 | 12:10 am
      Thanks Ben
      I will look at this as soon as I can but I have no lecense for a while (just sent mail to support) about it) I don't like the first version so much because it will create a new task by patcher where I use it does the task is release when the patrcher is freed by the way ? Can't understand the second now
      I am suprised my si many thing in Max I guess this is historical very often but lack of symetric always struck me we should have native openbang closebang loadbang savebang. the cost will be marginal.
      Ben Thanks one more time
    • Mar 24 2011 | 11:14 pm
      I cross the city and got my dongle back so i can go on not sleeping and maxing
      The Js location work fine I still think that the savebang should be done in a next version but for now youe solution do the trick it also give the path of the path so I can save to a subdirectory
      Thanks a lot Maa