"Consider that I don't know the name of the previous layout."
Why would you not know the name? You select it from the list.
If the situation comes like where numebr of layouts exceeds hundreds, then it will be too difficult to recall the layout name where I was previously even looking through the list.
This is where I need to have some scripts which will be able to store the immediate previous layout name in local variable which can be recalled along with "go to layout" script.
Please help me.
You only have to find the Layout Name once! That's when you're writing the script. I suggest you simply do it. It would be unusual to have hundreds of layouts in one file.
i think whatcha doin is very difficutl to put but u could start with :
set variable ( $var; get ( layoutName))
As Kays Khelifa suggests I would use a variable to store the name of the previous layout, however I would use a global variable - which means it will still be stored after that script finishes - adding some flexibility as other scripts could use it.
Set Variable[ $$BACK ; Get ( LayoutName ) ]
Go to Layout [ Layout2 ]
The Get ( LayoutName ) function will store the name of the layout you're on before going to the new layout... When you want to go back use the Go to Layout script step again but this time choose "Layout Name by Calculation" in the calculation box all you need to enter is $$BACK since it is storing the name of the layout you were on.
but the problem here is : when u do "go to layout ($$BACK)" you need to store the current layout too,
so here is what you need to :
set variable ( $var; get (layoutName))
go to layout ($$BACK)
set variable($$BACK; $var)
so everytime leave a layout, you the layoutName stored in $$BACK, and you wont loose the layoutName you left.
Good point! After re-reading the original post I notice it says between SEVERAL layouts... But your simple 2 variable work around overcomes the problems pretty nicely.
Here's a trick that will maintain a full list of every layout to which you have navigated during a given session so that you can retrace your steps at every point if needed:
Write this one line script and set up an OnLayoutEnter script trigger on every layout to perform it:
Set variable [$$LayoutHistory ; Value List ( get ( LayoutName ) ; $$LayoutHistory ) ]
Then this script will let you go back to the previous layout each time you perform it, all the way to the first layout you accessed when you opened the database:
Set variable [$Back ; GetValue ( $$LayoutHistory ; 2 ) ]
Set Variable [$$LayoutHistory ; RightValues ( $$LayoutHistory ; ValueCount ( $$LayoutHistory ) - 2 ) ]