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

How to get a list of loaded projects and macros in Addin Project?

Hi everyone,

Could I get a list of loaded projects and macros in my Addin project like a batch processing? 
I want to call PlayMacro to run the selected macro before counting in the add-in.


Thank you & Best Regards,

Wesan
Tagged:

Best Answers

  • Options
    edited May 2023 Answer ✓
    Hi Wesan,

    MediaCy.Addins.Scripting.MacroSelector - is a combobox control with projects/macros, used in batch processing macro selector.

    Thanks,
    Nikita.
  • Options
    Answer ✓
    Hi Wesan, 

    If you are using an App interface, and I recommend that you do, you can add a macro selector : 



    In the macro selector's on selected index changed method, you can split the selected macro into the project + module and macro name: 

        Private Sub macroSelector1_SelectedIndexChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles macroSelector1.SelectedIndexChanged
            
            Dim macroParts As String() = macroSelector1.SelectedMacro.ToString.Split(New Char() {"|"c})
            
            Module1.setMacro1(macroParts(0), macroParts(1))
        End Sub


    You can then use these strings in the code that runs your selected macro: 

            If macroFile1 <> Nothing And macroName1 <> Nothing Then
                
                With Automate.ScriptingCommands.PlayMacro(Nothing)
                    .MacroFile =  macroFile1
                    .MacroName = macroName1
                    .Run(Nothing, Nothing)
                End With
    
                Else
                
                MsgBox("No Macro Set", VbMsgBoxStyle.vbExclamation, "Error")
                Exit Function
                
            End If



    I hope this helps!
    Andrew

Answers

  • Options
    Thanks Nikita, Thanks Andrew,

    I should have asked earlier.   I never knew it was possible to use these components.



    Wesan
Sign In or Register to comment.