Example using RunClickScript to emulate a subroutine

This example shows a way to use a object's 'On click' script as a subroutine, which can be called using RunClickScript[] from elsewhere.
Click on any of the points A, B, C, D, E. Clicking the point sets the value of 'target' to the name of the point, and then calls RunClickScript[myButton] to execute the button's 'On click' script. This script then constructs and executes a command to change the colour of the clicked point.