Hallo, ronny vanden bempt hat gesagt: // ronny vanden bempt wrote:
In several patches I had the following problem: I make a patch that I'm going to use in another patch. To make it possible to use several of these subpatches in the main patch, I add a dollarsign where needed. But when I apply this to arrays, I cannot make it work. For example a block that applies a window. It's nothing more than a tabread block. But I have four files with a window in. So I call the array to read: $1-window. But when I want to read it with a message: $1-window read gaussBig.txt, it doesn't load. Probably this is because of the ambiguity between dollarsigns in a message and elsewhere,
Exactly this is the reason. (Read on)
or maybe due to the dollarsign not being replaced in the name of an array.
This is not the reason: Array names are just like any other name in Pd, no exception.
But as you already wrote: dollar signs in messages and dollar signs in object boxes are different. They are similar in that they both get replaced by "something". But this "something" is different: message boxes use, what they receive through their inlet, to do $-replacements. You've probably already used this for example to generate an "read file" message, for example for [textfile], when using [openpanel]. It looks like this:
[bang( | [openpanel] | [read $1( | [textfile]
[openpanel] will send a message like "symbol /tmp/file.txt". The $1 in "read $1" will take the first element of this message (counted without the "symbol"-thing) and replace $1 with that so that you get a "read /tmp/file.txt" message to [textfile].
In object boxes, $-variables however take the arguments that *a patch* was created with to do the replacement. Patch arguments aren't bound to messages. Even objects that don't have inlets for messages *at all* can use argument dollar signs: an example would be [r $1-something].
Now what you need to do is convert a dollarsign as it is used in object boxes to one, that is used in a message. That's actually very simple: You first create an object with a dollarsign to get the "object dollar", and then you connect this object to a message box with a "message dollar" inside. Example:
[bang( | [symbol $1] | [read $1( | [textfile]
The number - 1 in the example - can even be different, depending on where your wanted argument is:
[bang( | [symbol $3] | [read $1( | [textfile]
That is possible, because object dollars and message dollars are completely independent from each other.
Oh, and don't forget this: $0 is something else again and there is no $0 in a message box.
Frank Barknecht _ ______footils.org_ __goto10.org__