I'm trying to open several old documents and save them with the current version.
The script works but I had to press "Yes" for every document.
You can see an illustration of the problem here:
Is there a way around this?
Thank you for looking at the problem
You can see the script below
for subdir, dirs, files in os.walk('D:\modifyMe'):
for file in files:
filepath = os.path.join(subdir, file)
flags = c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS
doc = c4d.documents.LoadDocument(filepath, flags)
c4d.CallCommand(12098, 12098) # Save
can you provide some old files to reproduce the issue?
Can you check on this one?
You need to open it in version other than R20 otherwise it won't work.
Let me know if you need anything else.
The dialog box is not opened when you load the document. The dialog box is opened when you try to save it using CallCommand().
Using CallCommand() is the exact same as pressing the button in the UI. So there is nothing to prevent that dialog when you use CallCommand().
But to save the file, you can simply use c4d.documents.SaveDocument(). This should show no pop-up dialog.
flags = c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST
c4d.documents.SaveDocument(loadedDoc, finalUpdatedPath, flags, c4d.FORMAT_C4DEXPORT)
Also, it looks like you are creating something similar to the Scene Updater. This plugin is also written in Python, so you might find some inspiration in its source code.
RE: The dialog box is not opened when you load the document. The dialog box is opened when you try to save it using CallCommand().
Thanks for the clarification.
The code you presented works as expected. Thank you!