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

How do I tell McImage which is the active image to return data on?

I have three tif images loaded (Image1, Image2, Image3) and I want to get the Pixel Intensity data from each file in turn.

I have

        Dim im As McImage=ThisApplication.ActiveImage
But             ThisApplication.Windows(strImageID).Activate()
Where strImageID is updated for each file name does not update ActiveImage so the GetArea function does not report for each image but

Best Answer

  • edited February 2016 Answer ✓
    Hi Chris,

    There a re different ways to get image list, you can get it from Images, Documents, Windows. I will show you how to get it from MRU (most recently used windows):

        Public Sub ProcessAllImages
            'go through the list of open windows in Most Recently Used order (MRU)
            For Each wnd As McWindow In ThisApplication.WindowsEx.MRU
                Dim im As McImage=TryCast(wnd.Document.Data,McImage)
                If im IsNot Nothing Then
                    Debug.Print im.DisplayName
                    ''do something with im
                End If
            Next
        End Sub
    Regards,

    Yuri

Answers

  • Apologies the text has come up as code.  Last paragraph should read ".... but reports data only on the last image I manually selected and does not increment with my For Next loop
  • :) Thanks Yuri - this did the trick
Sign In or Register to comment.