wnd[0]/usr/subSSA1:SAPLBRF_MAINTENANCE:3006/txtSBRF170-VERSION
wnd\[0\]\/usr\/subSSA1:.*txtSBRF170-VERSION
'-Begin-----------------------------------------------------------------
'-Function FindByIdPart-------------------------------------------------
'-
'- Function to find an UI element by its Id via Regular Expressions,
'- independently from program names and screen numbers
'- oApp = SAP application
'- oArea = Container to be searched
'- regexId = Regular Expression of Id of UI element which is searched
'-
'-----------------------------------------------------------------------
Function FindByIdPart(oApp, oArea, regexId)
Set oRegEx = New RegExp
oRegEx.Pattern = regexId
oRegEx.IgnoreCase = True
oRegEx.Global = False
On Error Resume Next
If oArea.Children.Count() > 0 Then
For i = 0 To oArea.Children.Count() - 1
Set Child = oArea.Children.Item(CLng(i))
If oRegEx.Test(Child.Id) Then
FindByIdPart = Child.Id
On Error GoTo 0
Exit Function
End If
If Child.ContainerType() And Child.Children().Count() > 0 Then
FindByIdPart = _
FindByIdPart(oApp, oApp.findByID(Child.Id), regexId)
If FindByIdPart <> "" Then
On Error GoTo 0
Exit Function
End If
End If
Next
End If
On Error Goto 0
FindByIDPart = ""
End Function
'-Sub Main--------------------------------------------------------------
Sub Main()
Set SapGuiAuto = GetObject("SAPGUI")
If Not IsObject(SapGuiAuto) Then
Exit Sub
End If
Set app = SapGuiAuto.GetScriptingEngine
If Not IsObject(app) Then
Exit Sub
End If
app.HistoryEnabled = False
Set connection = app.Children(0)
If Not IsObject(connection) Then
Exit Sub
End If
If connection.DisabledByServer = True Then
Exit Sub
End If
Set session = connection.Children(1)
If Not IsObject(session) Then
Exit Sub
End If
If session.Info.IsLowSpeedConnection = True Then
Exit Sub
End If
'Search for
'wnd[0]/usr/subSSA1:SAPLBRF_MAINTENANCE:3006/txtSBRF170-VERSION
Id = FindByIDPart(app, session.findById("wnd[0]/usr"), _
"wnd\[0\]\/usr\/subSSA1:.*txtSBRF170-VERSION")
MsgBox Id
app.HistoryEnabled = True
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 |
---|---|
53 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |