Hi Chandra
If you need a script to run inside a button then do not use the button's GotoCard property on the toolbar because that property disables a button's script.
Instead, just use the GotoCard command inside your button:-
@ button script to run
..
IF (x=2) THEN
GotoCard 2
ENDIF
..
..
GotoCard 4
Malkom