' (1) SET UP TELESCOPE Dim scope Set scope = CreateObject("RASCOM.RASCOMTele.1") ' Create the TheSky object (for loading object coordinates) Dim objTheSky Set objTheSky = WScript.CreateObject("RASCOM.RASCOMTheSky.1") ' Create dome object Dim objDome Set objDome = WScript.CreateObject("RASCOM.RASCOMDome.1") ' (5) SET UP SCRIPT CONVENTIONS (so no Dim parameters will repeat) Dim TargetAz, TargetAlt Dim szMark,AlignSeconds, duration,szEnd Dim prompt Dim CRLF 'carriage return and line break for any msgbox or inputbox lines CRLF = Chr(13) & Chr(10) '(6) SET UP ACTIVITY LOGFILE Dim fso, f1, log Set fso = CreateObject("Scripting.FileSystemObject") '8 means ForAppending Set log = fso.OpenTextFile("testlog.txt", 8) log.writeline("=================================================") log.writeline("=======SCRIPT STARTED " & NOW & "=======") log.writeline("=================================================") 'line 33 (programming aid) '-------------------------------------------- '-------------------------------------------- Call scope.Connect Call objTheSky.Connect() Call objDome.Connect() AlignSeconds = 30 szMark = Now() duration = Inputbox("How long should the dome track?" & CRLF _ & "This script can only be ended if you press CTRL-Alt-Del and End Process WSCRIPT.EXE" & CRLF & CRLF _ & "You can use this script all night long too!" & CRLF _ & "Just use TheSky's Dome Link window and 'Dome/UNCOUPLE' the Dome." & CRLF _ & "This way the dome won't change direction if you slew to a new object while the script is running") If duration = "" then EndScript end if szEnd = DateAdd("n",duration,Now()) wscript.echo "==Script Starting==" & CRLF _ & "Time is " & Now() & CRLF _ & "Script will end at:" & CRLF & szEnd prompt = msgbox("Is this correct? (Last chance to end)", vbYesNo) If prompt = vbNo Then EndScript End If Do bErrorOccurred = FALSE 'No error has occurred Dur = DateDiff("s",szMark,Now()) If (Dur>=AlignSeconds) then Call scope.GetAzAlt() TargetAz = scope.dAz TargetAlt = scope.dAlt Call objDome.GotoAzEl(TargetAz, TargetAlt) log.writeline(now & " slewed to " & TargetAz & ", " & TargetAlt & " .") szMark = Now() end if Dur = DateDiff("s",szEnd,Now()) If (Dur>=0) then EndScript End If Loop '------------------------------------- Sub EndScript wscript.echo "script ends" Wscript.quit End Sub