Skip to content

Instantly share code, notes, and snippets.

@khanhkhuu
Last active February 8, 2023 06:14
Show Gist options
  • Save khanhkhuu/54e48ca7dff6c9d6738d63cbd7d8ad62 to your computer and use it in GitHub Desktop.
Save khanhkhuu/54e48ca7dff6c9d6738d63cbd7d8ad62 to your computer and use it in GitHub Desktop.
Dim ScriptHost : ScriptHost = Mid(WScript.FullName, InStrRev(WScript.FullName, "\") + 1, Len(WScript.FullName))
Dim oWs : Set oWs = CreateObject("WScript.Shell")
Dim oProcEnv : Set oProcEnv = oWs.Environment("Process")
If InStr(LCase(WScript.FullName), LCase(oProcEnv("windir") & "\System32\")) And oProcEnv("PROCESSOR_ARCHITECTURE") = "AMD64" Then
If Not WScript.Arguments.Count = 0 Then
Dim sArg, Arg
sArg = ""
For Each Arg In Wscript.Arguments
sArg = sArg & " " & """" & Arg & """"
Next
End If
Dim sCmd : sCmd = """" & oProcEnv("windir") & "\SysWOW64\" & ScriptHost & """" & " """ & WScript.ScriptFullName & """" & sArg
oWs.Run sCmd
WScript.Quit
End If
Set application = CreateObject("Sapgui.ScriptingCtrl.1")
Set connection = application.OpenConnection("Asia: (R/3 Test) CAI", True)
Set Session = connection.children(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment