<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Cheers for that, I would have found it sooner or later, we should probably mark this OT by now 'cause we're outside of pd talk, but this is really helpful, thanks. I'm slowly but surely getting it.<br><br>&gt; Date: Thu, 25 Mar 2010 14:19:25 -0700<br>&gt; Subject: Re: [PD] any mac OS terminal experts?<br>&gt; From: aturley@acm.org<br>&gt; To: jbturgid@hotmail.com<br>&gt; CC: pd-list@iem.at<br>&gt; <br>&gt; In Ruby you should be able to do this:<br>&gt;   myvar = 42<br>&gt;   s.puts("#{myvar} ;")<br>&gt; <br>&gt; andy<br>&gt; <br>&gt; On Thu, Mar 25, 2010 at 2:12 PM, Andrew Faraday &lt;jbturgid@hotmail.com&gt; wrote:<br>&gt; &gt; Thanks a bunch for this, it is, effectively, what I wanted to do with pdsend<br>&gt; &gt; and pdreceive. The only problem now is sending a variable I've defined via<br>&gt; &gt; this method, as opposed to the variable name, and I'm sure that's just<br>&gt; &gt; 'cause I'm new to ruby.<br>&gt; &gt;<br>&gt; &gt;&gt; Date: Thu, 25 Mar 2010 12:16:07 -0700<br>&gt; &gt;&gt; Subject: Re: [PD] any mac OS terminal experts?<br>&gt; &gt;&gt; From: aturley@acm.org<br>&gt; &gt;&gt; To: jbturgid@hotmail.com; pd-list@iem.at<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; So first off, you don't need to call them with 'open' from the command<br>&gt; &gt;&gt; line. You can just run them directly like any other command, like<br>&gt; &gt;&gt; this:<br>&gt; &gt;&gt; echo "a b c 1 2 3;" |<br>&gt; &gt;&gt; /Applications/Pd-extended.app/Contents/Resources/bin/pdsend 3939<br>&gt; &gt;&gt; The command reads the standard input and sends the data to PD.<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; Assuming you have a PD patch running with a netrecieve object<br>&gt; &gt;&gt; listening to port 3939, you can send the same message as above with<br>&gt; &gt;&gt; this Ruby code:<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; require 'socket'<br>&gt; &gt;&gt; hostname = "localhost"<br>&gt; &gt;&gt; port = 3939<br>&gt; &gt;&gt; s = TCPSocket.open(hostname, port)<br>&gt; &gt;&gt; # don't forget the semicolon!<br>&gt; &gt;&gt; s.puts("a b c 1 2 3;")<br>&gt; &gt;&gt; s.close()<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; andy<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; On Thu, Mar 25, 2010 at 11:28 AM, Andrew Faraday &lt;jbturgid@hotmail.com&gt;<br>&gt; &gt;&gt; wrote:<br>&gt; &gt;&gt; &gt; I mean both opening them in finder and using 'open pdsend' in the<br>&gt; &gt;&gt; &gt; terminal,<br>&gt; &gt;&gt; &gt; same result. I'm not up to socket programming in Ruby. But knowing that<br>&gt; &gt;&gt; &gt; it's<br>&gt; &gt;&gt; &gt; possible to communicate directly is a good start. Now, how do it do it?<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;&gt; Date: Thu, 25 Mar 2010 11:13:12 -0700<br>&gt; &gt;&gt; &gt;&gt; Subject: Re: [PD] any mac OS terminal experts?<br>&gt; &gt;&gt; &gt;&gt; From: aturley@acm.org<br>&gt; &gt;&gt; &gt;&gt; To: jbturgid@hotmail.com<br>&gt; &gt;&gt; &gt;&gt; CC: pd-list@iem.at<br>&gt; &gt;&gt; &gt;&gt;<br>&gt; &gt;&gt; &gt;&gt; You should be able to run them from the command line. When you say<br>&gt; &gt;&gt; &gt;&gt; that you are "opening the files", do you mean you're clicking on them<br>&gt; &gt;&gt; &gt;&gt; in the Finder? As you've said, that will just open up a terminal<br>&gt; &gt;&gt; &gt;&gt; window.<br>&gt; &gt;&gt; &gt;&gt;<br>&gt; &gt;&gt; &gt;&gt; Also, these commands just communicate with strings over a TCP socket.<br>&gt; &gt;&gt; &gt;&gt; If you're comfortable with socket programming in Ruby then you don't<br>&gt; &gt;&gt; &gt;&gt; even have to use pdsend and pdreceive.<br>&gt; &gt;&gt; &gt;&gt;<br>&gt; &gt;&gt; &gt;&gt; andy<br>&gt; &gt;&gt; &gt;&gt;<br>&gt; &gt;&gt; &gt;&gt; On Thu, Mar 25, 2010 at 10:55 AM, Andrew Faraday &lt;jbturgid@hotmail.com&gt;<br>&gt; &gt;&gt; &gt;&gt; wrote:<br>&gt; &gt;&gt; &gt;&gt; &gt; Hey All<br>&gt; &gt;&gt; &gt;&gt; &gt; I've recently started learning Ruby (on Ubuntu 9.04), part of what<br>&gt; &gt;&gt; &gt;&gt; &gt; I'm<br>&gt; &gt;&gt; &gt;&gt; &gt; trying to do is control PD through ruby, using the terminal.<br>&gt; &gt;&gt; &gt;&gt; &gt; The main trouble I'm having now is that I'm mostly using a Mac OS X<br>&gt; &gt;&gt; &gt;&gt; &gt; machine<br>&gt; &gt;&gt; &gt;&gt; &gt; which doesn't recognize the 'pdsend' and 'pdreceive' commands (as the<br>&gt; &gt;&gt; &gt;&gt; &gt; linux<br>&gt; &gt;&gt; &gt;&gt; &gt; shell does). I've tried opening the files with these names in<br>&gt; &gt;&gt; &gt;&gt; &gt; /resources/bin<br>&gt; &gt;&gt; &gt;&gt; &gt; which open a new terminal window and display what looks like the<br>&gt; &gt;&gt; &gt;&gt; &gt; relevant<br>&gt; &gt;&gt; &gt;&gt; &gt; -help text. But I can't seem to use these to send messages to and<br>&gt; &gt;&gt; &gt;&gt; &gt; from<br>&gt; &gt;&gt; &gt;&gt; &gt; pd<br>&gt; &gt;&gt; &gt;&gt; &gt; from the Mac OS terminal. (in theory I could then automate this with<br>&gt; &gt;&gt; &gt;&gt; &gt; Ruby).<br>&gt; &gt;&gt; &gt;&gt; &gt; Any ideas, at all?<br>&gt; &gt;&gt; &gt;&gt; &gt; ________________________________<br>&gt; &gt;&gt; &gt;&gt; &gt; Not got a Hotmail account? Sign-up now - Free<br>&gt; &gt;&gt; &gt;&gt; &gt; _______________________________________________<br>&gt; &gt;&gt; &gt;&gt; &gt; Pd-list@iem.at mailing list<br>&gt; &gt;&gt; &gt;&gt; &gt; UNSUBSCRIBE and account-management -&gt;<br>&gt; &gt;&gt; &gt;&gt; &gt; http://lists.puredata.info/listinfo/pd-list<br>&gt; &gt;&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; ________________________________<br>&gt; &gt;&gt; &gt; Not got a Hotmail account? Sign-up now - Free<br>&gt; &gt;<br>&gt; &gt; ________________________________<br>&gt; &gt; Do you want a Hotmail account? Sign-up now - Free<br>                                               <br /><hr />Do you have a story that started on Hotmail? <a href='http://clk.atdmt.com/UKM/go/195013117/direct/01/' target='_new'>Tell us now</a></body>
</html>