Macro stores STEP and SAT- Rev not working with assembly

I have this macro to save step and sat or DXF and DWG. There is also the script or revision, if available if I open only one assembly and use the macro, I will not get the revision. I have to open the drawing first and apply the macro. What do I have to change here so that it is only possible with an assembly open?

SolidworksApi/macros