QUOTE (Nitro @ Sep 3 2009, 07:52 AM)

How I solved it:
AcceleratorTo ("F4", "domacro F4", sendto.execute)
CODE
<alias match="domacro *" enabled="y" sequence="100" send_to="12">
<send>
if "%1"=="F4" then
Send("gut " .. target)
end
</send>
</alias>
Allows for easy addition of other macros.
This might be marginally more helpful:
CODE
-- Call this to add a function macro
function CreatePluginMacro(key, func_name, data)
AcceleratorTo(key, "CallPlugin('" .. GetPluginID() .. "', '" .. func_name .. "', '" .. data .. "')", 12)
end
-- Macro functions can only accept one string parameter
function my_macro(str)
Note("This string was passed to me: ", str)
end
CreatePluginMacro("F4", "my_macro", "data_on_keypress")
Personally, I prefer this because it's cleaner; you don't leave middleman aliases hanging around for the unsuspecting user to accidentally use. Personally, my preference is to leave as much of the user's direct interface untouched, i.e. aliases and keybindings. Aliases are obviously a necessity; I just ensure I don't create too many, and I probably stick to just one base "verb" (like, HARVESTER <options> would be the root alias for all of my Harvester plugin aliases). Keybindings I'm less fond of being created by the plugins. If a user wants a binding, they can make one easily, but if you just add a keybinding to F4, and say they already have one there, you could make them scratch their head and/or punch their screen.