Search code examples
praat

get the path and filename of an object


Is there a way within a praatscript to query the path and filename of an object.

I want to save a textgrid to the same file I opened (overwite it)

I was think of something like:

    selectObject: n
    type_name$ = selected$ ()
    file_name$ = some_way_to_query_this..., n
    type$ = extractWord$ (type_name$, "")
    if type$ == "TextGrid"
        runScript: "save.praat", file_name$
    endif

Solution

  • No. Objects in Praat do not store information about their location on disk because most objects will never exist on disk at all. Objects are not files.

    If you are reading an object from a file, and then want to store the object to the same location, then you should store that information elsewhere yourself.