This website is not affiliated with, sponsored by, or approved by SAP AG.

Recorded VB Script help

Third Party products such as GuiXT, BMC Patrol, Vertex, Ixos etc...

Moderators: Snowy, thx4allthefish

Recorded VB Script help

Postby derby68 » Wed Jan 04, 2012 2:10 am

HI Guys,

I'm looking for help with recorded VB scripts. I've recorded the scripts and added them to the favorites menu to automate certain tedious tasks. However if i open extra SAP windows and click the script shortcut it still runs in the first window that was opened.

Is there anyway i can stop this so the script runs in the window it's clicked?

Thanks
derby68
 
Posts: 2
Joined: Fri Dec 30, 2011 2:13 am

Re: Recorded VB Script help

Postby NetKid » Tue May 14, 2013 6:00 am

Hi derby68,

you have to change the SAP automatic generated code

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



with this code:

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
Set session = application.ActiveSession



then you're not fixed to the first session in wnd[0].

Bye, NetKid
NetKid
 
Posts: 1
Joined: Mon May 13, 2013 5:33 am


Return to Third Party Products

Who is online

Users browsing this forum: No registered users and 1 guest





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.