Re: [PD] makefilename multiple substitutions
On Mon, Nov 15, 2021 at 01:46:41AM +0100, Max wrote: > OK, got it. It's not shaving off one % per depth, it actually removing every > other % on each iteration, so the # of escaping symbols (%) grows > exponentially. > Maybe should lower my screen resolution to see the number of %% symbols > more clearly. > Hmm, well, Pd was originally developed for a 640x480 screen :) M > > On 15.11.21 01:22, Max wrote: > > No the help patch is perfectly clear but it only works two depth levels > > Pd version 0.52.0-test1 > > > > > > On 15.11.21 00:56, Christof Ressi wrote: > > > You have to escape *each* "%" with a leading "%", so your format > > > string should be "02d:%%02d:%02d" > > > > > > The help patch actually shows this: > > > > > > > "" becomes "%%" and so on > > > Maybe the wording is not clear enough, though? > > > > > > Christof > > > > > > On 14.11.2021 23:55, Max wrote: > > > > hi list, > > > > > > > > The helpfile for makefilename has a subpatch "multiple > > > > substitutions" in which it says: > > > > > > > > You can connect two or more objects for multiple substitutions. > > > > For that, you need to use a literal '%' to set the format string > > > > of another makefilename object. > > > > LITERAL %: You can format a string with a literal '%' if you > > > > escape it with another '%' (where "%%" becomes "%", "" > > > > becomes "%%" and so on) > > > > > > > > however, just a depth of two substitutions is in the example. I > > > > extended this to three and got the error: > > > > > > > > makefilename: invalid format string '%%%02d:%%02d:%02d' (too > > > > many format specifiers) > > > > > > > > (Yes you guessed right, trying to generate SMPTE from milliseconds) > > > > > > > > M. > > > > > > > > > > > > > > > > ___ > > > > Pd-list@lists.iem.at mailing list > > > > UNSUBSCRIBE and account-management -> > > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Dlist&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=HPcNMtsap2MKn6OVDGpQDGDCJHbHJNTdOv9iIvxylmc-7ZZLeDbNde-AwU58ijCd&s=o_3OjXNO4PIcjOkHjIFPZdjfe_uey0L-8zhWHUc9wuc&e= > > > > > > > > > > > > ___ > > > Pd-list@lists.iem.at mailing list > > > UNSUBSCRIBE and account-management -> > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Dlist&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=HPcNMtsap2MKn6OVDGpQDGDCJHbHJNTdOv9iIvxylmc-7ZZLeDbNde-AwU58ijCd&s=o_3OjXNO4PIcjOkHjIFPZdjfe_uey0L-8zhWHUc9wuc&e= > > > > ___ > > Pd-list@lists.iem.at mailing list > > UNSUBSCRIBE and account-management -> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Dlist&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=HPcNMtsap2MKn6OVDGpQDGDCJHbHJNTdOv9iIvxylmc-7ZZLeDbNde-AwU58ijCd&s=o_3OjXNO4PIcjOkHjIFPZdjfe_uey0L-8zhWHUc9wuc&e= > > > > > > > ___ > Pd-list@lists.iem.at mailing list > UNSUBSCRIBE and account-management -> > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Dlist&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=HPcNMtsap2MKn6OVDGpQDGDCJHbHJNTdOv9iIvxylmc-7ZZLeDbNde-AwU58ijCd&s=o_3OjXNO4PIcjOkHjIFPZdjfe_uey0L-8zhWHUc9wuc&e= -- ___ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Re: [PD] makefilename multiple substitutions
OK, got it. It's not shaving off one % per depth, it actually removing every other % on each iteration, so the # of escaping symbols (%) grows exponentially. Maybe should lower my screen resolution to see the number of %% symbols more clearly. On 15.11.21 01:22, Max wrote: No the help patch is perfectly clear but it only works two depth levels Pd version 0.52.0-test1 On 15.11.21 00:56, Christof Ressi wrote: You have to escape *each* "%" with a leading "%", so your format string should be "02d:%%02d:%02d" The help patch actually shows this: "" becomes "%%" and so on Maybe the wording is not clear enough, though? Christof On 14.11.2021 23:55, Max wrote: hi list, The helpfile for makefilename has a subpatch "multiple substitutions" in which it says: You can connect two or more objects for multiple substitutions. For that, you need to use a literal '%' to set the format string of another makefilename object. LITERAL %: You can format a string with a literal '%' if you escape it with another '%' (where "%%" becomes "%", "" becomes "%%" and so on) however, just a depth of two substitutions is in the example. I extended this to three and got the error: makefilename: invalid format string '%%%02d:%%02d:%02d' (too many format specifiers) (Yes you guessed right, trying to generate SMPTE from milliseconds) M. ___ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list ___ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list ___ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list ___ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Re: [PD] makefilename multiple substitutions
No the help patch is perfectly clear but it only works two depth levels Pd version 0.52.0-test1 On 15.11.21 00:56, Christof Ressi wrote: You have to escape *each* "%" with a leading "%", so your format string should be "02d:%%02d:%02d" The help patch actually shows this: "" becomes "%%" and so on Maybe the wording is not clear enough, though? Christof On 14.11.2021 23:55, Max wrote: hi list, The helpfile for makefilename has a subpatch "multiple substitutions" in which it says: You can connect two or more objects for multiple substitutions. For that, you need to use a literal '%' to set the format string of another makefilename object. LITERAL %: You can format a string with a literal '%' if you escape it with another '%' (where "%%" becomes "%", "" becomes "%%" and so on) however, just a depth of two substitutions is in the example. I extended this to three and got the error: makefilename: invalid format string '%%%02d:%%02d:%02d' (too many format specifiers) (Yes you guessed right, trying to generate SMPTE from milliseconds) M. ___ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list ___ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list #N canvas 315 246 603 433 12; #X obj 133 111 timer 1 msec; #X msg 214 74 bang; #X msg 133 46 bang; #X listbox 133 294 20 0 0 0 - - - 0; #X floatatom 152 151 10 0 0 0 - - - 0; #X msg 156 209 fps 24; #X msg 218 211 msec; #X obj 133 254 smpte 25; #X listbox 293 295 20 0 0 0 - - - 0; #X connect 0 0 4 0; #X connect 0 0 7 0; #X connect 1 0 0 1; #X connect 2 0 0 0; #X connect 5 0 7 0; #X connect 6 0 7 0; #X connect 7 0 3 0; #X connect 7 1 8 0; #N canvas 208 230 1656 682 12; #X obj 50 7 inlet; #X obj 50 549 outlet; #X text 59 598 hour:minute:second:frame; #X obj 50 255 / 1000; #X obj 432 266 % 1000; #X obj 432 380 / 1000; #X obj 432 432 int; #X obj 304 414 % 60; #X obj 50 355 div 60; #X obj 50 226 t f f, f 50; #X obj 50 286 t f f, f 24; #X obj 432 461 makefilename %02d; #X obj 304 461 makefilename %02d; #X obj 177 461 makefilename %02d; #X obj 50 493 pack s s s s, f 55; #X obj 177 428 % 60; #X obj 50 427 div 60; #X obj 50 390 t f f, f 15; #X obj 50 461 makefilename %02d; #X msg 50 520 symbol \$1:\$2:\$3:\$4; #X obj 50 119 route float, f 55; #X obj 564 461 makefilename %003d; #X obj 432 352 route fps msec, f 31; #X obj 432 289 list prepend fps; #X obj 432 404 *, f 20; #X obj 541 87 loadbang; #X obj 541 112 \$1; #X msg 541 141 fps \$1; #X obj 541 220 t b f; #X msg 541 252 fps; #X msg 612 255 msec; #X obj 612 215 sel msec; #X obj 541 189 route fps; #X obj 612 189 symbol; #X obj 432 318 list trim; #X text 140 58 WORKS; #X text 863 55 WORKS NOT; #X obj 864 622 outlet; #X obj 864 177 / 1000; #X obj 1246 188 % 1000; #X obj 1232 220 / 1000; #X obj 1232 272 int; #X obj 1104 254 % 60; #X obj 864 277 div 60; #X obj 864 148 t f f, f 50; #X obj 864 208 t f f, f 24; #X obj 991 350 % 60; #X obj 864 349 div 60; #X obj 864 312 t f f, f 15; #X obj 862 119 route float, f 55; #X obj 1232 244 *, f 20; #X obj 1232 302 makefilename 02d:%%%02d:%%02d:%02d; #X msg 1231 332 set \$1; #X msg 1112 399 set \$1; #X obj 1113 369 makefilename not-yet-set; #X msg 1027 464 set \$1; #X obj 1028 434 makefilename not-yet-set; #X obj 875 503 makefilename not-yet-set; #X connect 0 0 20 0; #X connect 0 0 49 0; #X connect 3 0 10 0; #X connect 4 0 23 0; #X connect 5 0 24 0; #X connect 6 0 11 0; #X connect 7 0 12 0; #X connect 8 0 17 0; #X connect 9 0 3 0; #X connect 9 1 4 0; #X connect 10 0 8 0; #X connect 10 1 7 0; #X connect 11 0 14 3; #X connect 12 0 14 2; #X connect 13 0 14 1; #X connect 14 0 19 0; #X connect 15 0 13 0; #X connect 16 0 18 0; #X connect 17 0 16 0; #X connect 17 1 15 0; #X connect 18 0 14 0; #X connect 19 0 1 0; #X connect 20 0 9 0; #X connect 20 1 32 0; #X connect 20 1 33 0; #X connect 21 0 14 3; #X connect 22 0 5 0; #X connect 22 1 21 0; #X connect 23 0 34 0; #X connect 24 0 6 0; #X connect 25 0 26 0; #X connect 26 0 27 0; #X connect 27 0 32 0; #X connect 28 0 29 0; #X connect 28 1 24 1; #X connect 29 0 23 1; #X connect 30 0 23 1; #X connect 31 0 30 0; #X connect 32 0 28 0; #X connect 33 0 31 0; #X connect 34 0 22 0; #X connect 38 0 45 0; #X connect 39 0 40 0; #X connect 40 0 50 0; #X connect 41 0 51 0; #X connect 42 0 54 0; #X connect 43 0 48 0; #X connect 44 0 38 0; #X connect 44 1 39 0; #X connect 45 0 43 0; #X connect 45 1 42 0; #X connect 46 0 56 0; #X connect 47 0 57 0; #X connect 48 0 47 0; #X connect 48 1 46 0; #X connect 49 0 44 0; #X connect 50 0 41 0; #X connect 51 0 52 0; #X connect 52 0 54 0; #X connect 53 0 56 0; #X connect 54 0 53 0; #X connect 55 0 57 0; #X connect 56 0 55 0; #X connect 57 0 37 0; ___ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> ht
Re: [PD] makefilename multiple substitutions
You have to escape *each* "%" with a leading "%", so your format string should be "02d:%%02d:%02d" The help patch actually shows this: "" becomes "%%" and so on Maybe the wording is not clear enough, though? Christof On 14.11.2021 23:55, Max wrote: hi list, The helpfile for makefilename has a subpatch "multiple substitutions" in which it says: You can connect two or more objects for multiple substitutions. For that, you need to use a literal '%' to set the format string of another makefilename object. LITERAL %: You can format a string with a literal '%' if you escape it with another '%' (where "%%" becomes "%", "" becomes "%%" and so on) however, just a depth of two substitutions is in the example. I extended this to three and got the error: makefilename: invalid format string '%%%02d:%%02d:%02d' (too many format specifiers) (Yes you guessed right, trying to generate SMPTE from milliseconds) M. ___ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list ___ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list