Abstraction detection using #1

Maa's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I am using instance name to save file at load and close (no savebang)
so I use #1 to generate filename
But I'd like for the abstraction itself (original) to avoid having
#1 in the name and replace it with "default" for example
how to test #1 ?

Kasper's icon

not sure if i understood your question, but if you don't give a name/argument which should be/replace #1, max sends/generate 0 instead of #1
what I do is using a [sel 0] which bangs to a "default" value/name etc

again, not sure if i understood your question. Hope it helps

kasper

Chris Muir's icon

The patcherargs object will give you a default argument if none is specified.

Maa's icon

want to change the behavior of the original file
where #1 is not replace by anything

Roman Thilenius's icon

but it is; it will be replaced by 0

Maa's icon

it is not replaced by 0

Ok I made the problem even simpler

Max Patch
Copy patch and select New From Clipboard in Max.

if you include the 3 blocks here in a patch and load it
the last one is set to #1
i'd like to get "default" there

mharter's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Is this what you want to do?

Maa's icon

No but thanks

I think you meant to use sel not split (below a corrected one)

Max Patch
Copy patch and select New From Clipboard in Max.

I want the default message to be trig not for an abstraction used with no name in a patch : yes #1 is replaced by 0 in this case
but when you open the original patch where it is

mharter's icon
Max Patch
Copy patch and select New From Clipboard in Max.

This one will replace the #1 with default when the patch is not an abstraction, but use the first arg if there is one assigned. It will output a zero if no arg is defined.

Maa's icon

YES, I can move on now, THANKS

Max Patch
Copy patch and select New From Clipboard in Max.

in case somebody else need it
I made it faster (I'm a programmer, got to optimize)
it deal also with the no argument case

Maa

jvkr's icon
Max Patch
Copy patch and select New From Clipboard in Max.

You found a solution, but with patcherargs it all becomes simpler.

Maa's icon

yep but so difficult to understand (and test)
when your not a max addict for months
and have only a so clear patcherargs help/reference
could you explain / comment please

jvkr's icon

> could you explain / comment please

Max Patch
Copy patch and select New From Clipboard in Max.

Sure. I forgot that I found the patcherargs object a little intimidating myself when I got to know it.

Maa's icon

Thanks I got it now