Elbrus can be used in VBScript files . We give here three examples. You can modify and add your own line codes depending on your needs:
Example 1. elbrus1.vbs:
Elbrus is supposed to be running.
This VBScript code sends a command file to Elbrus using the function WriteElbrusTxtFile().
Then waits for Elbrus to solve the image.
When solved, we read the image coordinates using the function ReadElbrusStaFile().
Then you can add code as needed: slew, synchronize, ...
Example 2. elbrus2.vbs:
Executes the elbrus.exe program if not yet running.
Sends to Elbrus the image path.
Set supposed coordinates from the fits header.
Set automatic synchronize.
Waits for the analysis to be concluded.
Ends the elbrus.exe.
Example 3. elbrus3.vbs:
Executes the elbrus.exe with arguments.
The arguments are:
the mode = 8 = solve and exit.
the image path
the supposed coordinates.
Waits for the analysis to be concluded. Example 1. elbrus1.vbs:
Elbrus is supposed to be running.
This VBScript code sends a command file to Elbrus using the WriteElbrusTxtFile() function.
Then waits for Elbrus to solve the image.
When solved, we read the image coordinates using the ReadElbrusStaFile() function.
Then you can add code as needed: slew, synchronize, ...
''''''''''''''''
'VBScript example for Elbrus:
'elbrus1.vbs
'- sends to Elbrus the supposed coordinates and the image path.
'- waits for the analysis to conclude.
'- if solved, displays the image center.
'Alfonso Pulido - december 2008
'Elbrus is running in the *Wait for message* mode.
'We want to solve an image and then read the image center coordinates.
'We write the message with the function WriteElbrusTxtFile
' and we read the coordinates with the function ReadElbrusStaFile.
Option Explicit
Dim elbrusMailboxPath
Dim timeOut
Dim objfso, ret
Dim elbrusTxt, elbrusSta
Dim txtLine, spent
Dim imagePath, targetRA, targetDEC
Dim sides, imageRA, imageDEC
MsgBox "START of elbrus1.vbs. A VBScript example for Elbrus"
'Here your working parameters:
'The folder were Elbrus is looking for the elbrus.txt file
elbrusMailboxPath = "C:\Elbrus\MailBox"
timeOut = 10 ' allowed time for solving in seconds
'''''''''''''''''''''''''''''
'
' YOUR CODE HERE
'
'''''''''''''''''''''''''''''
'Before writing the message, prepare the new values as needed:
imagePath = "C:\MyCaptures\p84g20mL1.fit"
targetRA = 51.25 '0r whatever you need
targetDEC = 84
'and now write the message to Elbrus
WriteElbrusTxtFile
'We have to wait until the image is solved or time out.
'This is done by reading the elbrus.sta file until it is no longer analyzing.
ret = 0
spent = 0
Do While spent < timeOut
Wscript.sleep 1000 '1 second timer
spent = spent + 1
ret = ReadElbrusStaFile
If ret = 1 Or ret = 2 Then Exit Do ' finished
Loop
'the analyze is finished.
If ret = 1 Then 'solved
MsgBox "A " & sides & " sides solution was found. " & " RA = " & imageRA & " DEC = " & imageDEC
'''''''''''''''''''''''''''''
' YOUR CODE HERE
'''''''''''''''''''''''''''''
ElseIf ret = 2 Then 'no solution
MsgBox "No solution found"
'''''''''''''''''''''''''''''
' YOUR CODE HERE
'''''''''''''''''''''''''''''
Elseif spent >= timeOut Then 'time out
MsgBox "Time out. Analysis not finished."
'''''''''''''''''''''''''''''
' YOUR CODE HERE
'''''''''''''''''''''''''''''
End If
MsgBox "END of elbrus1.vbs"
''''''''''''''''''''''''''''''''''''''''
Function WriteElbrusTxtFile()
'write elbrus.txt file with the commands codes and values
Set objfso = CreateObject("scripting.filesystemobject")
Set elbrusTxt = objfso.createtextfile(elbrusMailboxPath & "\elbrus.txt", True)
'the 2 introduction lines
elbrusTxt.writeline " Elbrus command file"
elbrusTxt.writeline " This is an example file for target coord. in the same message" 'commentary line
'two lines for each command
'-- skyArea = 1: the elementary sky window (tipically 5 x 5 degrees)
elbrusTxt.writeline "**SET skyZone"
elbrusTxt.writeline "1"
'two lines for each command
elbrusTxt.writeline "**SET searchingCoordinatesFrom"
elbrusTxt.writeline "4" ' from this message
'''''''''''''''''''''''''''''''
Function ReadElbrusStaFile()
'Read elbrus.sta file
Set objfso = CreateObject("scripting.filesystemobject")
Set elbrusSta = objfso.opentextfile(elbrusMailboxPath & "\elbrus.sta", 1)
txtLine = elbrusSta.readline ' the first line text
If Mid(txtLine, 62, 2) = "01" Then 'solved let us extract the image coordinates
txtLine = elbrusSta.readline 'line 2. We don't use it here
txtLine = elbrusSta.readline 'line 3. We don't use it here
txtLine = elbrusSta.readline 'line 4
sides = Mid(txtLine, 1, 3)
imageRA = Mid(txtLine, 15, 8)
imageDEC = Mid(txtLine, 27, 8)
ReadElbrusStaFile = 1
ElseIf Mid(txtLine, 62, 2) = "02" Then 'no solution
ReadElbrusStaFile = 2
ElseIf Mid(txtLine, 62, 2) = "03" Then 'waiting for the first message
ReadElbrusStaFile = 3
ElseIf Mid(txtLine, 62, 2) = "04" Then 'busy
ReadElbrusStaFile = 4
End If
elbrusSta.Close
End Function
''''''''''''''''''''''''''''''''''
Example 2. elbrus2.vbs:
Executes the elbrus.exe program if not yet running.
Sends to Elbrus the image path.
Set supposed coordinates from the fits header.
Set automatic synchronize.
Waits for the analysis to be concluded.
Ends the elbrus.exe
''''''''''''''''
'VBS script example for Elbrus. elbrus2.vbs :
'- executes the elbrus.exe program if not yet running.
'- sends to Elbrus the image path.
'- set supposed coordinates from the fits header.
'- set automatic synchronize
'- waits for the analysis to conclude.
'- ends the elbrus.exe
'Alfonso Pulido - december 2008
'NOTE:Before running this script be sure the last time you used Elbrus,
' you did it in the *Wait for message* mode.
'NOTE: ********** means put YOUR data in this line.
'We want to solve an image and then read the image center coordinates.
'We write the message to elbrus with the function WriteElbrusTxtFile
' and we read the coordinates from elbrus with the function ReadElbrusStaFile.
Option Explicit
Dim elbrusMailboxPath
Dim timeOut
dim objshell, elbrus
Dim objfso, ret
Dim elbrusTxt, elbrusSta
Dim txtLine, spent
Dim imagePath, targetRA, targetDEC
Dim sides, imageRA, imageDEC
MsgBox "START of elbrus2.vbs. A VBS script example for Elbrus", ,"elbrus2.vbs"
'Here your working parameters:
'The folder where Elbrus is looking for the elbrus.txt file
elbrusMailboxPath = "C:\Elbrus\MailBox" ' **********
timeOut = 10 ' allowed time for solving in seconds
'''''''''''''''''
' your code for other procedures
''''''''''''''''''
'Now you need to call elbrus and solve the image:
'execute the elbrus.exe
Set objshell = createobject("wscript.shell")
Set elbrus = Objshell.Exec("c:\elbrus\elbrus\elbrus.exe")' **********
' wait enough: the message file date must be recognized as posterior
Wscript.sleep 2000
if elbrus.status = 1 then
WScript.Echo "elbrus.exe not running"
end if
'Before writing the message, fill with the new values as needed:
imagePath = "C:\MyCaptures\p84g20mL1.fit" ' **********
targetRA = 51.25 '0r whatever you need ' **********
targetDEC = -84 ' **********
'and now write the message to Elbrus
WriteElbrusTxtFile
'We have to wait until the image is solved or times out.
'This is done by reading the elbrus.sta file until it is no longer analyzing.
spent = 0
Do While spent < timeOut
Wscript.sleep 1000 '1 second timer
spent = spent + 1
ret = ReadElbrusStaFile
If ret = 1 Or ret = 2 Then Exit Do ' finished
Loop
'the analyze is finished. Replace the MsgBoxes with your code
If ret = 1 Then 'solved
MsgBox "A " & sides & " sides solution was found. " & " RA = " & imageRA & " DEC = " & imageDEC,,"elbrus2.vbs"
ElseIf ret = 2 Then 'no solution
MsgBox "No solution found",,"elbrus2.vbs"
Elseif spent >= timeOut Then 'time out
MsgBox "Time out. Analysis not finished.",,"elbrus2.vbs"
End If
'we close elbrus
elbrus.terminate
'''''''''''''''''
' your code for other procedures
''''''''''''''''''
MsgBox "END of elbrus2.vbs",,"elbrus2.vbs"
Wscript.quit
''''''''''''''''''''''''''''''''''''''''
Function WriteElbrusTxtFile()
'write elbrus.txt file with the commands codes and values
Set objfso = CreateObject("scripting.filesystemobject")
Set elbrusTxt = objfso.createtextfile(elbrusMailboxPath & "\elbrus.txt", True)
'the 2 introduction lines
elbrusTxt.writeline " Elbrus command file"
elbrusTxt.writeline " This is an example file for target coord. in the same message" 'commentary line
'two lines for each command
'-- skyArea = 1: the elementary sky window (tipically 5 x 5 degrees)
elbrusTxt.writeline "**SET skyZone"
elbrusTxt.writeline "1"
'two lines for each command
elbrusTxt.writeline "**SET searchingCoordinatesFrom"
elbrusTxt.writeline "4" ' from this message
'''''''''''''''''''''''''''''''
Function ReadElbrusStaFile()
'Read elbrus.sta file
Set objfso = CreateObject("scripting.filesystemobject")
Set elbrusSta = objfso.opentextfile(elbrusMailboxPath & "\elbrus.sta", 1)
txtLine = elbrusSta.readline ' the first line text
If Mid(txtLine, 62, 2) = "01" Then 'solved let us extract the image coordinates
txtLine = elbrusSta.readline 'line 2. We don't use it here
txtLine = elbrusSta.readline 'line 3. We don't use it here
txtLine = elbrusSta.readline 'line 4
sides = Mid(txtLine, 1, 3)
imageRA = Mid(txtLine, 15, 8)
imageDEC = Mid(txtLine, 27, 8)
ReadElbrusStaFile = 1
ElseIf Mid(txtLine, 62, 2) = "02" Then 'no solution
ReadElbrusStaFile = 2
ElseIf Mid(txtLine, 62, 2) = "03" Then 'waiting for the first message
ReadElbrusStaFile = 3
ElseIf Mid(txtLine, 62, 2) = "04" Then 'busy
ReadElbrusStaFile = 4
End If
elbrusSta.Close
End Function
''''''''''''''''''''''''''''''''''
Example 3. elbrus3.vbs:
Executes the elbrus.exe with arguments.
The arguments are:
the mode = 8 = solve and exit.
the image path
the supposed coordinates.
Waits for the analysis to be concluded.
''''''''''''''''
'VBS script example for Elbrus:
'elbrus3.vbs VBS script example for Elbrus:
'- executes the elbrus.exe with arguments.
' The arguments are:
' the mode = 8 = solve and exit.
' the image path
' the supposed coordinates.
'- waits for the analysis to conclude.
'Alfonso Pulido - december 2008
'NOTE: ********** means "Put YOUR data in this line"
'We want to solve an image and then read the image center coordinates.
'We run to elbrus from the VBscript.
' and we read the coordinates from elbrus with the function ReadElbrusStaFile.
Option Explicit
Dim elbrusMailboxPath
Dim timeOut
dim objshell, elbrus
Dim objfso, ret
Dim elbrusTxt, elbrusSta
Dim txtLine, spent
Dim imagePath, targetRA, targetDEC, commandLine
Dim sides, imageRA, imageDEC
MsgBox "START of elbrus3.vbs. A VBS script example for Elbrus", ,"elbrus3.vbs"
'Here your working parameters:
'The folder were Elbrus is going to write the elbrus.sta file
elbrusMailboxPath = "C:\Elbrus\MailBox" ' **********
timeOut = 10 ' allowed time for solving in seconds' **********
'''''''''''''''''
' your code for other procedures
''''''''''''''''''
'Now you need to call elbrus and solve the image:
'fill with the new values as needed:
imagePath = C:\Elbrus\ImaPoloNorte\p84g20mL1.fit
targetRA = 51.45
targetDEC = 84
'execute the elbrus.exe in mode 8 with arguments in the the command line
Set objshell = createobject("wscript.shell")
commandLine = imagePath & " 8 " & " " & targetRA & " " & targetDEC
'Set elbrus = Objshell.Exec("c:\elbrus\elbrus\elbrus.exe 8 C:\Elbrus\ImaPoloNorte\p84g20mL1.fit 51.45 84")
Set elbrus = Objshell.Exec("c:\elbrus\elbrus\elbrus.exe " & commandLine)
'We have to wait until the image is solved or times out.
'This is done by reading the elbrus.sta file until it is no longer analyzing.
spent = 0
Do While spent < timeOut
Wscript.sleep 1000 '1 second timer
spent = spent + 1
ret = ReadElbrusStaFile
If ret = 1 Or ret = 2 Then Exit Do ' finished
Loop
'the analyze is finished. Replace the MsgBoxes with your code
If ret = 1 Then 'solved
MsgBox "A " & sides & " sides solution was found. " & " RA = " & imageRA & " DEC = " & imageDEC,,"elbrus3.vbs"
ElseIf ret = 2 Then 'no solution
MsgBox "No solution found",,"elbrus3.vbs"
Elseif spent >= timeOut Then 'time out
MsgBox "Time out. Analysis not finished.",,"elbrus3.vbs"
End If
'''''''''''''''''
' your code for other procedures
''''''''''''''''''
MsgBox "END of elbrus3.vbs",,"elbrus3.vbs"
Wscript.quit
''''''''''''''''''''''''''''''''''''''''
Function ReadElbrusStaFile()
'Read elbrus.sta file
Set objfso = CreateObject("scripting.filesystemobject")
Set elbrusSta = objfso.opentextfile(elbrusMailboxPath & "\elbrus.sta", 1)
txtLine = elbrusSta.readline ' the first line text
If Mid(txtLine, 62, 2) = "01" Then 'solved let us extract the image coordinates
txtLine = elbrusSta.readline 'line 2. We don't use it here
txtLine = elbrusSta.readline 'line 3. We don't use it here
txtLine = elbrusSta.readline 'line 4
sides = Mid(txtLine, 1, 3)
imageRA = Mid(txtLine, 15, 8)
imageDEC = Mid(txtLine, 27, 8)
ReadElbrusStaFile = 1
ElseIf Mid(txtLine, 62, 2) = "02" Then 'no solution
ReadElbrusStaFile = 2
ElseIf Mid(txtLine, 62, 2) = "03" Then 'waiting for the first message
ReadElbrusStaFile = 3
ElseIf Mid(txtLine, 62, 2) = "04" Then 'busy
ReadElbrusStaFile = 4
End If
elbrusSta.Close
End Function
''''''''''''''''''''''''''''''''''