( if maxFileName != "" then ( -- if the scene saved local enabledXRefIndex = #() for i = 1 to xrefs.getXRefFileCount() where ((xrefs.getXRefFile i).disabled == false) do ( (xrefs.getXRefFile i).disabled = true -- disable the xref append enabledXRefIndex i -- store the index of the active xref scenes ) max saveplus -- incremental file save TheFile = maxFilePath + (trimRight (getFilenameFile maxFileName) "1234567890") + ".max" --remove trailing numbers if doesFileExist TheFile do deleteFile TheFile -- disable only the active xref -- copyFile (maxFilePath + maxFileName) TheFile -- re-enable the disabled xref scenes for i in enabledXRefIndex do (xrefs.getXRefFile i).disabled = false ) else checkForSave() )