I'm working on a project that requires me to be able to freely copy text within a patch from one location to another, but I've run into a couple of problems. One of them is that PD doesn't allow me to transfer semicolons or commas between windows; it treats them as special characters. The second problem is that PD doesn't seem to be able to transfer line breaks from one chunk of text to another. Any help with getting around these two problems would be greatly appreciated.
Problems with Text in Puredata
You are correct that comma and semi-colon are special characters, as they are in many languages.
You can type and copy/paste them, but I assume you are trying to move them around through messages.
That is when they are interpreted.
Comma means "new message", but semi-colon is used to send a message to Pd (it can mean "line break" only in a comment..).
There might be solutions.....translating ascii to decimal and back...... but I think we will need to see your patch..... and as it is not working a little description will help.
The solution (if there is one) will be slightly different for the Vanilla and Extended versions of Pd.
Which are you using?
Thank you for replying.
I'm using PD Extended.
I did find a partial solution to the comma problem. I discovered that [makefilename %c] will produce a comma when fed the number 44, and that this comma can find its way to a canvas object via [zexy/listtosymbol]. However, a "/" is always added to the comma if I send it with other text in the message. I'm not sure if there is a way to get rid of the slash or not. Hopefully there is.
There is really nothing to show, as far as the patch goes. A message box connected to a canvas, correctly transferring everything to its label except commas, line breaks, and semicolons, is the only informative thing you'd see..
I've tried hard to crack this problem but never have. However, there is some respite: Unicode character U+201A (dec 226 128 154) looks just like a comma. Here it is, between the quotation marks: " ‚ " (assuming that it copies correctly). You can safely use this in text without it being interpreted,
As for the semi-colon, I'm still searching for a solution...
@Polaris You can add a comma and you can add a semi-colon to a message like this......
which will not escape the characters ("/").
...... which might help?
You would need to send the message "something like"...... in 1_genie_in_a_bottle.pd
As it is sending a message it can be banged by incoming lists...... so you can use $1, $2...... etc. to include other text, symbols and floats as the message is sent..... like this..... please.pd ..... (JUST updated and simplified).
But it is a very painful exercise.
Useful if you only need to build the "structure" once though (if the message "format" will be stable).
((NOTE: "set" allows you to see the message in the next message box...... BUT if you use "set" the message will not be "sent onwards". If you are setting gui properties you should not use it.))
The method you showed me in "please.pd" does allow me to embed commas inside messages, which is a step up, but semicolons cause line breaks to occur where I don't want them. Also, I need to be able to send the text to a canvas. When I try to do that, the commas and semicolons get interpreted when I don't want them to be.
All I'm trying to do is send a block of natural language text from one location to another where it can be read intact. Surely there is some way to do it.
@Polaris Would you post a text file with the block of natural language please. This is probably the most difficult problem in Pd...... and there is not necessarily a solution.
How do you want it to appear in the canvas?
As a Title, a comment, in a message box?
Do you need to do anything with it afterwards?
Here is a file illustrating my situation: Untitled-1.pd As you can see, the comma gets a slash added to it when it arrives at the canvas as a label.
The text doesn't need to have anything done to it once it arrives at the canvas or whatever object is capable of displaying it. The only thing it needs to be able to do is display a different block of text when prompted to do so.
As I said, Unicode is your best bet: comma.pd. On my machine, you can't paste the character into the patch, but it works if you edit the patch in a text editor. If you have a lot of commas, you can run Find & Replace in a text editor.
I'm afraid that there is no solution I'm aware of for the semi-colon, unless you're OK with Unicode U+204F, the reverse semi-colon! " ⁏ "
@Polaris I agree with @LiamG...... and he has given a very neat solution for the comma.
Unfortunately a "real" semi-colon or comma, once in a message, will be interpreted and can only do damage.
Other characters can be filtered if you need to.........here is an example...... twitter_stack.pd
To use Liams solution you would need to temporarily change your keyboard layout.
So all I have to to do is open the patch in a text editor and paste those codes into the right spots? That will work excellently. Thank you for coming up with that solution. (I just wish there was an easy way to format the text. As it is, I have to insert a semicolon when a line ends and hope that I've positioned it in a way that avoids the appearance of lines ending at different horizontal positions.)