Typically it is a BAD idea to try and "click" buttons programmatically. The correct way to do this in Mach 4 is to use the API to do the same function the button does. Now, if the button does some custom LUA code, put the code in a function in the screen load script and then call that function from the button AND your other code. If you want to call this function from a M code script, you will have to put the function in a module that both the screen and the m code scripts load.
I typically like to put all of my custom code in a LUA module. That way I can call the functions from the screen buttons, screen PLC script, and M code macro scripts. But be aware that there no global variables shared between the screen and macro LUA environments. Use Mach registers to share data.
And I really really hate to mention this because it is the WRONG way to do it and I regret putting this function in the GUI. But inside the screen LUA environment, you can use scr.ButtonClick('button-name'). If you want to use this function in a macro script, you will have to load the screen api. See load_modules.mcs in the lua examples.
scr=require('screenipc') -- require the screen api.
scr.scIpcInit('localhost:48500') -- init the screen api.
Steve