Home Forums General XMetaL Discussion Event to trigger after macro/command clicked Reply To: Event to trigger after macro/command clicked

Derek Read

Reply to: Event to trigger after macro/command clicked

There is no specific event designed for what you want to do.

What you suggest is probably the simplest and most reliable way to do this. Putting the code in a separate function or macro and calling that (as you suggest) would mean you only need to add one line to each of your others.

One alternative would be to add something to the On_Update_UI event to make the additional change, but you would need additional logic in there to make sure that when this event fires and one of your macros wasn't the trigger that it doesn't do something you don't want to happen. This event isn't really meant for this purpose however. I think this would be messy. It is also recommended that this event contain the smallest amount of code possible as it runs frequently.

Another option would be to run through all the nodes in your document before saving, in On_Document_Before_Save, and set any values there. This of course means that you can figure out what needs to be added at that time. If that can't be done easily out of context of running the initial macro then you might need to use the ChangedNodes and related APIs to figure out what has been changed (that might not even give you enough context). I don't think that would save you much coding and it would introduce more complexity.