Me again I seem to be having an issue with having a set of scripts run before and after an event. What my goal is to slew to the flat box position and take flats and then āunparkā. Below is the vbs script:
My initial thought here at work away from the scope is that I only need the scope.tracking and scope.slewtoaltaz lines since I am already connected to the mount in SGP via the Celestron ASCOM driver. The āunparkā script simply sets the scope.tracking = true, but with the set scope, scope.connected statements wrapping it.
I went through the SGP debug logs at lunch and it shows nothing out of the ordinary, but looking at my flats, it is of the object (M51) I was imaging, so I know it did not work. On the bright side, the park command worked perfect and the end of the sequence and my scope was sitting there parked, waiting for me to hibernate it.
For whatever reason, the script does not work on its own. I could of swore it did. Regardless, it seems to be the problem here. Hoping to find some info why the latest Celestron ASCOM driver is not liking the SlewToAltAz command.
Just a quick update. I did sort out my script issues and now it will go to the position I need it to and then stop tracking by running the vbs file. But when I use the same script file in the SGP sequence as mentioned above, it does nothing. Just goes to running the flats in whatever position it currently is in. Is there anything I can do now to further diagnosis this?
If you can send me the script I can debug it and see if something isnāt happening. You can also add some logging to your script to see if itās getting executed or maybe add some exception handling to it to see if itās throwing an exception.
Jared, I attached my vbs script(had to zip it to upload). I am for sure not a programmer, though a network admin, so debugging code is not my strongest suit! But like I said, it now works when run alone. Any insight would be greatly appreciated.
Pete,
I can take a look this evening. One thing that stands out is that youāll likely need to block the script. For instance your script will exit almost immediately. I think you want to wait until after the slew is complete. Youāll need to do something like:
do
sleep(1000);
while( tel.IsSlewing )
Normally do/while loops are considered bad programming but in this case you likely want to sleep for a tad bit and then check as the scope might take a little bit to say itās slewing.
This will keep your script alive until the scope has stopped moving.
So I guess what is happening? Does the scope start to slew? Or does nothing happen?
I cannot detect the scope moving, I even put my NexRemote into get-Axis mode to watch the Alt/AZ readings to make sure it was stopping the tracking before it moved via the SlewToAltAz. Running the script standalone, it works, but in SGP I cannot see anything happening. But like you mentioned earlier, some logging in the script to see it is going through each line of code would be helpful.
I am pretty sure I had SGP connected and going when I ran the script independently. But I will do that again this evening to make sure. The message box is a great idea, I will add that to the script.
Ok, I have been trying a few things out as suggested above. First off the with SGP running and connected to everything, the script will run as intended. I added a msg prompt into the script also that works correctly running it standalone. When I use this script in SGP for my 2nd event (flats) as a Pre-Event option (run script) (box is checked), nothing happens. No msg prompt either.
So next I create a new script called test.vbs and add just one line for a msg prompt: MsgBox (āHello world!ā). Then I test it standalone, it works. I put it in SGP and nothing happens. Below are the three lines in the SGP log file centered on the script:
I really do not think SGP is running it at this point. I also tried running SGP in administrator mode to rule that possibility out. I guess my next question is if anyone does have vbscripts that work as pre/post events as I am attempting. (for any purpose)
Jared, I have attached the SGF file I was using (M51) all zipped up. I verified that the check box is checked. I went as far this morning to uninstall SGP, reboot, download the latest version again, and reinstall. Same results, it just does not want to run any scripts for me. So now I am trying to figure what could be different between us.
My observatory computer is a high-end desktop running Win7 x64, i5 processor 10GB RAM. I am pretty careful what I put on there, so the odds of some weird program or something is low.
When I write these scripts, I simple use notepad and save as {filename}.vbs, so not sure if that is right way. Do I have to run SGP in admin mode? I checked all the event logs and nothing looks wrong there.
I believe I have figured this out. It seems that the script file has to be in the directory that is defined in the ātarget dataā area. Once I moved my test script to the ād:\data\sgpā from a folder on my desktop where I was keeping the scripts, it worked perfectly. Tonight is suppose to be clear, so I will try it with the real scripts, but I am expecting them to work.
I thought it was strange. So I just tried putting a test script into a subfolder in my ād:\data\sgpā directory and it did not work. For sure it has to be in that declared directory. I double checked the original problem sequence and there are no spacing in it to throw it off. Unless you are talking about something under the hood.
Update: I did a complete test of the sequence with everything connected (camera, wheel, scope, light box) with the 2 scripts in the ācorrectā directory and it worked great. After a quick ālight frameā, the next event was flats with a pre-event script to move the scope to the lightbox position and āparkā, this worked. After the flats were completed, the post-event script ran and unparked the scope. Next event was a simple bias with a post-event park, which worked. Then finally some darks were taken.
So long story short, putting the scripts in the Target Data āDirectoryā listed in the sequence fixed my problem of the script not being executed.
Jared, if you donāt mind me jumping in here, how would you recommend I proceed to learn enough of VB to be able to write simple scripts? I was fairly proficient with BASIC back in the dark ages, and having downloaded and installed VB, I see nothing too intimidating. But Iām not sure how to dive into it.