Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2740

Re: Activating the SAP window

$
0
0

Hi Steve and the other,

 

although a solution already exists, I would like to contribute a small example of me.

 

for example:

 

'vbs version:

 

myString = "SAP Easy Access"

 

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

 

for mySession = 0 to connection.children.count - 1

Set session    = connection.Children(int(mySession))

Position = instr(1,session.findById("wnd[0]").text,myString)

if Position <> 0  then exit for

next

if Position <> 0 then

   session.findById("wnd[0]").iconify

  session.findById("wnd[0]").maximize

end if

 

'excel version:


myString = "SAP Easy Access"

 

Set SapGuiAuto = GetObject("SAPGUI")

Set SapApplication = SapGuiAuto.GetScriptingEngine

Set Connection = SapApplication.Children(0)

Set session = Connection.Children(0)

 

 

For mySession = 0 To Connection.Children.Count - 1

Set session = Connection.Children(Int(mySession))

Position = InStr(1, session.findById("wnd[0]").Text, myString)

If Position <> 0 Then Exit For

Next

If Position <> 0 Then

   session.findById("wnd[0]").iconify

   session.findById("wnd[0]").maximize

End If

 

The variablemyStringdoes notcontainthe completenameofthe SAPwindow. It reaches only a small part of this. The uppercase and lowercase letters are considered.

 

Regards,

ScriptMan


Viewing all articles
Browse latest Browse all 2740

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>