ok - something to report.
the script works from within SGP in a flats sequence, however, for some reason it seems to have failed on the very first event. the telescope started to slew and then something apparently interrupted it. i canceled the sequence, unchecked the first event, and restarted the sequence. i have to uncheck the first event because i guess on a resume it does not run the script, so i would have been taking pictures of stars.
on the resume, the script again ran (i had it set before every event) and the telescope properly slewed.
in the past, when using the park command to point the scope at the panel, i knew that SGP would fail to slew to a new target, so i would always put my flats target at the very end of the sequence. i had hoped that by using this script method, that SGP would be able to continue on to another target after the flats. however, since the telescope is not tracking, SGP is unable to slew after finishing the flats. however, a post-event script which starts tracking again does allow SGP to proceed. in this way i should be able to automate flats with different rotator angles by interspersing flat targets between actual targets.
on the 2nd resume again the script was not run even though i had reshuffled the targets. i guess i might have to put in a dummy event to make sure the script always runs on my real flats events.
one problem is that SGP attempts to start the guider before running the flats, and then apparently keeps trying to guide while the flats are being taken. for some reason this caused a timeout on the guide camera (using API guider as the camera is SBIG with 2 chips behind one USB.)
i can upload the log later for @ken or @jared to look at.