Use the Inspector's name box to give each tab an object name. Your script that saves the layout number can also save the tab name in a similar variable. When you return to the layout, use go to object to go to the tab's object name and this will return you to the same tab that was selected when you switched to the other layout to view the enlarged image.
So I set the object names of the tabs in the inspector (in the Name field at the top of the position tab in the inspector?). I create the variable $$tab = Get (ActiveLayoutObjectName). I press the button to get to the layout with the enlarged image. I press the button (script) in the other window to return and I get back to the front tab. The script to return uses Goto Layout -> $$layout, and Goto Object -> $$tab and then the $$ variables are set to 0. It's not working.
You've used the correct box in the inspector to set object names. In Layout mode, you should see the name change as you click different tabs in the control.
I'm afraid that you'll need to use something a bit more sophisticated to store the current tab's object name into the variable.
You may need to use something like this:
Set variable [$$Tab ; Value:
Case ( GetLayoutObjectAttribute ( "Tab1ObjectName" ; "IsFrontTabPanel" ) ; "Tab1ObjectName" ;
GetLayoutObjectAttribute ("Tab2ObjectName" ; "IsFrontTabPanel" ) ; "Tab2ObjectName" ;
//and so on for each tab in the control
Edit Note: corrected typo pointed out in following post...
This worked very well, thank you so much. If anyone else is to use it just make sure you correct a little typo in it before you copy and paste it multiple times. The second GetLayoutLbjectAttribute has an L where it should be an O - GetLayoutObjectAttribute