Skip to Content
0
Former Member
Sep 20, 2017 at 11:05 AM

VBS Script error while running from desktop.

72 Views

Hello ,

i am making simple VBS Script as follow

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

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject application, "on"

End If

session.findById("wnd[0]").maximize

session.findById("wnd[0]/tbar[0]/okcd").text = "/nSt22"

session.findById("wnd[0]").sendVKey 0

while running the same by double clicking from desktop, it throws below error. while it runs fine with scripting recording functionality from GUI itself.

any help is appriciated.

Regards

Dishant.

Attachments

script-error.png (10.3 kB)