The help file entry for 'Get ( ActiveLayoutObjectName )' states:
There is a named button on the current layout called cancelButton. When the focus is on the button, Get(ActiveLayoutObjectName)returns cancelButton.
In various posts I've seen over the last couple of years, I think I'm not alone in wishing that it was as simple as it appears from that entry. Problem is, clicking a button doesn't bring it into focus...
I've been trying to develop a workaround as I often implement a 'sort' routine which shifts focus to another window, then returns to the current one - but it may not return to the original object. Of course, it is possible to include the object name as text in the parameter - but if any object is renamed, scripts may not behave as expected! So I wanted to find a way to send the 'enclosingObject' name with the script parameter as calculated information.
I expect there are clever workarounds to fulfill this requirement that folks have already developed, but I couldn't find any links to one. So, while the attachment is probably not particularly elegant, it may be that it will be of help to somebody.