MAXScript add or replace extension during filesave

Hi all

Using maxscript, I’m having the user type in the name of the vrimg file to save and then I’m setting that in the Raw Image save path etc.
I’m not sure how to set the extension if the user does not type it. Also if the user types an extension, how can I ignore it and use a specific extension?

Currently I have:


    on test pressed do
        (
            f = getSaveFileName caption: "save A Test File:" \
            filename: "C:/_VRay RAW Renders/" \
            types:"V-Ray image files (*.vrimg)"

            if f!=undefined then
                (
                    renderers.current.output_rawFileName = f
                )
        )

this seems to work:


g = (getFilenamePath f) +  (getFilenameFile f) + (getFilenameType "*.vrimg")

You forgot the | for GetSaveFileName

So it would be this:


f = getSaveFileName caption:"Save a test file" filename:"C:/_VRay RAW Renders/" types:"V-Ray image files (*.vrimg)|*.vrimg"

Aha, that’s it. Thanks Colin that did the trick