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

Selecting a Folder

I want to select a folder so I use the 'Open Folder' button.

    Public Sub button_OpenFolder(sender As Object, e As System.EventArgs) Handles button_OpenFolder.Click
        With Application.DocumentCommands.OpenFolder(Nothing)
            .Run(TryCast(ThisApplication.ActiveDocument,MediaCy.IQL.Application.IMcDocument))
        End With

    End Sub
When I run it, I see a folder browser but there is no 'OK' or 'Cancel' button. How can I get the selected folder?


Best Answers

  • Answer ✓
    Hi Paul,

    This command just opens Windows explorer, nothing else. If you want to have a command to load image from a folder that user selects, you should use OpenImage command in interactive mode (when you set FileNames to Nothing). Here is the example:

        Public Function OpenFileInteractively() As SimpleScript
            OpenFileInteractively = New SimpleScript
            Dim docList1 = New List(1), doc1
    
            With Application.DocumentCommands.OpenImage(OpenFileInteractively)
                .Filenames = Nothing
                .Run(docList1)
            End With
    
            With Application.DocumentCommands.Activate(OpenFileInteractively)
                .Run(docList1(0), doc1)
            End With
    
        End Function
    
    Let me know if it works for you,

    Yuri

  • thanks
Sign In or Register to comment.