If you use the Select Window script step, you can click a control in one window and the script that is performed can change focus to the other window to do what is needed to change the display in that window.
In some cases, you can calculate the position of the object that was clicked to set the top and left values for the window. Get functions can return the top and left values of the window in which the button is located and then you calculate an offset from that to get the position of the clicked button.
But this won't work if the button is inside a scrolling portal or list view.
I completely overlooked "select window" thank you.
How can I script -
If (window is not open(window name))
Open window named (window name)
select window (window)
go to related record
If [ IsEmpty ( FilterValues ( WindowNames ; "Your Window Name" ) ) // window is not open ]
WindowNames is a function that returns a list of all currently open FileMaker names.