How to save Guidecamera images in a script?

Discussion in 'Scripting and Programming' started by Richard Gray, Mar 27, 2015.

  1. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Hi,
    I am trying to figure out how to save Guide camera images from a script. I have tried the SaveImage method, but that does not seem to work. I can easily do it manually, but I need to be able to assign the image name and to save it from a script.

    The script I have written is as follows (in autoit):

    Dim $Cam
    Dim $Image = "C:\Users\Robotics\guide1.fit"
    Local $nXstar = 500.1
    Local $nYstar = 355.1
    $Cam = ObjCreate("MaxIm.CCDCamera")
    $Cam.LinkEnabled = True

    If $Cam.LinkEnabled = False Then
    MsgBox(0,"","Camera not ready")
    Exit
    EndIf

    $Cam.DisableAutoShutdown = True

    $Cam.GuiderExpose(1.0)

    While ($Cam.GuiderRunning)
    Wend

    $Cam.SaveImage($Image)


    $nXstar = $Cam.GuiderXStarPosition
    $nYstar = $Cam.GuiderYStarPosition

    MsgBox(0,"Xstar",$nXstar)
    MsgBox(0,"Ystar",$nYstar)

    Everything works perfectly except for saving the image. Any help or suggestions you can offer would be most appreciated.

    Thanks, Richard
     
  2. Doug

    Doug Staff Member

    Joined:
    Sep 25, 2014
    Messages:
    7,001
  3. Richard Gray

    Richard Gray Standard User

    Joined:
    Nov 29, 2014
    Messages:
    21
    Ok, thank you -- that does work! Except for one small problem. The first time I take a guider image, the document count is 0. It is only on the second exposure that the count turns to 1. Any ideas?
    Richard
     
  4. Jesse

    Jesse Cyanogen Customer

    Joined:
    Oct 11, 2014
    Messages:
    56
    Hi, I'm jumping in because I have the exact same question.

    Just to clarify, if I don't want to bother searching on the image name I'm assuming that I can simply go from CCDCamera.GuiderExpose right to Document.SaveFile because the guider image is the Application.CurrentDocument?

    Thanks,
    Jesse
     
  5. Doug

    Doug Staff Member

    Joined:
    Sep 25, 2014
    Messages:
    7,001
    Not guaranteed to work in all situations. Simple example - if you touch the UI and inadvertently change CurrentDocument.
     

Share This Page