How do I get the file name of the current scene?

MAXScript FAQ > How do I get the file name of the current scene?

A user asked:

I can't seem to find a function for grabbing the name of the currently open maxfile!

Answer:

The file name of the currently loaded scene can be accessed via the System Global Variable maxFileName.

The path of the current scene is accessible through maxFilePath.

Both variables are read-only!

To get the complete scene file name, you can use

EXAMPLE

sceneName = maxFilePath + maxFileName

If the scene does not have a name yet (Untitled), both will return an empty string "".

These global variables are documented under the letter M in the topic 3ds Max System Globals

See Also