End of sequence scripts

I wanted to run a .cmd file at sequence end to send commands to a DC power switch to turn off power to the devices on my pier but the “Sequence Settings” option window will not allow the selection of that file type. Is that something that could be enabled?

I could also live with just being able to run the .exe but I would need to supply command line parameters.



The answer is… I think so… maybe? A little cowboy development here, adding a last minute change to the beta going out tonight to allow CMD and BAT. You are welcome to try it out… if it doesn’t work, we’ll try to get to it.

@chasmiller46 In case this doesn’t work you can run a vbs script file in which you call whatever file you want to run from a shell. My vbs script looks like this:

Set objShell = CreateObject(“WScript.Shell”)
objShell.Exec(“C:\Users\afzelius\Documents\SGP sequences\SGP scripts\ObservatoryShutdown.exe”)


Thanks for the sample vb script. I was about to post to ask if anyone could provide a sample vb script for me to use.



The .316 beta does allow me to select and execute a .CMD file as part of the end of sequence options. Thanks for the quick response!

In testing this morning, I discovered that the script is not run as the last thing a sequence does. I had also flagged the sequence to disconnect equipment at end of sequence. However, the script was run before the equipment was disconnected so the scope, camera, etc were powered off before SGP disconnected from them.


I’ve had the same problem. So I have included a timer that makes a pause of 5 min before powering down my stuff, this has worked really well for me. The 5 min pause was also due to the warming of the camera, but I believe the camera is now disconnected without waiting for this warmup in the new betas, I believe. Maybe you can include a timer in your solution? Ideally @Ken could change the sequence to make sure the end of sequence script is really the last thing executed, but I appreciate they have a lot of things going here in the new version coming up!

I’m not sure if this is ideal. While I can certainly see your perspectives in that you want to use this script to turn stuff off, this will then break any script that needs to interface with gear before it disconnects… then we get to have this same conversation again from that perspective. For now, we’ll leave it where it is and can look at pre / post gear disconnect after 3.1 is released.

I appreciate your point of view, no real urgency here. But your the idea of having a pre/post disconnect script entry looks good!

@chasmiller46 There is a simple fix to your problem I think. You can easily add a pause to the vbs script, by adding the line:

WScript.Sleep 30000

In this case anything after this line will be executed 30000 ms = 30 s after this command. Simple enough.

The scripts in SGP run synchronously, so SGP will wait for your script to complete before returning control back to SGP. In this case you’d want to create a VBS script that launched a command and the VBS script immediately returned.