[Closed] Save file copy as
Maybe question seems odd but after one our of searching on net and max help I still can’t get any even short notice about how to “save fie as copy” – access from max script. I could do it by :
actionMan.executeAction 0 “40903” – File: Save File As Copy
saveMaxFile blabla
but I have to save scene and change name of scene, and I want do it without pooping “save properties “window.
I would be grateful for answer, I haven’t realize such a simple and basic command will be so difficult to find.
You can try also something like this
fn saveAsCopy file overwrite:off = if doesFileExist file do
(
local sioFile = dotnetclass "System.IO.File"
local filedir = getFilenamePath file
local filename = getFilenameFile file
local ext = getFilenameType file
local newfile = pathconfig.appendpath filedir (filename+"_copy"+ext)
if not overwrite and doesFileExist newfile then
(
messageBox "Copy of this file already exist!" title:"Warning" beep:off
)
else (sioFile.copy file newfile overwrite ; ok)
)
if (sceneName = maxFilePath + maxFileName) != "" do saveAsCopy sceneName
Look in the help and you will find…
<bool>saveMaxFile <filename_string> \
[saveAsVersion:<integer>] [clearNeedSaveFlag:<bool>] [useNewFile:<bool>] [quiet:<bool>]
So to decode what that means, <bool> means it will return a true or false value…
<filename_string> expects a filepath ie… “c:\ emp\ est01.max” or @“c: emp est01.max” look into escape characters if you don’t understand why it’s \ or @
everything in [] is an optional parameter, so you can put
savemaxFileName @“c: emp est01.max” saveAsVersion:13
useNewFile – Again look at help: “If useNewFile: is false, the saved file is not set as the current scene file and the file is not put in the Most Recently Used list. This lets you save a backup file of the scene to a different name without the name becoming the current one or appearing on the list of recent files.”
savemaxFileName @“c: emp est01.max” useNewFile:false
Is what you need
Using first first method I have what I was looking for:
temporarymaxfile=maxFilePath + “Temporay_scene.max”
savemaxFile temporarymaxfile useNewFile:false
thank you.
Yup. Dave showed method related to maxfile.
Second method represents solution for different file extensions.