Important hint: This post is old and the content refers primarily to the x86 versions of the SAP GUI for Windows, when there were no x64 versions available. The content described here is partially not valid to the x64 versions of the SAP GUI for Windows.
There are several ways to execute an SAP GUI script:
- Via SAP GUI recorder, press Alt+F12, now choose the menu item Script Recording and Playback, load the script file and press Playback button.
- Via Drag'n'Drop with the script file to the session where the script should be executed.
- Via double click on the script file in the Windows Explorer.
- Via the command line in a console window with the command wscript.exe or cscript.exe and the name of the script file.
This are four ways but technically this are only two ways. One and two works technically equal, also as three and four.
It seems that one and two executes the script via MSScriptControl in the older versions. This means that the SAP GUI for Windows instanciate the class MSScriptControl.ScriptControl from the msscript.ocx library and executes the SAP GUI Script as statement - I assume. However, the MSScriptControl is only available as x86 version.
To check it out I create the following test script:
'-Begin-----------------------------------------------------------------
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
session.findById("wnd[0]/tbar[0]/okcd").text = "/nSE16"
session.findById("wnd[0]/tbar[0]/btn[0]").press
WScript.Sleep 500
WScript.Echo "Test"
'-End-------------------------------------------------------------------
The reaction with one and two are

and the same on SAP GUI for Windows 8.00 PL 8 x64
In the current version a runtime error from the VBScript occurs, while in the old version a message from the SAP Frontend Server pops up. Even in the current version it seems that the VBScript does not executed with the Windows Script Host, because the WScript object is not available.
To see reaction in a simulated context of SAP GUI for Windows I create the following test script:
'-Begin-----------------------------------------------------------------
' Important hint: This script does not work on x64.
Option Explicit
Dim ScrCtrl, Cmd
Set ScrCtrl = CreateObject("MSScriptControl.ScriptControl")
If IsObject(ScrCtrl) Then
ScrCtrl.AllowUI = vbTrue
ScrCtrl.Language = "VBScript"
Cmd = "WScript.Echo ""Hello World"""
ScrCtrl.ExecuteStatement Cmd
End If
'-End-------------------------------------------------------------------
The reaction is the same as one and two

This knowledge gives us now a good base to understand the behaviour of the different executions forms better. On the one hand via MSScriptControl respectively another way, on the other hand via WScript.
Hint: If you work with WScript you must define the connection (application.Children(x)) and session (connection.Children(y)) with correct values - here x and y as example. The standard defines always 0 - which means connection 0 and session 0, the first connection and session in the pool of all open connections and sessions.