Skip to main content

I am using Run Script command to run a vb script. The script runs fine when executed directly but doesn't even execute the first line of the script when called from the Run Script Command.

The script is for SAP GUI but this is not the only instance where this error comes up. I will attach the script for the reference.

 

WScript.Echo "hi"

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(wndp1]/usr/cntlCONTAINER/shellcont/shell).focusDate = "20220110"

session.findById("wndi1]/tbarB0]/btnu0]").press

 

Hi @Rishav Pandey​ ,

 

Could you try omitting the first line of code and see if the script works?

 

Kind Regards,

Ashwin A.K


Hi @Ashwin A.K​ 

 

I removed that line and tried it.. Result is same.

Even tried a blank script. Still the same

 

Thanks


Run Script command does not show you in which line the issue is, which you'd need to identify by using the MessageBox command to debug the exact line causing this issue.

 

Also, check the elevation mode of AA and SAP. I've seen SAP opening with Admin: yes while the AAPlayer opens with default Admin: no.

 

 


Reply