Batch PDF and X_T outputs with Part Custom property names

I need to export X_T files of the parts and individual PDFs from a multi-sheet drawing file with a very specific naming convention.

I found a few macros from these forums that get close and I tried tweeking them but I haven’t been able to get either macro to work.

The part file has a custom property (“AE Part No”) it is of type text and this needs to be part of the file name for both the pdf and x_t files.

PDF Output macro.

Ill have the drawing file open that contains all the parts for the project. Could be anywhere from 15-80 part drawings (one drawing per part).

For the pdf the full file name will need to be _.pdf

For example: 1234-12-A0_Base Plate.pdf

X_T Output macro.

Ill have all of the individual part files open.

For the x_t the full file name will need to be _.x_t

1234-12-A0_Base Plate.x_t

(The drawing sheet name and part file name will almost always match unless I typo something)

So the end result would be

1234-12-A0_Base Plate.pdf

1234-12-A0_Base Plate.x_t

4567-13-A0_Lid Plate.pdf

4567-13-A0_Lid Plate.x_t

8910-14-A0_Pusher Plate.pdf

8910-14-A0_Pusher Plate.x_t

Any help would be appreciated.

SolidworksApi macros