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

cancel open image

How can I find out if the user has clicked 'cancel' when opening an image?

Answers

  • Do you do it by macro command? Then the command will have empty output.

        Public Function OpenImage() As SimpleScript
            OpenImage = New SimpleScript
            Dim docList1 = New List(1), doc1
    
            With Application.DocumentCommands.OpenImage(OpenImage)
                .Filenames = Nothing'user prompt
                .Run(docList1)
            End With
    
            If docList1 Is Nothing Then
                Exit Function'user canceled open
            End If
    
            With Application.DocumentCommands.Activate(OpenImage)
                .Run(docList1(0), doc1)
            End With
        End Function
    

    Yuri
  • Hi Yuri
    I have just solved my own problem. All I needed was to check the number of documents
    ThisApplication.Documents.Count
    
    Thanks anyway

Sign In or Register to comment.