Script Autofocus?

Discussion in 'Scripting and Programming' started by Bradisback, Apr 11, 2020.

  1. Bradisback

    Bradisback Standard User

    Joined:
    Oct 9, 2018
    Messages:
    4
    Hi all,

    I'm looking for a script to do the autofocus in the "Autosave" sequences.

    Does anyone have one that works?

    Thank you in advance.
    Stef
     
  2. Bradisback

    Bradisback Standard User

    Joined:
    Oct 9, 2018
    Messages:
    4
    Hello

    I'm still looking for a Script to automate the focus.

    I found this script on the web, but it has a problem.

    The script launches well, the autofocus is done correctly and successfully, but the script doesn't close and therefore the sequence doesn't restart.

    I would be very grateful for your help!

    Best regards!

    Stef






    'Stephen Mounioloux - Cooledpix.com
    'Refocusing Script V1.0 for MaximDL imaging (autosave) sequences
    '2012/10/17 - Last update: 2012/10/18
    '----------------------------------------------------------
    Dim cam
    Set cam = CreateObject("MaxIm.CCDCamera")
    Dim af
    Set af = CreateObject("MaxIm.Application")

    cam.LinkEnabled = True
    if Not cam.LinkEnabled Then
    wscript.echo "Failed to start camera."
    Quit
    End If


    af.FocuserConnected = True
    if Not af.FocuserConnected Then
    wscript.echo "Failed to connect the focuser."
    Quit
    End If

    wscript.echo "Moving filter wheel to Focus on Slot #0 Filter."
    cam.filter(0)
    wscript.echo "Autofocus routine started."
    af.AutoFocus()

    Do While Not AutoFocusStatus
    WScript.Sleep 1000
    Loop
     
  3. Colin Haig

    Colin Haig Staff Member

    Joined:
    Oct 27, 2014
    Messages:
    3,453
    I suspect the problem is the condition in your Do While Not AutoFocusStatus.
    AutoFocusStatus returns a value of 0 = operation failed, 1 = succeeded, and -1 means the operation is in progress.
    You need a more complicated test in there.
     

Share This Page