I am doing something like this:
|loadbang| | |symbol $1| | |readfile $1 cr, rewind( | |textfile|
There's also an interface to set the filename later.
Because of the later message processing, it would be nice not to send
the read message if there is no creation arg. Is there a
straightforward way to do that?
Thanks, Bill Gribble
Hallo, Bill Gribble hat gesagt: // Bill Gribble wrote:
I am doing something like this:
|loadbang| | |symbol $1| | |readfile $1 cr, rewind( | |textfile|
There's also an interface to set the filename later.
Use this instead:
[list append $1]
|
[select 0]
|
[nofile( [s $0-FILENAME]
|
[s $0-FILENAME]
Frank
Frank Barknecht wrote:
Hallo, Bill Gribble hat gesagt: // Bill Gribble wrote:
I am doing something like this:
|loadbang| | |symbol $1| | |readfile $1 cr, rewind( | |textfile|
There's also an interface to set the filename later.
Use this instead:
[list append $1] | [select 0] |
[nofile( [s $0-FILENAME] |
[s $0-FILENAME]
since this does not differentiate between no args and "0", i prefer the attached version (too complicated for ascii art)
fmgasdr IOhannes
Ciao
#N canvas 351 18 450 490 10; #X obj 187 246 list append $1; #X msg 138 131 bang; #X obj 134 202 select s; #X obj 134 152 t b b; #X obj 242 179 makefilename $%d-test; #X obj 134 179 symbol $1-test; #X msg 242 159 1; #X obj 187 224 t b; #X obj 8 292 t b; #X text 15 312 no arg given; #X text 217 225 this is $1; #X obj 8 332 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 187 279 print arg1; #X connect 0 0 12 0; #X connect 1 0 3 0; #X connect 2 0 8 0; #X connect 2 1 7 0; #X connect 3 0 5 0; #X connect 3 1 6 0; #X connect 4 0 2 1; #X connect 5 0 2 0; #X connect 6 0 4 0; #X connect 7 0 0 0; #X connect 8 0 11 0;
Hallo, IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:
since this does not differentiate between no args and "0", i prefer the attached version (too complicated for ascii art)
That's neat! I've never tought of this approach, thanks for posting.
Frank Barknecht _ ______footils.org__
On Tue, 2008-10-14 at 13:56 +0200, IOhannes m zmoelnig wrote:
since this does not differentiate between no args and "0", i prefer the attached version (too complicated for ascii art)
fmgasdr IOhannes
wow! this is smart. how often could i have used that! i wonder now, if there are other uses as well of using a dollar argument this way.
thanks for sharing!
roman
___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
On Oct 14, 2008, at 7:56 AM, IOhannes m zmoelnig wrote:
Frank Barknecht wrote:
Hallo, Bill Gribble hat gesagt: // Bill Gribble wrote:
I am doing something like this:
|loadbang| | |symbol $1| | |readfile $1 cr, rewind( | |textfile|
There's also an interface to set the filename later.
Use this instead: [list append $1] | [select 0] |
[nofile( [s $0-FILENAME] | [s $0-FILENAME]since this does not differentiate between no args and "0", i prefer
the attached version (too complicated for ascii art)fmgasdr IOhannes
Wow, that is a crazy hack, I don't quite get how it works. I guess
if there are no args, then Pd doesn't do the replacement at all?
Then the 0 comes from things being inited to 0?
That would be awesome to have as a reusable abstraction, but that
sounds tough.
.hc
Ciao
#N canvas 351 18 450 490 10; #X obj 187 246 list append $1; #X msg 138 131 bang; #X obj 134 202 select s; #X obj 134 152 t b b; #X obj 242 179 makefilename $%d-test; #X obj 134 179 symbol $1-test; #X msg 242 159 1; #X obj 187 224 t b; #X obj 8 292 t b; #X text 15 312 no arg given; #X text 217 225 this is $1; #X obj 8 332 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 187 279 print arg1; #X connect 0 0 12 0; #X connect 1 0 3 0; #X connect 2 0 8 0; #X connect 2 1 7 0; #X connect 3 0 5 0; #X connect 3 1 6 0; #X connect 4 0 2 1; #X connect 5 0 2 0; #X connect 6 0 4 0; #X connect 7 0 0 0; #X connect 8 0 11 0; _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
"Free software means you control what your computer does. Non-free
software means someone else controls that, and to some extent
controls you." - Richard M. Stallman
This a very nice method, thanx.
But there is something strange in this abstraction according to the
help page about [list].
I can read [list] short for [list append] but this is not true.
In this abstraction if you replace [list append] by [list] and you
enter a 'symbol' as argument, you have this error :
list $1
... couldn't create
This is just a remark.
++
Jack
Le 14 oct. 08 à 13:56, IOhannes m zmoelnig a écrit :
Frank Barknecht wrote:
Hallo, Bill Gribble hat gesagt: // Bill Gribble wrote:
I am doing something like this:
|loadbang| | |symbol $1| | |readfile $1 cr, rewind( | |textfile|
There's also an interface to set the filename later.
Use this instead: [list append $1] | [select 0] |
[nofile( [s $0-FILENAME] | [s $0-FILENAME]since this does not differentiate between no args and "0", i prefer
the attached version (too complicated for ascii art)fmgasdr IOhannes
Ciao
#N canvas 351 18 450 490 10; #X obj 187 246 list append $1; #X msg 138 131 bang; #X obj 134 202 select s; #X obj 134 152 t b b; #X obj 242 179 makefilename $%d-test; #X obj 134 179 symbol $1-test; #X msg 242 159 1; #X obj 187 224 t b; #X obj 8 292 t b; #X text 15 312 no arg given; #X text 217 225 this is $1; #X obj 8 332 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 187 279 print arg1; #X connect 0 0 12 0; #X connect 1 0 3 0; #X connect 2 0 8 0; #X connect 2 1 7 0; #X connect 3 0 5 0; #X connect 3 1 6 0; #X connect 4 0 2 1; #X connect 5 0 2 0; #X connect 6 0 4 0; #X connect 7 0 0 0; #X connect 8 0 11 0; _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
So I tried to use this within an abstraction, so it is reusable.
Unforunately, the $1 gets initialized to 0 before it is sent to the
abstraction, so this technique doesn't work as is.
Any ideas for how to make it work?
.hc
On Oct 24, 2008, at 11:24 AM, Jack wrote:
This a very nice method, thanx. But there is something strange in this abstraction according to the help page about [list]. I can read [list] short for [list append] but this is not true. In this abstraction if you replace [list append] by [list] and you enter a 'symbol' as argument, you have this error : list $1 ... couldn't create This is just a remark. ++
Jack
Le 14 oct. 08 à 13:56, IOhannes m zmoelnig a écrit :
Frank Barknecht wrote:
Hallo, Bill Gribble hat gesagt: // Bill Gribble wrote:
I am doing something like this:
|loadbang| | |symbol $1| | |readfile $1 cr, rewind( | |textfile|
There's also an interface to set the filename later.
Use this instead: [list append $1] | [select 0] |
[nofile( [s $0-FILENAME] | [s $0-FILENAME]since this does not differentiate between no args and "0", i prefer the attached version (too complicated for ascii art)
fmgasdr IOhannes
Ciao
#N canvas 351 18 450 490 10; #X obj 187 246 list append $1; #X msg 138 131 bang; #X obj 134 202 select s; #X obj 134 152 t b b; #X obj 242 179 makefilename $%d-test; #X obj 134 179 symbol $1-test; #X msg 242 159 1; #X obj 187 224 t b; #X obj 8 292 t b; #X text 15 312 no arg given; #X text 217 225 this is $1; #X obj 8 332 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 187 279 print arg1; #X connect 0 0 12 0; #X connect 1 0 3 0; #X connect 2 0 8 0; #X connect 2 1 7 0; #X connect 3 0 5 0; #X connect 3 1 6 0; #X connect 4 0 2 1; #X connect 5 0 2 0; #X connect 6 0 4 0; #X connect 7 0 0 0; #X connect 8 0 11 0; _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
http://at.or.at/hans/