If you want to parse it generically to the script, I think the function you're looking for is 'Get ( ActiveLayoutObjectName )'.
Get ( ActiveLayoutObjectName ) will not work for a button. It is never "active" at the moment it's clicked.
If your script wanders off to a different layout and then comes back then you will by default return to the first slide in the order.
One easy way to do this is collect the data and do stuff in a new window as it wil not disturb the current one.
Another way is assign names to the slides and track them with a global field or variable via a script trigger:
Set Variable [ $$currentPanel = GetValue ( Get ( TriggerTargetPanel ) ; 2 ) ]
You need the second value because it will return the actual name of the panel you're about to go to.
The first value is the panel index.
Then you can return to this object at the end of the script.
Electon: Thank you. Both those methods will be useful specifically to this and generally. However, I've found a specific problem at the end of my script that is causing the problem. I end with a sub-script that selects the first of a specific portal row. To do this the portal is a named object. Of course because I have slideovers, I've duplicated the portals/ objects except that the portals get different names and therefore can't be found by the script.
I can't have portals/objects of the same name yet I need them to be treated identically by the same script, just on a different slideover. It seems I'm wanting something mutually exclusive.
If the portals are from the same table occurrence then all you'll need to do is make sure you select the right portal with GoToObject [ ].
If you know on which panel you are then you can determine which portal name to use.
Then all you need is a name switch before you do the actions on the portal.
Also don't forget but maybe you need to catch the active portal row number as well, depending on what the script does.
GoToPortalRow will by itself always select the first portal in the object stack.
I think the order of creation on the layout is what determines this.
So if you have more portals, you want to make sure you go to the right one.
Brilliant thanks- took a little time plodding through the new area but it works well.