home *** CD-ROM | disk | FTP | other *** search
Wrap
' ======================= ' DEEPSKY99SLIDESHOW.VBS ' ======================= ' ' This ACP script does a guided tour of objects in the Deepsky 99 Observing Plan using voice control. ' This script will handle up to 500 objects. Data from the Deepsky 99 Spreadsheet is loaded ' into the file Deepsky99SlideShow.sfl. This script reads the file and uses ACP to position ' the scope onto the target object ' ' Sample data from Deepsky99SlideShow.sfl looks like this : ' --------------------------------------------------------- ' !START ' 21.805543 +23.456645 ' NGC 3435 ' located in the constellation of ' Orion ' has a magnitude of ' 9.5. ' This object is of type ' Gx. ' !START ' 21.805543 +23.456645 ' NGC 2345 ' located in the constellation of ' Orion ' has a magnitude of ' 10.5. ' This object is of type ' Oc. ' ' Sample Text Spoken looks like this: ' ----------------------------------- ' NGC 3435 located in the constellation of Orion has a magnitude of 9.5. This object is of type Gx. Dim bExit Dim sObject(500) Dim sRA(500) Dim sDec(500) Dim sDescription(500) Dim iObj Dim dblRA Dim dblDec Dim strObject Dim strConText Dim strCon Dim strMagText Dim strMag Dim strTypeText Dim strType Dim DesText Dim intCounter '----------------------------------------------------------------------------------------- Sub main() ' ' Add new spoken commands. The three parameters are ' (1) The name of the event handler function ' (2) The command as listed in the right-click menu and commands window ' (3) The word to recognize in speech ' Voice.Commands.Add "next_spoken", "Next", "next" Voice.Commands.Add "previous_spoken", "Previous", "previous" Voice.Commands.Add "alert", "Quit", "quit" ' ' // Load the arrays of objects and their descriptions. The object names ' are those that can be understood by Scope.SelectObject() and the ' descriptions are what you want spoken. Const ForReading = 1 Dim fs, a, retstring Set fs = CreateObject("Scripting.FileSystemObject") Set a = FS.OpenTextFile("C:\data\Deepsky 98\Source98\Deepsky99SlideShow.sfl", ForReading, False) Do While a.AtEndOfStream <> True '// Read Start of Record retstring = a.ReadLine if retstring<>"!START" Then exit do '// Read RA and Dec retstring = a.ReadLine dblRA=left(retString,9) dblDec=right(retString,10) '// Read Object Name retstring = a.ReadLine strObject=trim(retstring) '// Read Constellation Text retstring = a.ReadLine strContext=trim(retstring) '// Read Constellation retstring = a.ReadLine strCon=trim(retstring) '// Read Magnitude retstring = a.ReadLine strMag=retstring '// Read ObjectType retstring = a.ReadLine strType=trim(retstring) '// Concatenate Description String DesText = strObject & " " & strConText & " " & strCon & " " & strMag DesText = DesText & " " & strType intCounter=intCounter+1 if intcounter>500 then exit do '// Add to the array sObject(intCounter)=strObject sRA(intCounter)=dblRA sDec(intCounter)=dblDec sDescription(intCounter)=DesText Loop a.Close '// Exit Sub if nothing in array voice.speak "Total Objects in the plan are" & intcounter if intCounter=0 then Voice.Speak "No objects were processed. Please check to make sure the file called Deepsky99SlideShow.sfl contains valid information. This file is where objects from Deepsky are stored for use by ACP." exit Sub end if ' ' Tell user what to do on the console next, then enable speech input. ' 'Voice.Speak "Once you have centered and sinked on an alignment star, press F12 to tell Genie to listen, then say, next, to go to the next object in the plan, or, previous, to go to the previous object." 'Voice.Speak "Click the alert button or say, quit, to exit this plan script." voice.speak "To begin, say Next." ' ' Initialize the object index. This starts at 1 ' iObj = 1 ' ' Enter a yield-loop to allow the system to call ' our event handler(s) back when our command(s) are ' spoken. Leave this loop when alert() sets the ' bExit flag. ' bExit = False ' Use Alert to stop script While Not bExit Yield ' Respond to events Wend End Sub '--------------------------------------------------------------------------------------------------- ' //Agent will call this function when the word "next" is spoken. Sub next_spoken(v,c) if iObj = intCounter then Voice.Speak "That's the end of the list." Else GoToObject iObj iObj = iObj + 1 End If End Sub '-------------------------------------------------------------------------------------------------- ' // Agent will call this function when the word "previous" is spoken. Sub previous_spoken(v,c) if iObj = 1 then Voice.Speak "That's the beginning of the list." Else iObj = iObj - 1 GoToObject iObj End If End Sub '--------------------------------------------------------------------------------------------------- '// This lets the alert() button or the "quit" commmand stop this script Sub alert(v,c) Voice.Listening = False ' Plug agent's ears Voice.Speak "That's all." bExit = True End Sub '---------------------------------------------------------------------------------------------------- '// Slew the scope to the current RA and DEC Sub GoToObject(n) Voice.Speak "Going to " & sObject(n) & "." Util.WaitForMilliseconds 4000 ' Allow time for speech Scope.ObjectRightAscension = sRA(n) Scope.ObjectDeclination = sDec(n) Scope.SlewToCurrentObject If not Scope.SlewToCurrentObject Then Voice.Speak "Sorry. Object " & sObject(n) & " could not be located." Exit Sub End If ' ' Right here, the "what's visible" feature will speak a description ' of the object: "Scope is now pointed at xxxxx" if it is deep sky ' Util.WaitForMilliseconds 1000 Voice.Speak "Target is Locked." Voice.Speak sDescription(n) End Sub