Documentation ¶
Index ¶
- type ErrActionIDNotFoundInMacros
- type MacroManager
- func (mm *MacroManager) DoDelayAction(param string) error
- func (mm *MacroManager) DoPressAction(param string) error
- func (mm *MacroManager) DoPressReleaseAction(param string) error
- func (mm *MacroManager) DoReleaseAction(param string) error
- func (mm *MacroManager) DoRepeatAction(param string) error
- func (mm *MacroManager) DoSendTextAction(param string) error
- func (mm *MacroManager) DoShortcutAction(param string) error
- func (mm *MacroManager) RunActionFromID(actionID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrActionIDNotFoundInMacros ¶
type ErrActionIDNotFoundInMacros struct {
// contains filtered or unexported fields
}
Errors
func (ErrActionIDNotFoundInMacros) Error ¶
func (e ErrActionIDNotFoundInMacros) Error() string
type MacroManager ¶
MacroManager creates a functionMap from the config, and is used to run Macros. Use NewMacroManager to init!
func NewMacroManager ¶
func NewMacroManager(doResetConfig bool) (*MacroManager, error)
NewMacroManager Creates a MacroManager, will load a Config from ${HOME}/mmpConfig.yml. If the config file is missing, copy the default one there.
To run a macro, use the RunActionFromID func
func (*MacroManager) DoDelayAction ¶
func (mm *MacroManager) DoDelayAction(param string) error
DoDelay will time.sleep for the delay if it can be parsed
func (*MacroManager) DoPressAction ¶
func (mm *MacroManager) DoPressAction(param string) error
DoPressAction will press down a key and keep it held. To release, use DoReleaseAction. param should be a keyname, see README.md e.g. DoPressAction("enter")
func (*MacroManager) DoPressReleaseAction ¶
func (mm *MacroManager) DoPressReleaseAction(param string) error
DoPressReleaseAction will press and release a key or mouse button param should be a keyname or mouse btn name, see README.md e.g. DoPressReleaseAction("enter") or DoPressReleaseAction("RMB")
func (*MacroManager) DoReleaseAction ¶
func (mm *MacroManager) DoReleaseAction(param string) error
DoReleaseAction will release a pressed key. To press, use DoPressAction. param should be a keyname, see README.md e.g. DoReleaseAction("enter")
func (*MacroManager) DoRepeatAction ¶
func (mm *MacroManager) DoRepeatAction(param string) error
DoRepeatAction will... param should be formatted as: "LMB+100ms" Only a single key and the delay between repeats should be in the string.
func (*MacroManager) DoSendTextAction ¶
func (mm *MacroManager) DoSendTextAction(param string) error
DoSendString will type a string that's passed param should be a string, this can be a letter, word, sentence, etc. e.g. DoSendTextAction("foo bar")
func (*MacroManager) DoShortcutAction ¶
func (mm *MacroManager) DoShortcutAction(param string) error
DoShortcutAction will type a shortcut out for you param should be formatted as: "SHIFT+ENTER+c" After keys are held down, there's a delay defined in mm.Config.Delay, then the keys will release This does NOT support mouse buttons e.g. DoShortcutAction("CTRL+SHIFT+ESC")
func (*MacroManager) RunActionFromID ¶
func (mm *MacroManager) RunActionFromID(actionID string) error
RunActionFromID - Run Actions from the matching ID in Config.Macros (loaded from yml) This is the method to call a macro, if you want to *do* something, call this method. The macro must exist in the config, and the name must match the key in the function map. This converts the actionID to an int (if possible), if not then log the error