on 05-05-2006 10:16 PM
noob here...
I am trying to cause a script to pause for a bit, and while I have tried <b>Wscript.Sleep 1000</b>, the script bugs out and says :
<b>Microsoft VBScript runtime error - Object required: 'WScript'</b>
I'm assuming that the answer is pretty simple, but... I'm a noob... so nothing is simple for me right now.
Any ideas?
Hello I checked this tscipt above and says that Object required: 'Wscript'
please tell me how to make a pause for SAP GUI script for pause for 10 sec
Best Regards
Slawomir Korman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
the wscript object is only available when the script is executed using the Windows Script Host. This happens for example when you double click the VBS file.
If however you run the script from SAP GUI then it will be executed using the MS Script Control, and this control does not support the wscript object and its members.
Best regards,
Christian
Hello Slawek,
I am trying to decipher your answer. Your code was very similar to mine, but I did not understand what code you added where to make your PAUSE function work. Please tell me again?
Thank you,
Nick
****************************************************************************** Not Clear:
A added
before MsgBox "Pre-Pause"
On Error Goto 0
***********************************************************************************************************
********************************************************My Code (I want Pause after SendVKey8)
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]").resizeWorkingPane 263,47,false
session.findById("wnd[0]").sendVKey 8
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 8
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 8
session.findById("wnd[0]").sendVKey 3
can you post more of the script? Kind of hard to debug a line that appears to be fine.
Make sure you are using wscript to run it and not cscript
Mike
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok, here is a very basic version (for testing purposes):
---
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
MsgBox "Pre-Pause"
Wscript.Sleep 1000
MsgBox "Post-Pause"
---
This scrip runs fine until it hits the Wscript.Sleep 1000 line.0
Then the error message appears.
And... just another note (in case this matters):
I connect to SAP remotely via a Citrix server over the internet.
Not sure if that matters, but I figured that it might be worth mentioning just in case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.