Home Image-Pro Automation (Macros, Apps, Reports)

Capture image automation

Hi,

I'm still working on some conversion of IPP7 automation to IPP9.1

On my development desktop I have no camera installed, so I'm running in Camera Simulation. I don't know if it's the cause of my problem but when I try to Record some execution I'm always getting an unexpected error. The recording is working great anywhere else except in "Capture ribbon".

Well, to do simple, I have 3 steps that I'm looking to convert...maybe somebody can point me on the good command in IPP9.1
ret = IpAcqShow(ACQ_LIVE, 1)
ret = IpMacroStop("Capture image for animal XXXX then continue.",0)
ret = IpAcqSnap(ACQ_NEWEX)
ret = IpAcqShow(ACQ_LIVE, 0)
Thanks in advance. Martin

Answers

  • Hi Martin,

    There's a bug in capture recording which will be addressed in the next Premier release. Here is a macro that does what you need.

        Sub SnapImage
            Dim image1
    
            With Capture.CaptureCommands.Preview(Nothing)
                .PreviewOn = True
                .Run(Nothing,image1)
            End With
    
            MsgBox("Capture image for animal XXXX then continue.",vbInformation Or vbOkOnly,"Capturing...")
    
            With Capture.CaptureCommands.Acquire(Nothing)
                .Run(Nothing,image1)
            End With
    
            With Capture.CaptureCommands.Preview(Nothing)
                .PreviewOn = False
                .Run(Nothing,image1)
            End With
    
        End Sub

    Pierre
  • Many thanks Pierre.

    The MsgBox is not really what I need at this point.

    I rather need a "Prompt" that is not modal.

    I tried something like this :
    With Capture.CaptureCommands.Acquire(Nothing)
    .Prompt = "Capturez l'image de " + objImage.Name + "______________ puis continuez"
    .Run(Nothing,image1)
    End With
    
    But the Prompt is not a part of this object.
    
    I want that the user see a prompt, do the job and when finished press "OK" on the prompt to continue the macro.
    
    I do this kind of prompt in measurement tool.
                With Measure.Measurements.ToolsCommands.Line(m_SimpleScript)
                    .Prompt = "Mesurer la règle        puis - OK"
                    .Tool = eMMTool.Line
                    .Interactive = True
                    .Run(ThisApplication.ActiveImage)
                End With
    thanks
  • Martin,

    If you need a non modal prompt, the easiest is to use an interaction command, see below.

    Pierre

        Sub SnapImage
            Dim image1,doc1
    
            With Capture.CaptureCommands.Preview(Nothing)
                .PreviewOn = True
                .Run(Nothing,image1)
            End With
    
            With Application.DocumentCommands.Active(Nothing)
                .Run(doc1)
            End With
    
            With Automate.ScriptingCommands.Interaction(Nothing)
                .Interactive = True
                .Prompt = "Capture image for animal XXXX then continue."
                .Text = "Capture"
                .Run(doc1, Nothing)
            End With
    
            With Capture.CaptureCommands.Acquire(Nothing)
                .Run(Nothing,image1)
            End With
    
            With Capture.CaptureCommands.Preview(Nothing)
                .PreviewOn = False
                .Run(Nothing,image1)
            End With
    
        End Sub
Sign In or Register to comment.