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

How to display the [types] interface in macro?

Hi everyone
In my app design, I have a button that, when clicked, shows the [types] settings interface.
Simply navigating to this tab and automatically opening [types] would be sufficient.

Is there a way to perform the [open types] action? I’ve tried using [macro] to record it, but it came out blank.

Waiting for a response, thank you, everyone.

Best Answer

  • Answer ✓
    Hi Kyle,

    The CSRibbon property is available only from IP version 11, so in 10.0.15 you should use other methods.

    You can either use Key-tips Alt - S (to activate Count/Size ribbon), and ML to open the Types dialog:


    Or use SendKeys to send mouse click to the Types button (using Screen coordinates), like this:

        Public Function ShowCountTypes() As SimpleScript
            ShowCountTypes = New SimpleScript
    
            With Application.RibbonCommands.SelectRibbonTab(ShowCountTypes)
                .TabName = "CountSize"
                .Run()
            End With
    
            With Automate.ScriptingCommands.CodeCommand(ShowCountTypes)
                If .Run() Then
                    'Click Types button
                    SendKeys("{ClickLeft 320,80}")'screen coordinates of the Types button            
                End If
            End With
        End Function
    
    

    Regards,

    Yuri

Answers

  • Hi Kyle,

    Here is a macro that will expand the Types button:

        Public Function ShowCountTypes() As SimpleScript
            ShowCountTypes = New SimpleScript
    
            With Application.RibbonCommands.SelectRibbonTab(ShowCountTypes)
                .TabName = "CountSize"
                .Run()
            End With
    
            With Automate.ScriptingCommands.CodeCommand(ShowCountTypes)
                If .Run() Then
                    ' Expand Types button
                    Mediacy.Addins.Measurements.McMeasurements.ThisAddin.CSRibbon.ButtonMeasurements.Expanded = True
                End If
            End With
        End Function
    
    

    Regards,

    Yuri
  • Hi YuriG,

    Thanks for getting back to me. I’ve already tried using a macro, but I’m running into an issue with a missing [CSRibbon] reference. Is there something else I need to add?

    My version is 10.0.15.


    Waiting for a response, thank you.

  • Hi YuriG,
    Many thanks, this works!
Sign In or Register to comment.