There's a function called Get(LayoutName) which you can attach as a script parameter to the button.
Set the button to perform your script. In the Select Script dialog, there's a box for entering a script parameter. You can put the layout name into that box as quoted text, refer to a field or variable that stores that layout name.
For a script that does something else with the current layout name, the parameter expression could even be Get ( LayoutName ) to pass the current layout's name to the script. (Wouldn't use that with go to layout as that would "go" to the layout that you are already on...)
in other words ... yes
I use this to choose the correct layout.
In an application, I have four layouts, per example if generic layout name is "Menu", I have :
- layout "Menu" for mac and PC,
- layout "MenuiPad" for iPad,
- layout"MenuiPadPro129" for largest iPad Pro,
- layout "MenuiPhone".
Following type of screen or system type I set a global variable named $$ComplementaryLayoutName value to "", "iPad", "iPadPro129" or "iPhone" when launching the application.
I open screen with name : "Menu" & $$ComplementaryLayoutName.
This is a great thing, I wish one day we can do the same with scriptname per example in "ExecuteScript ( ScriptName )".