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

User Prompt interactive function

Hi Specialist:
            I have read some excellent solutions about interactive prompt, but could someone give solution to the interactive function.

what is the event function to this "ok" button and "cancel" Thank you






Tagged:

Answers

  • Hi Stanley,

    When you click OK, the macro continues, when Cancel - it throws an error, so you can put the command in try/catch block and handle Cancel in the catch.

    Yuri
  • Hi YuriG:
               Thanks for your prompt response. I am just interested in other method as I found the solution of try .. catch in the link: https://forums.mediacy.com/discussion/comment/969#Comment_969
    But very appreciate for your help.

  • 2022-02-14-142959

    StanleyH --

    I think you may be asking for a piece of sample CODE to illustrate how to use the INTERACTIVE MODE.

    Here is some CODE from one of my projects that may help you.

    Let me know if this is helpful.

    -- Matt

    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

            'DELETE ANY MEASUREMENT OBJECTS WHICH MAY BE ON THE IMAGE
            With Measure.MeasurementsCommands.DeleteAll(Nothing)
                .Run(ThisApplication.Activedocument)
            End With

            'DELETE ANY ROI OBJECTS WHICH MAY BE ON THE IMAGE
            With [Select].RoiCommands.DeleteAll(Nothing)
                .Run(ThisApplication.Activedocument)
            End With

            'Use TRY and CATCH to handle errors
            Dim My_Flag As String
            Try

                    'SET THE CIRCLE TYPE TO CENTER RADIUS
                    With Measure.MeasurementsCommands.Options(Nothing)
                        .CircleCreationMethod = McMMOptions.mcmmccMethods.mcmmccCenterRadius
                        .Run(ThisApplication.Activedocument)
                    End With

                    With Measure.Measurements.ToolsCommands.Select(Nothing)
                        .prompt = _
                            "Please create a " & vbLf & vbLf & _
                            "CENTER RADIUS CIRCLES over BACKGROUND AREAS" & vbLf & vbLf & _
                            "then press OK to CONTINUE!"
                        .Tool = emmtool.Circle
                        .Interactive = True
                        .Run(Nothing)
                    End With

                Catch

                    'ACTION FOR CANCEL PRESSED

                Finally


                End Try


  • Thanks Matt for your answer. Your answers in other posts also provided new comer many solutions. 
  • 2022-02-15-092714

    StanleyH --

    I am glad to help.

    Lot's of folks have given me assistance over the years and I am glad to do that courtesy for others.

    Have a great day.

    -- Matt


Sign In or Register to comment.