Forums > MaxMSP

Delete a space in a text box

September 27, 2007 | 9:30 am


September 27, 2007 | 10:09 am

use sprintf instead of prepend to join strings

max

On Sep 27, 2007, at 11:30 AM, cedric dumetz wrote:

> Hi all,
>
> I’m trying to delete a space in a text box.
> The text box contain an address of a file (like C:/ Clip0.mov), but
> for it work i should have C:/Clip0.mov (without the space)
> Predend make automatically it.
>
> Thanks for your attention.
>
>
>
> max v2;
> #N vpatcher 95 94 695 494;
> #P origin -41 0;
> #P window setfont "Sans Serif" 9.;
> #P newex 200 128 27 9109513 t b b;
> #P newex 201 107 45 9109513 loadbang;
> #P newex 112 105 56 9109513 loadmess 0;
> #P newex 79 195 74 9109513 prepend append;
> #P number 70 108 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 291 193 57 9109513 prepend set;
> #P message 196 252 185 9109513 D:/ Clip0.mov;
> #P newex 249 106 73 9109513 loadmess path;
> #P newex 292 149 57 9109513 prepend set;
> #P message 292 172 257 9109513 D:/;
> #N thispatcher;
> #Q end;
> #P newobj 249 127 54 9109513 thispatcher;
> #P message 79 173 152 9109513 Clip0.mov;
> #P newex 70 128 102 9109513 sprintf set Clip%i.mov;
> #P window linecount 2;
> #P comment 196 271 100 9109513 I want to delete the space before
> Clip0;
> #P connect 9 0 1 0;
> #P connect 11 0 1 0;
> #P connect 1 0 2 0;
> #P connect 13 0 2 0;
> #P connect 2 0 10 0;
> #P connect 8 0 7 0;
> #P connect 10 0 7 0;
> #P connect 12 0 13 0;
> #P connect 6 0 3 0;
> #P connect 4 0 8 0;
> #P connect 3 1 5 0;
> #P connect 5 0 4 0;
> #P connect 13 1 4 0;
> #P pop;
>
>
>
>
> La nouvelle version de MSN Hotmail! Windows Live Hotmail

_____________________________________________

m a x i m i l i a n m a r c o l l

http://www.maximilianmarcoll.de


September 27, 2007 | 10:25 am


September 27, 2007 | 10:28 am

Hi,
why not keep on using [sprintf] ??

max v2;
#N vpatcher 579 126 1373 421;
#P origin -41 0;
#P window setfont "Sans Serif" 9.;
#P newex 274 166 57 9109513 prepend set;
#P message 274 190 245 9109513 E:/dGarden Max Project/dGworks/_FORUM/Clip0.mov;
#P newex 274 91 93 9109513 t b i;
#P newex 522 164 57 9109513 prepend set;
#P newex 274 143 93 9109513 sprintf %s%s;
#P newex 274 40 56 9109513 loadmess 0;
#P number 274 71 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 24 93 73 9109513 loadmess path;
#P newex 68 168 63 9109513 prepend set;
#P message 68 191 203 9109513 "E:/dGarden Max Project/dGworks/_FORUM/";
#N thispatcher;
#Q end;
#P newobj 24 114 54 9109513 thispatcher;
#P message 522 190 152 9109513 Clip0.mov;
#P newex 357 116 86 9109513 sprintf Clip%i.mov;
#P connect 5 0 2 0;
#P connect 2 1 4 0;
#P connect 4 0 3 0;
#P connect 7 0 6 0;
#P connect 6 0 10 0;
#P fasten 2 1 8 0 73 138 279 138;
#P connect 10 0 8 0;
#P connect 8 0 12 0;
#P connect 12 0 11 0;
#P connect 10 1 0 0;
#P connect 0 0 8 1;
#P connect 0 0 9 0;
#P connect 9 0 1 0;
#P pop;


September 27, 2007 | 10:42 am

Hi,

Just for the record, I would recommend the use of the symout argument
in thoses cases, in order to take care of the possible spaces in the
file/folder names. If you use [sprintf symout %s%s] you’re certain to
get a valid symbol.

Cheers,
ej


September 27, 2007 | 11:37 am

hi cedric,
try using sprintf con construct the filename, eg.:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 227 89 27 196617 t b i;
#P message 119 157 249 196617

;
#P newex 119 137 62 196617 prepend set;
#P number 227 66 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 140 247 262 196617
Clip0.mov;
#P newex 140 222 62 196617 prepend set;
#P newex 68 96 73 196617 loadmess path;
#N thispatcher;
#Q end;
#P newobj 68 117 61 196617 thispatcher;
#P newex 140 194 114 196617 sprintf %sClip%ld.mov;
#P connect 2 0 1 0;
#P connect 1 1 6 0;
#P connect 8 0 7 0;
#P connect 6 0 7 0;
#P connect 3 0 4 0;
#P connect 7 0 0 0;
#P connect 0 0 3 0;
#P connect 5 0 8 0;
#P connect 8 1 0 1;
#P window clipboard copycount 9;

On Sep 27, 2007, at 4:30 AM, cedric dumetz wrote:

> Hi all,
>
> I’m trying to delete a space in a text box.
> The text box contain an address of a file (like C:/ Clip0.mov), but
> for it work i should have C:/Clip0.mov (without the space)
> Predend make automatically it.
>
> Thanks for your attention.
>
>
>
> max v2;
> #N vpatcher 95 94 695 494;
> #P origin -41 0;
> #P window setfont "Sans Serif" 9.;
> #P newex 200 128 27 9109513 t b b;
> #P newex 201 107 45 9109513 loadbang;
> #P newex 112 105 56 9109513 loadmess 0;
> #P newex 79 195 74 9109513 prepend append;
> #P number 70 108 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 291 193 57 9109513 prepend set;
> #P message 196 252 185 9109513 D:/ Clip0.mov;
> #P newex 249 106 73 9109513 loadmess path;
> #P newex 292 149 57 9109513 prepend set;
> #P message 292 172 257 9109513 D:/;
> #N thispatcher;
> #Q end;
> #P newobj 249 127 54 9109513 thispatcher;
> #P message 79 173 152 9109513 Clip0.mov;
> #P newex 70 128 102 9109513 sprintf set Clip%i.mov;
> #P window linecount 2;
> #P comment 196 271 100 9109513 I want to delete the space before
> Clip0;
> #P connect 9 0 1 0;
> #P connect 11 0 1 0;
> #P connect 1 0 2 0;
> #P connect 13 0 2 0;
> #P connect 2 0 10 0;
> #P connect 8 0 7 0;
> #P connect 10 0 7 0;
> #P connect 12 0 13 0;
> #P connect 6 0 3 0;
> #P connect 4 0 8 0;
> #P connect 3 1 5 0;
> #P connect 5 0 4 0;
> #P connect 13 1 4 0;
> #P pop;
>
>
>
>
> La nouvelle version de MSN Hotmail! Windows Live Hotmail


Viewing 6 posts - 1 through 6 (of 6 total)