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

Can PREMIER 9.1.4 APP activate C:\ABC\123.TIF vs C:\XYZ\123.TIF if they are both open?

All --

I have an app that may have two images open from two image files but the files may have the same FILE NAME but be from different folders.

If I have both

    C:\ABC\123.TIF
    and
    C:\XYZ\123.TIF

open within PREMIER 9.1.4 then

    ThisApplication.Windows("123.TIF").Activate()

will not necessarily activate the correct image.

There is good reason for these two images to have the same name and to be open at the same time so is there a way to ACTIVATE based on the FULL NAME and not based on the FILE NAME / DISPLAY NAME?

Thanks.

-- Matt

Best Answer

  • edited February 2015 Answer ✓
    Matt,

    McImage.Name is a unique image identifier. It is based on file name, but if the image with the same name already exists, then the name will have a numerical suffix (2,3,...).
    Using file name activating window is not supported. The reason for that is that you may open the same image file multiple times, so you have multiple windows with the same file name.
    The proper way to handle image/window activation is to get pointer to McImage or IMcDocument when you open that image. (IMcDocument is returned by the Open command).

    Yuri  

Answers

  • Matt,

    You can do it using a macro, loop on all images and compare image.File.FullPathName to the path you are looking for, then use ThisApplication.Windows(image.Name).Activate() when you have a match (even if the file is having the same name, image.Name will be different).

    Pierre
  • Pierre --

    Thank you for the additional information.

    I'm familiar with

        ThisApplication.ActiveDocument.FileName
        and
        ThisApplication.ActiveDocument.DisplayName

    but not

        image.File.FullPathName

    If I can compare my FULL FILE NAME with

        image.File.FullPathName

    why couldn't I just call

        ThisApplication.Windows(c:\abc\123.tif).Activate()

    when I want to activate

        c:\abc\123.tif

    I've tried this and I get an error.

    Thanks again.

    -- Matt








  • Yuri --

    Thank you for your comments.

    I'll see if LEARNING and USING the IMCDOCUMENT works better than cycling through the OPEN IMAGES and querying whether their

        ThisApplication.ActiveDocument.FileName

    matches the one that I want.

    Thanks again.

    -- Matt

Sign In or Register to comment.