Hello Faymlor,
the activity Get Attribute delivers a lot of information about an SAP GuiTableControl, but not all. You can use a work around to handle your requirement, an additional VBScript. The script detects the session via SystemSessionID and SessionNumber. Both information delivers the Get Attribute activity. It loops over all connections and sessions to find the correct one. When it has found the right session it calls the Sub Action. In this sub routine you can use the attributes which are not supported by the Get Attribute activity, in your case VisibleRowCount.
'-Begin-----------------------------------------------------------------
'-Directives------------------------------------------------------------
Option Explicit
'-Sub Action------------------------------------------------------------
Sub Action(session)
Dim Id, oElement
Id = "wnd[0]/" + WScript.Arguments.Item(2)
Set oElement = session.findById(Id)
WScript.Echo CStr(oElement.VisibleRowCount)
End Sub
'-Sub GetSession--------------------------------------------------------
Sub GetSession(SessionID, SessionNumber)
Dim SapAppl, SapGuiAuto, CollCon, i, oCon, CollSes, j, oSes
Dim oSesInf, SessID, SessNumber
Set SapGuiAuto = GetObject("SAPGUI")
If Not IsObject(SapGuiAuto) Then
WScript.Echo "Error: GetObject"
Exit Sub
End If
Set SapAppl = SapGuiAuto.GetScriptingEngine
If Not IsObject(SapAppl) Then
WScript.Echo "Error: GetScriptingEngine"
Exit Sub
End If
Set CollCon = SapAppl.Connections()
If Not IsObject(CollCon) Then
WScript.Echo "Error: No Connections"
Exit Sub
End If
'-Loop over connections-----------------------------------------------
For i = 0 To CollCon.Count() - 1
Set oCon = SapAppl.Children(CLng(i))
If Not IsObject(oCon) Then
WScript.Echo "Error at Connection"
Exit Sub
End If
Set CollSes = oCon.Sessions()
If Not IsObject(CollSes) Then
WScript.Echo "Error: No Sessions"
Exit Sub
End If
'-Loop over sessions------------------------------------------------
For j = 0 To CollSes.Count() - 1
Set oSes = oCon.Children(CLng(j))
If Not IsObject(oSes) Then
WScript.Echo "Error at Session"
Exit Sub
End If
If oSes.Busy() = vbFalse Then
Set oSesInf = oSes.Info()
If IsObject(oSesInf) Then
SessID = oSesInf.SystemSessionID()
SessNumber = CStr(oSesInf.SessionNumber() - 1)
If SessID = SessionID And SessNumber = SessionNumber Then
Action oSes
End If
End If
End If
Next
Next
End Sub
'-Sub Main--------------------------------------------------------------
Sub Main()
GetSession WScript.Arguments.Item(0), WScript.Arguments.Item(1)
End Sub
'-Main------------------------------------------------------------------
Main
'-End-------------------------------------------------------------------
In the UiPath workflow I detect at first the attributes SystemSessionId, SessionNumber and the ID of the UI element, in my case a table control.
Then I call the script with the parameters.
In my example I use a simple table.
Here the result.
With this tiny work around you can combine UiPath possibilities with the full SAP GUI Scripting possibilities.
Best regards
Stefan