#-Begin--------------------------------------------------------------
#-Includes------------------------------------------------------------
."$PSScriptRoot\COM.ps1"
#-Sub Dump---------------------------------------------------------
Function Dump($Collection) {
ForEach($Item In $Collection) {
If ( $Item -IsNot [System.__ComObject] ) {
Write-Host $Item
} Else {
Dump $Item
}
}
}
#-Sub Main---------------------------------------------------------
Function Main() {
$SapGuiAuto = Get-Object( , "SAPGUI")
If ($SapGuiAuto -IsNot [System.__ComObject]) {
Return
}
$Application = Invoke-Method $SapGuiAuto "GetScriptingEngine"
If ($Application -IsNot [System.__ComObject]) {
Return
}
$Control = Invoke-Method $Application "findById" `
@("/app/con[0]/ses[0]/wnd[0]/usr/cntlIMAGE_CONTAINER")
#-With the method DumpState we get the collection----------------
$Collection = Invoke-Method $Control "DumpState" @("")
#-With the recursive function we get the information-------------
Dump $Collection
}
#-Main-------------------------------------------------------------
Main
#-End----------------------------------------------------------------
'-Begin-----------------------------------------------------------------
'-Directives----------------------------------------------------------
Option Explicit
'-Variables-----------------------------------------------------------
Dim OutText
Sub Dump(collection) '------------------------------------------------
'-Variables---------------------------------------------------------
Dim i
For i = 0 To collection.Count() - 1
If IsObject(collection.ElementAt(CLng(i))) Then
Dump collection.ElementAt(CLng(i))
Else
OutText = OutText & collection.ElementAt(CLng(i)) & vbCrLf
End If
Next
End Sub
Sub Main() '----------------------------------------------------------
'-Variables---------------------------------------------------------
Dim SapGuiAuto, application, control, collection
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
Set control = application.findById("/app/con[0]/ses[0]/wnd[0]" & _
"/usr/cntlIMAGE_CONTAINER")
Set collection = control.DumpState("")
Dump collection
MsgBox OutText
End Sub
'-Main----------------------------------------------------------------
Main
'-End-------------------------------------------------------------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |