[Pd] Filenames

c.m.bryan chrismbryan at gmail.com
Tue Nov 21 13:05:03 CET 2006


On 21/11/06, Chuckk Hubbard <badmuthahubbard at gmail.com> wrote:
> My program saves .ji files, and separately saves .trs and .prs files
> with the same name as the chosen .ji file.  Same thing when it loads a
> .ji file.
> Right now, I have something like the attached file.  It should take
> the input "filename.ji" and output "filename".
> 2 problems:
> a) any numbers in the file path are replaced with the text "float",
> b) it would be nice for it to know whether ".ji" was already on the
> end, because if someone types a name for save-as and doesn't put .ji
> on the end, it lops off the last three characters as though they were
> ".ji".
>
> I thought makefilename might help, but it only works for putting
> together, not taking apart.
> I'm a little rusty on string manipulation in Pd.  Is there a simple
> way to set up something like this?



It's sort of overkill, but I've just discovered the magic of py/pyext.
 You could easily do the string manipulations in a python script.

Maybe overkill, but pretty sweet :-D

-Chris Bryan




More information about the Pd-list mailing list