savebang ?
does there is a simple way to trigger a bang when a patch is save ?
the same way there is loadbang closebang
Thanks, Maa
One way would be to save your patches by sending the 'write' message to thispatcher. Then just use a trigger function: [t b write]
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.
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();
}
------------------------------------
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:
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
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