I have a config file that I need to read to determine what software is installed and where our software is. I have a function that works attached to a test button, but I want the same routine to be run for all the buttons I add. Obviously, I can cut and paste it into the other methods, but Is there a way of defining a global routine that can just be called from the other methods without me having to duplicate the code?
Well You can always insert the method in Global class and run it from there each time You execute some code, but that’s it. There is no way to execute this code automatically if that’s what You mean.
Well, there are places in AX code where you can add some code which executes before/after every clicked() methods on all buttons in AX. HOWEVER, I seriously doubt that you want to apply this logic too all existing AX buttons…
So I still think that you can’t use any universal behaviour for all the buttons in system and you will have to modify only those buttons which you added yourself.
Well, to ease your job - write a macro and store it in AOT and call it in buttons which require that config file check. That’s it !