Uh... ba why make it complicated rather than a right click and open the file then?
That said, to be more in line with your project, the difficulty will be in the selection of the first view. I'm not sure he knows how to do that kind of thing
My wish is to make a macro to make a step file of the open drawing and especially the step file of the configuration concerned by the drawing, hence the need to open the part file in the right config for the recording.
I already have the rest of the macro but it opens the part file in the config of the last recording and not in the config of the drawing.