How to load several vtk files with a loop to create generealized macro

Hi,

I have recorded a macro for creating a video to be saved as an .avi file. I would like to customize this so that I can use the one macro for several folders to create the videos respectively. Each folder has 2000 .vtu and .vtp files stored in it. The macro for one folder is saved, when recording for example for the .vtu files, as follows for each of the 2000 files individually:

‘fLUIDDATA_0000vtu = XMLUnstructuredGridReader(registrationName=‘FLUIDDATA_0000.vtu*’, FileName=[’/home/folder/VTK/2/FLUIDDATA_0000.vtu’, ‘/home/folder/VTK/2/FLUIDDATA_0001.vtu’, ‘/home/folder/VTK/2/FLUIDDATA_0002.vtu’, … , ‘/home/folder/VTK/2/FLUIDDATA_2000.vtu’ ]

The problem is that I can’t use the macro in general, except to change the file path 2000 times and it’s also not suitable for several folders.
Therefore, as is also possible in Python, I want to load the list of whole files in a loop, for example like this:

Screenshot from 2022-11-15 12-02-49

The problem with this is that the saved video is just an empty reactor without the desired visualization displayed. The Error is that it is not possibe to read the files.

Does anyone have a solution for this or sees what I’m doing wrong? I have only recently started working with paraview so I would appreciate it.
Thanks in advance for the help!

SavedAnimation.py (13.9 KB)