VBS script error

Hi, community. I do have vbs script which scrolls through SAP window. If I launch it manually by clicking on vbs file everything works fine (I have tested it 10 times). However, running this script using “Invoke Code” activity with a code “System.Diagnostics.Process.start” gives me following error:
error
The same errors occurs when I use Start Process activity instead of Invoke Code, however launching this script manually is fine.
Here is a code of Script1.vbs:

Blockquote
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
For i = 0 To 366 Step 30
session.findById(“wnd[0]/shellcont/shell”).firstVisibleRow = i
Next

1 Like

It seems like invoke code just invokes the script and it isnt waiting till it ends, whereas the next action begins. I think you should try to add a Delay.

Yours sincerely,
Bakytzhan Konratov

2 Likes

Hi if it is a vbs please do use Start process (and pass args if any) get backk if issue still persists

Thank you, it is indeed the case. Adding delay after invoke code helped.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.