InputMapper commands are actions that can be executed by various means and events throughout InputMapper such as when InputMapper starts or exits. Commands are also the actions taken by macros when triggered.

Commands make use of the Custom* attributes to define name and appearance

Commands have two interfaces; IIMIndependentCommand and IIMMacroCommand.

In addition to the two main interfaces commands may also implement IIMConfigurable if you wish to have user defined settings for the command.

IIMIndependentCommand is the most common and can be used anywhere in InputMapper where commands can be set including in macros.

[CustomName("My Command")]
[CustomIcon(InputMapperIcon.IMIcons.None)]
[CustomCatagory("My Category", InputMapperIcon.IMIcons.None)]
public class MyCommand: IIMIndependentCommand
{
    public void Execute()
    {
        // Do Stuff
    }

    public override string ToString()
    {
        return "My Command";
    }
}

 

IIMMacroCommand is less common and only needs to be used when the executing command needs a reference to the calling macro, such is the case in commands like WaitForUnTrigger since the command need to know if the macro is still triggered. This interface is rare and when used can ONLY be used in macros.

[CustomName("My Command")]
[CustomIcon(InputMapperIcon.IMIcons.None)]
[CustomCatagory("My Category", InputMapperIcon.IMIcons.None)]
public class MyCommand: IIMMacroCommand
{
    public void Execute(Macro refMacro)
    {
        // Do Stuff
    }

    public override string ToString()
    {
        return "My Command";
    }
}