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

Error message

Hello,

recording a macro caused an error : "non-static method requires a target".
what I did was just setting a polygon measurement area in an image.
What went wrong? Any idea?

Regards



Best Answer

  • Options
    edited March 2014 Answer ✓
    Hi Thomas, It looks a locale problem, you have to replace commas by dots in the numbers: 

     x .Points.Add(New System.Drawing.PointF(112.5667F,72.94762F))
     .Points.Add(New System.Drawing.PointF(45.10477F,45.10477F)) 

     For you testing you may temporary change decimal separator in Window's settings from comma to dot. It supposed to be fixed in 9.0.3 patch, but I will double check. 

     Yuri

Answers

  • Options
    Hi Thomas,

    It's difficult to say what the problem is without looking at the macro. The error can be caused by previously recorded macros in that scrips. When you have the error the tooltip tells you the line number of the error.
    You ca try to create a new project and record the same macro to see if it works. If it will still fail, please post the macro and the version of Premier your are using.

    Regards,

    Yuri
  • Options
    Thank you for your comment.

    Here is an example...setting a "measurement circle" into an image ...in a completely new project - the "x" is marking the problematic line (IP Premier 9.1 evaluation version) :


    Imports MediaCy.Addins.Measurements
    Public Module Module1


    Public Function NewMacro() As SimpleScript
    NewMacro = New SimpleScript
    Dim image1, meas1

    With Application.DocumentCommands.ActiveImage(NewMacro)
    .Run(image1)
    End With

    With Measure.MeasurementsCommands.Add(NewMacro)
    .MeasurementType = McMeasurements.enumMMSTypes.mmtsCircle
    .Points = New System.Collections.Generic.List(Of System.Drawing.PointF)
    x .Points.Add(New System.Drawing.PointF(112,5667F,72,94762F))
    .Points.Add(New System.Drawing.PointF(45,10477F,45,10477F))
    .FeatureName = "C1"
    .SnapFeature = False
    .Run(image1, meas1)
    End With

    End Function

    End Module

  • Options
    edited March 2014
    Hi Thomas,

    I just checked and can confirm that recording coordinates with European locale is working properly in the latest version. If you are prompted to install a patch at startup, please do that. You can check the version of the application in the About dialog box.

    Yuri
  • Options
    Hello Yuri,

    indeed, this was the reason.
    Thanks for the information....especially because it is Sunday.

    Thomas
Sign In or Register to comment.