Sample Scripts
Copy the following to to the clipboard (Ctl-C) and paste into Notepad (Ctl-V) and save to your desktop as MyScript.VBS
Sample #1
Dim FMx
Dim FMxFoc
Dim Position
Dim SysName
Set FMx = CreateObject("FocusMax.FocusControl")
Set FMxFoc = CreateObject("FocusMax.Focuser")
'Get current active system name
SysName = FMx.SystemFileName
wscript.echo "System = " & SysName
'Get and store the current focuser position
Position = FMx.Position
wscript.echo "Position = " & Position
'Move focuser 100 units in minus direction from current position
FMx.Move(Position - 1000)
Do
Loop while FMxFoc.IsMoving
wscript.echo "Position = " & FMx.Position
'Return focuser to original position
FMx.Move(Position)
Do
Loop while FMxFoc.IsMoving
wscript.echo "Position = " & FMx.Position
'Load new focuser system.ini - note file name and full path is required
FMx.SystemFileName = "E:\FocusMax\Simulator.ini"
FMx.Delay (1)
'Perform autofocus async
FMx.FocusAsync
Do
Loop while FMx.FocusAsyncStatus = -1
'Load original focuser system.ini file
FMx.SystemFileName = SysName
FMx.Delay (1)
wscript.echo "System = " & SysName
wscript.echo "Press OK to exit"
=======================================
Sample #2
Dim FM
Dim TgtPosX, TgtPosY, TgtStarHFD
Set FM = CreateObject("FocusMax.FocusControl")
FM.ShowLog
FM.FocusAsync
Do
Loop while FM.AcquireStarAsyncStatus = -1
FM.Focus
FM.FindStar
TgtPosX = FM.StarXCenter
TgtPosY = FM.StarYCenter
TgtStarHFD=FM.HalfFluxDiameter
wscript.echo "X=" & TgtPosX & " Y=" & TgtPosY & " HFD=" & TgtStarHFD
wscript.echo "Focus position = " & FM.Position
FM.SingleExpose
FM.Move(FM.Position + 500)
wscript.echo "Position = " & FM.Position
wscript.echo "Press OK to exit"