Auto Close SGP at end of sequence?

Is it possible to have SGP close automatically at the end of the evenings sequence? Not just disconnect, but actually close.

I’m using a new computer and some program is staying open and not allowing the computer to go to sleep if SGP remains on the screen, even if all the equipment is disconnected. I’ve searched for the trouble maker with no success. Clicking SGP closed fixes the problem.

Any help would be appreciated, John

The process name is the same each time SGP runs, so you should be able to run a .cmd script and use something like Taskkill /IM “SequenceGenerator” /F

Mike

So I’m in the dark ages with script, etc. However, there is a box to check on Sequence Settings to run end of sequence scripts. Is that where I would put this script?
Thanks for replying!
John

Yikes! Task killing would work but a more orderly save and close after disconnect option works for me. Handy for remote work when you want to run an orderly power down before sunrise.

Thanks Ian,
But how do I have the computer do a Save and Close of SGP on its own, after the end of sequence?
Usual end of sequence time is around 3AM, and I’m sleeping.

1 Like

I’m also interested in this problem. I’m looking for some way how to disconnect all equipment and shut down the computer after sequence is done.

Actually, a better way is to leave the /F flag off the command. This will allow the app to do a graceful shutdown. If you do this for the first time you may be presented with the pop-up stating, ‘the data in the sequence has changed, do you want to save this sequence’. I selected yes and also checked the ‘don’t show again’ box (this only has to be done once).
After a few seconds, SGP shuts down.
Below is a screen shot.
Taskkill

There are other tasks you will want to gracefully shutdown too like ASCOM processes and other astro related apps before shutting down (or sleeping) Windows. You can get the app names in the task manager. Just append .exe to the process names when running a script. The timing of shutdowns should be the other astro related apps ahead of SGP leaving SGP as the last astro process to end, followed by the system shutdown command.

Nonetheless, I believe the SGP folks may want to chime in on this method.

Mike

1 Like

Hi, thank you for your hints. Based on that I simply ask Chat GPT to help mi with that and then GPT generated the code and simple instruction:

@echo off
rem close SGP PRO
taskkill /IM SGP.exe /F

rem wait 60 sec
timeout /t 60 /nobreak

rem Shut down PC
shutdown /s /f /t 0

Instructions:

  1. Copy the code above and paste it into Notepad.

  2. Save the file as, for example, close_sgp.cmd. Be sure to select “All files” and manually enter the .cmd extension instead of .txt.

  3. You can run this script after the sequence finishes in SGP PRO.

Now, my question: How to activate the Script from SGP PRO after Sequence is finished???

I am too fast with my questions :slight_smile:
Let me answer to myself: The script can be run from - Sequence Settings. I have to test it

Thank you guys for looking into this problem! I don’t know anything about scripts, but if you find a way to make the shut down work, and post a script that I can copy onto my computer, that would be great!
I too am surprised that the SGP guy hasn’t suggested an answer.
I’ve been using SGP for several years now and like it, but a friend suggested I download NINA and give it a try…

This is the tail end of the bat file prepared today and tested:
I shut down other processes before SGP. I left out the /F flag so as to have a graceful shutdown instead of a kill -9 type of effect.
One drawback when testing with all the gear connected was the script started to run after the target was completed and while the camera was in the warm cycle. SGP was terminated before the warmup cycle was completed. I could add a longer timeout value greater than the CCD warmup period before shutting down SGP. This will take more testing.

echo “Shutting down iOptron Commander”
@echo off
Taskkill /IM “iOptron Commander 2017.exe”
timeout 4 > null

echo “Shutting down ASCOM Simulator Server”
@echo off
Taskkill /IM “ASCOM.Simulator.Server.exe”
timeout 4 > null

echo “Shutting down SGP”
@echo off
Taskkill /IM “Sequence Generator.exe”
timeout 4 > null

I did try NINA out of curiosity but soon went back to SGP for its better features.

Mike

1 Like

So Mike, How would I go about adding that script to my SGP? Would it be on the drop down, Sequence Settings ‘Run script at sequence end’?
Thanks, John

Yes, as he said earlier, save the file somewhere on your PC, then enter the full pathname to the script in the Sequence Settings dialog box.

Yes

Many thanks!
I’ll give it a try.
John

Hi folks, yesterday night i tested all we described here. It works with one minor issue. When Sequence complited and telescope park, the script runs imidietely and does not wait for camera warming. Apart from that all works OK

That’s what I encountered too.
The best workaround is to put a sleep period larger than the camera warmup period before shutting down SGP.
Below is an example based on a 10-minute camera warmup window that includes an additional minute (660 seconds)

echo “Shutting down ASCOM Simulator Server”
@echo off
Taskkill /IM “ASCOM.Simulator.Server.exe”
timeout 4 > null
echo “Shutting down SGP in 11 minutes after the camera warmup completes”
@echo off
timeout 660 > null

echo “Shutting down SGP”
@echo off
Taskkill /IM “Sequence Generator.exe”

1 Like

I tried enabling Run script at sequence end, while the Disconnect all equipment at sequence end is always enabled.

image

It looks the script runs before disconnect the equipment.

I have to add the task in Windows task scheduler as a workaround to close PHD2 and SGP, for allowing the equipment to disconnect, before closing the applications, instead of triggering the script from SGP sequence end actions.

This is true. The original intent of this script is to provide you an opportunity to interface with the equipment prior to disconnect.

Ken, Would it be possible for you to take a look at my original question, and answer if there is a way to close SGP at the end of a session.
Thank you, John