hi!
I cannot get this to work:
[echo "bla" >> textfile.txt(
|
[shell]
|
[print]
In textfile.txt, I get nothing, and in the console I get:
"bla" >> textfile.txt
as if all the command is a string.
[shell]: echo to a textfile
hi!
I cannot get this to work:
[echo "bla" >> textfile.txt(
|
[shell]
|
[print]
In textfile.txt, I get nothing, and in the console I get:
"bla" >> textfile.txt
as if all the command is a string.
Kubuntu 22.04 / KX repositories :: linux-realtime kernel :: jack2 :: PD vanilla
thank you, I didn't know about [command].
I get exactly the same result. I wonder if it is not a format issue. I tried to escape spaces, but it returns an error
test_command-object.pd
concat.pd
Kubuntu 22.04 / KX repositories :: linux-realtime kernel :: jack2 :: PD vanilla
@rph-r Pipes and redirection don't work with [command] (or shell) which is why I went with the trick using tee
, down to how they quote things for safety reasons, everything after the command is quoted and what you run in that case is exec echo "'bla' >> ~/bli.txt"
The lniked thread shows how to work around that limitation with the goal of logging to a text file which seems to be what you are attempting to accomplish? Or is this just a test for something else? Going with Tcl can provide more elegant solutions but if this is for the same project as your other thread you might not have the gui for tcl?
Edit: Might be able to work around this quirk with eval
, quick test suggests not but I did not explore it deeply. Command substitution also can not be used with [command].
by Tcl you mean netsend? I'm using it locally with pdreceive, I receive the messages but only with the backslashes escape characters.
Kubuntu 22.04 / KX repositories :: linux-realtime kernel :: jack2 :: PD vanilla
@rph-r If you have the gui running you can write a gui plugin to write the text file, you would have something like this in your patch:
[list prepend plugin-dispatch append_log]
|
[list trim]
|
[s pd]
and then in your gui plugin which needs to be saved in your path with the -plugin.tcl suffix:
set f [open log.txt a]
proc append_log {args} {
puts ::$f $args
}
Untested, been awhile since I wrote to a file in tcl and like I said this method requires the gui to be running since there will be no tcl without it.
@rph-r Not sure what you need to write to the text file, but if it is data available in a patch you could use [textfile] which is a standard object in Pd.
David.
I've tried with [textfile] some times ago, I don't remember why it wasn't working.
Anyway, I found a way
This is working well, and doesn't escape the backslashes (therefore they don't appear in the textfile)
Kubuntu 22.04 / KX repositories :: linux-realtime kernel :: jack2 :: PD vanilla
@rph-r Didn't know escaping with [command] worked now, good to know. Wonder how many years I have been doing unneeded elaborate work arounds.
Oops! Looks like something went wrong!