adding quotes to string…

Aug 7, 2006 at 2:17pm

adding quotes to string…

I am trying to add quotes around a string. Given the string:

MIDISportster USB Input

I want to add quotes around it and prepend port so that I can send it
to midiin. Like so:

port “MIDISportster USB Input”

I tried to use sprintf but it will not put the quotes around my string.
How can do this?

Thanks,
Anthony

#27061
Aug 7, 2006 at 2:28pm

#81541
Aug 7, 2006 at 2:33pm

#81542
Aug 7, 2006 at 2:48pm

#81543
Aug 7, 2006 at 2:56pm

#81544
Aug 7, 2006 at 3:21pm

#81545
Aug 7, 2006 at 3:23pm

#81546
Aug 7, 2006 at 5:28pm

On 7-Aug-2006, at 17:23, apalomba@austin.rr.com wrote:
> Actually, try this instead…

So I did. What’s the problem (aside from a few objects that seem
superfluous)?

Quotation marks in a message box of in sprintf tell the Max parser
that you have a symbol with embedded whitespace. Once Max knows it’s
a symbol, it doesn’t need to display the quotation marks for all
eternity, so you don’t see them when you send the symbol to a print
object or the like.

As long as Max treats the thing as as symbol, what’s the problem?

– P.

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 326 152 40 196617 print;
#P button 263 180 38 0;
#P newex 263 122 74 196617 prepend port;
#P user ubumenu 263 51 103 196617 0 1 1 1;
#X setrgb 255 255 255 0 0 0 99 99 99 4 4 4 141 141 141 112 112 112;
#X add “to Max/MSP 1″;
#X add “to Max/MSP 2″;
#X prefix_set 0 0 0;
#X pattrmode 1;
#P newex 263 147 40 196617 midiin a;
#P newex 263 98 47 196617 tosymbol;
#N vpatcher 165 360 533 678;
#P inlet 197 25 15 0;
#P window setfont “Sans Serif” 9.;
#P message 197 77 16 196617 -1;
#P newex 198 106 45 196617 midiinfo;
#P newex 197 45 45 196617 loadbang;
#N comlet Midi Input Devices;
#P outlet 198 263 15 0;
#P connect 4 0 1 0;
#P connect 1 0 3 0;
#P connect 2 0 0 0;
#P fasten 3 0 2 1 202 100 238 100;
#P pop;
#P newobj 263 27 60 196617 p MIDISetup;
#P connect 4 0 2 0;
#P connect 4 0 6 0;
#P fasten 3 1 1 0 314 72 268 72;
#P connect 1 0 4 0;
#P connect 2 0 5 0;
#P connect 0 0 3 0;
#P window clipboard copycount 7;

————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine +–> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de

#81547
Aug 7, 2006 at 6:20pm

Thr problem is it does not work. midiin in does
not recognize the quotes unless you explicitly type
them in a message box. We you able to change
MIDI input ports with the sample I sent?

—– Original Message —–
From: Peter Castine

Date: Monday, August 7, 2006 12:43 pm
Subject: Re: [maxmsp] adding quotes to string…

> On 7-Aug-2006, at 17:23, apalomba@austin.rr.com wrote:
> > Actually, try this instead…
>
> So I did. What’s the problem (aside from a few objects that seem
> superfluous)?
>
> Quotation marks in a message box of in sprintf tell the Max parser
>
> that you have a symbol with embedded whitespace. Once Max knows
> it’s
> a symbol, it doesn’t need to display the quotation marks for all
> eternity, so you don’t see them when you send the symbol to a
> print
> object or the like.
>
> As long as Max treats the thing as as symbol, what’s the problem?
>
> — P.
>
> #P window setfont “Sans Serif” 9.;
> #P window linecount 1;
> #P newex 326 152 40 196617 print;
> #P button 263 180 38 0;
> #P newex 263 122 74 196617 prepend port;
> #P user ubumenu 263 51 103 196617 0 1 1 1;
> #X setrgb 255 255 255 0 0 0 99 99 99 4 4 4 141 141 141 112 112 112;
> #X add “to Max/MSP 1″;
> #X add “to Max/MSP 2″;
> #X prefix_set 0 0 0;
> #X pattrmode 1;
> #P newex 263 147 40 196617 midiin a;
> #P newex 263 98 47 196617 tosymbol;
> #N vpatcher 165 360 533 678;
> #P inlet 197 25 15 0;
> #P window setfont “Sans Serif” 9.;
> #P message 197 77 16 196617 -1;
> #P newex 198 106 45 196617 midiinfo;
> #P newex 197 45 45 196617 loadbang;
> #N comlet Midi Input Devices;
> #P outlet 198 263 15 0;
> #P connect 4 0 1 0;
> #P connect 1 0 3 0;
> #P connect 2 0 0 0;
> #P fasten 3 0 2 1 202 100 238 100;
> #P pop;
> #P newobj 263 27 60 196617 p MIDISetup;
> #P connect 4 0 2 0;
> #P connect 4 0 6 0;
> #P fasten 3 1 1 0 314 72 268 72;
> #P connect 1 0 4 0;
> #P connect 2 0 5 0;
> #P connect 0 0 3 0;
> #P window clipboard copycount 7;
>
>
> ————– http://www.bek.no/~pcastine/Litter/ ———-
> —
> Peter Castine +–> Litter Power & Litter Bundle for Jitter
> Universal Binaries on the way
> iCE: Sequencing, Recording &
> Interface Building for |home | chez
> nous| Max/MSP Extremely cool |bei uns |
> i nostri|
> http://www.dspaudio.com/
> http://www.castine.de
>
>

#81548
Aug 7, 2006 at 8:13pm

On 7-Aug-2006, at 20:20, apalomba@austin.rr.com wrote:

> We[re] you able to change
> MIDI input ports with the sample I sent?

Yes.

————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine +–> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de

#81549
Aug 11, 2006 at 12:43pm

apalomba@austin.rr.com wrote:
> Thr problem is it does not work. midiin in does
> not recognize the quotes unless you explicitly type
> them in a message box. We you able to change
> MIDI input ports with the sample I sent?

If you look at the midiin help file, you might try the idea that it does
not require the port message…

If you want to check for quotation marks, use:
prepend set -> message box
instead of print…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#81550

You must be logged in to reply to this topic.