Using ApplyGUIScript to sort a grid control: I run a VBSscrpt with "ApplyGUIScript" which sorts a grid control on two columns, one after the other. This works only when I run the script directly on the SAP screen or when I sort the grid by one column only. What could be wrong?
My script is essentially as follows:

GRID1.selectColumn?"col1..."
GRID1.pressToolbarButton?"&SORT_ASC"
GRID2.selectColumn?"col2..."
GRID2.pressToolbarButton?"&SORT_ASC"

If the button click to sort the table results in an application server interrupt, you need to set the object handles again, e.g. GRID1, GRID2.
In addition, each action in the VBScript that is executed on the application server replaces an "Enter" in the InputScript.
For example, when you have seven Enter-type actions in VBScript, you need seven Screen commands without "Enter" in the InputScript, otherwise the actions are no longer in sync.
You need to keep in mind that you are working with two mechanisms (VBScript and the InputScript) that trigger SAP GUI actions.