Skip to Content
0
Former Member
Mar 08, 2012 at 12:35 PM

VBS Script: Wait, Pause, Sleep

14881 Views

Dear EXperts,

Newbie here.

I was able to record something (picking progress in TC LT45) and thus generate a VBS file.

Now, running this script is doing what it should do, except for the timing: It runs way too fast and therefore I am searching for adding some command/code to pause.

I found examples like Application.Wait("0:00:1000") but SAP does not like that.

See 'my' code below.

Any answer will be appreciated.

Thanks, Nick

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

Application.Wait("0:00:1000")

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

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

Application.Wait("0:00:5000")

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

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

Application.Wait("0:00:1000")

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

Edited by: N. Lagace on Mar 8, 2012 1:37 PM