APSF,0,,-1,-1;-1;-1;-1;-1;-00;-00;-0;-;-;-;-;;-|;-|;-|;-;+ //- Uses ASCOM to choose a telescope mount type and then //- slew to the coordinates of the selected object. //- //- Note: Windows only. Requires ASCOM to be installed before use. //- //- Requires V1.5.9a14 or after. //- //- Paul Rodman, September 2007 //- //- V1.0 (13 Sep 2007) //- Initial release //- V1.1 (18 Sep 2007) //- Holding down Shift when script launched will allow //- re-selection of telescope. //- Disconnect from telescope at end of script. dim scopename as string, com as OLEObject, ra,dec as double if SelectedObject<=0 then print "No object selected" return end if scopename=RestoreStringValue("scopename","") if scopename="" or KeyDown(kbd_Shift) then // Use ASCOM to choose scope type, the first time com=new OLEObject("DriverHelper.Chooser") com.Value("DeviceType")="sTelescope" scopename=com.Invoke("Choose") scopename=mid(scopename,2) if scopename="" then return end if // Connect to the scope com=new OLEObject(scopename) com.Value("Connected")="b1" if com.LastError<>"" then print "ASCOM Error: "+com.LastError // Check that slewing is permitted if com.Value("CanSlewAsync")="b0" and com.Value("Canslew")="b0" then print "Sorry, the selected telescope does not appear to have slewing ability" return end if if com.LastError<>"" then print "ASCOM Error: "+com.LastError // Make sure telescope is unparked and tracking if com.Value("CanPark")="b1" then call com.Invoke("UnPark") if com.LastError<>"" then print "ASCOM Error: "+com.LastError if com.Value("CanSetTracking")="b1" then com.Value("Tracking")="b1" if com.LastError<>"" then print "ASCOM Error: "+com.LastError ra=Obj(SelectedObject).RA dec=Obj(SelectedObject).Dec if com.Value("CanSlewAsync")="b1" then // Asynchronous slew call com.Invoke("SlewToCoordinatesAsync","d"+format(ra,"0.000000"),"d"+format(dec,"-0.000000")) else // Synchronous slew call com.Invoke("SlewToCoordinates","d"+format(ra,"0.000000"),"d"+format(dec,"-0.000000")) end if if com.LastError<>"" then print "ASCOM Error: "+com.LastError com.Value("Connected")="b0" SaveStringValue("scopename",scopename)