How to write a dispatch script to checkout a selected file?

I have been trying to write a dispatch script to checkout a selected file. When I run the script as a command it checks out both the SLDPRT and SLDDRW files. When I run the script after a flow transition only the SLDPRT gets checked out. I am trying to create a script that checks out a file, updates a variable, then checks the file back in. I specifically want this script to work with SLDDRW files.

SolidworksSolidworks Pdm enterprise Pdm