EPDM Task: Set Part Material & Configuration Variables.

I would like to set up an EPDM task using a custom macro that performs the following functions:

1) Check-out Files

2) Open File

3) Set part material to

4) Add variable to each configuration and set value

5) Rebuild/Save

6) Check-in File

I have items 2,3,4,5 figured out using a macro based on work done by ( ).

Rather than use the "Browse Folder" function in this macro I would like to run this macro as a task.  Trouble is I cannot figure out how to check-out/check-in the files properly.  Any input is appreciated.

I have attached the macro I currently use (outside of EPDM) to perform the task.

SolidworksSolidworks Pdm enterprise Pdm