on error break?

Scripts and programs to automate Astroart
Post Reply
Forum_2014
Posts: 255
Joined: 03 Dec 2018, 22:33

on error break?

Post by Forum_2014 »

Below is a simplified version of a script I've written, as Microsoft might describe it has "a feature". if I haven't created the directory to store the images beforehand AA5 will raise an error, at which I'd like to break out of the code to address the issues however the script will continue the end of the for loop, is there a way around this? similar to either on error break or on error goto?

Thanks

Code: Select all

'initialise camera setup
'camera.Connect("Simulator")
camera.Connect("SBIG")
wheel.connect
sFilters$ = "SHO"
iSubQua = 2
iSubLen = 2
sFPrefix$ = "test"

for n = 1 to iSubQua
for i = 1 to len(sFilters$)
 print "lets take some images"
 print "filter " + sFilters$[i] + " Dur:" +str$(iSubLen) + " Qua:" +str$(iSubQua) + "Cnt:" + Str$(n) 
 Camera.Binning(1)
 f$ = sFilters$[i]
 'print f$ 
 Wheel.Goto(f$)
 Camera.Start(iSubLen)
 Camera.Wait
 filename$ = ""
 filename$ = sFPrefix$ + "_" + sFilters$[i] + "_" +str$(iSubLen) + "_" + time$() + ".fit"
 print "saving image: " + filename$ + " " + str$(n) + " of " + str$(iSubQua)
 print "c:\images\"+ sFPrefix$ + "\" + sFilters$[i] + "\" + filename$
 image.save("c:\images\"+ sFPrefix$ + "\" + sFilters$[i] + "\" + filename$ )
 image.close
next i

next n
Last edited by Forum_2014 on 07 Dec 2018, 23:54, edited 1 time in total.

Forum_2014
Posts: 255
Joined: 03 Dec 2018, 22:33

Re: on error break?

Post by Forum_2014 »

Hello,
at the moment the only solution is to use the command CreateDir() so that the folder is created if does not exist.
You may call it once at the beginning of a cycle or just every time before saving.
Clear skies!
Fabio.

Post Reply