Skip to Content
0

VBS Script error while running from desktop.

Sep 20, 2017 at 11:05 AM

17

avatar image
Former Member

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.

script-error.png (10.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers