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

Close all images w/o the user prompt

Hi guys,
I found some examples about how to close all the open images without the user prompt.
I have used some of them on my macro but I still have the user prompt dialog.
here my code:
    With MediaCy.Automation.Application.ApplicationCommands.SetOption(Nothing)
       .Section = "Images"
       .Key = "PromptBeforeClosing"
       .Value = False
       .Run()
    End With
    With MediaCy.Automation.Application.WindowCommands.CloseAll(Nothing)
        .ShowPrompt=False
        .Run()
    End With
where is the mistake?
thank you
Maurizio

Answers

  • Hi Maurizio,

    You can close all images without prompt using this macro:
        Public Function Macro1() As SimpleScript
            Macro1 = New SimpleScript
    
            With Application.WindowCommands.CloseAll(Macro1)
                .Run()
            End With
    
        End Function

    You can find other ways to do that in this post:
    http://forums.mediacy.com/discussion/comment/604/#Comment_604 

    Regards,

    Yuri
  • Hi Yuri,
    I already tried, it doesn't work.
    this is what happens regardless the code I use.
    Recently I have installed the last Hot Fix  patch
    ciao
    Maurizio



  • Hi Maurizio,

    Next macros should close all images without prompt:

        Public Function CloseAllImagesWithoutPrompt() As SimpleScript
            CloseAllImagesWithoutPrompt = New SimpleScript
    
            With Application.ApplicationCommands.SetOption(CloseAllImagesWithoutPrompt)
                .Section = "Images"
                .Key = "PromptBeforeClosing"
                .Value = False
                .Run()
            End With
    
            With Application.WindowCommands.CloseAll(CloseAllImagesWithoutPrompt)
                .Run()
            End With
    
            With Application.ApplicationCommands.SetOption(CloseAllImagesWithoutPrompt)
                .Section = "Images"
                .Key = "PromptBeforeClosing"
                .Value = True
                .Run()
            End With
        End Function
    
        Public Function CloseAllImagesWithoutPrompt2() As SimpleScript
            CloseAllImagesWithoutPrompt2 = New SimpleScript
    
            With Automate.ScriptingCommands.CodeCommand(CloseAllImagesWithoutPrompt2)
                If .Run() Then
                    ' User Code Here
                    ThisApplication.WindowsEx.CloseAll(True)
                End If
            End With
        End Function

    Thanks,
    Nikita.


  • Hi Maurizio,

    My macro should also work, I just tested.
    Note, that you must use SimpleScript name as CloseAll parameter (Macro1):
        Public Function Macro1() As SimpleScript
            Macro1 = New SimpleScript
            With Application.WindowCommands.CloseAll(Macro1)
                .Run()
            End With
        End Function
    
    If the name is wrong or Nothing, it will show prompt:
            With Application.WindowCommands.CloseAll(Nothing)
                .Run()
            End With
    

    Yuri
  • Let me turn my request in this way, How can I close all the open images from an APP (not using a macro)?
    Thank you
    Maurizio
  • Hi Maurizio,

    If you have an app, just copy my code to your app (you may use full namespace to avoid conflicts), e.g. to AnsaldoGPT2_module.vb:
       Public Function Macro1() As SimpleScript
            Macro1 = New SimpleScript
            With Mediacy.Automation.Application.WindowCommands.CloseAll(Macro1)
                .Run()
            End With
        End Function
    

    And then call Macro1 from your app (e.g. from event handler), something like this:

        Private Sub DCReset_Cmd_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles DCReset_Cmd.Click
            AnsaldoGPT2_module.Macro1
    
    

    Yuri

Sign In or Register to comment.