Yes this can be done, but the script needed in FileMaker 11 will be much longer than the script you can use in FileMaker 12 thanks to some new capabilities released with that version.
What version are you using?
Enter layout mode and use the Nam box in the inspector's postion tab to give each tab panel an object name. For simplicity sake, give them object names that are exactly the same as the layout names to which you want your button to take them.
USe the new script trigger for tab controls: OnTabSwitch with a new get function to extract the object name of the current tab panel and store it in a global variable:
Set variable [$$CurrentTab ; value: Get(TriggerTargetTabPanel)]
Also use the onRecordLoad trigger to perform a script that sets $$CurrentTab to the object name of the default tab panel.
Now your button's script can be:
Go to Layout [$$CurrentTab ] //use the "Layout name by calculation" option.
When I do the Get(TriggerTargetTabPanel) command it puts the tab number (ie 1,2,3,4,5) into the $$CurrentTab variable, not the object name. So I moved the appropriate layouts to be the first five layouts. It not as good as if it was the object name but it works. What command puts in the actual object name name?
When I return from adding a new record, the $$CurrentTab variable is set to zero even though i do a refresh screen and then also do the script to reload $$CurrentTab. In order to get the variable loaded again, i have to click on tab 2 and then go back to one. Not a great solution. Am I putting the refresh in the wrong place?
I did find a fix to it by setting up another variable and setting equal to the $$CurrentTab when I leave the first screen. I then set the $$CurrentTab equal to the saved variable when it comes back. I does work but I would like to use the object names rather than layout number.
The value of a global variable (must have two dollar signs to start the name of the variable), the value should not change unless a set variabler step or calculation with Let specifically changes it.
I should have either read the help file more carefully or tested my suggested fix. The Get(TriggerTargetTabPanel) returns a 2 value list, the index number of the tab followed by its object name.
Thus we can use GetValue ( Get(TriggerTargetTabPanel) ; 2 ) to refer to the object name of the newly selected tab panel.