3 Commits

Author SHA1 Message Date
Jonathan Jenne
87288c3488 add process name to ProfileData 2019-10-25 13:28:07 +02:00
Jonathan Jenne
7c63f0d111 rename FilterProfilesByFocusedControlLocation 2019-10-25 13:27:54 +02:00
Jonathan Jenne
c80c5aea78 check if current control belongs to current process 2019-10-25 13:27:34 +02:00
3 changed files with 16 additions and 2 deletions

View File

@@ -205,7 +205,7 @@ Public Class ProfileFilter
Return oProfiles
End Function
Public Function FilterProfilesByFocusedControlLocation(Profiles As List(Of ProfileData), ClipboardContents As String, WindowHandle As IntPtr) As List(Of ProfileData)
Public Function FilterProfilesByFocusedControl(Profiles As List(Of ProfileData), ClipboardContents As String, WindowHandle As IntPtr) As List(Of ProfileData)
Dim oFilteredProfiles As New List(Of ProfileData)
Dim oWindow As New Window(_LogConfig)
@@ -221,6 +221,18 @@ Public Class ProfileFilter
For Each oControl In oProfile.Controls
Dim oFound As Boolean = False
' If current control does not belong to the current process, skip it
Try
Dim oFocusedWindow As Window.WindowInfo = oWindow.GetWindowInfo()
If oFocusedWindow.ProcessName <> oControl.ProcessName Then
Continue For
End If
Catch ex As Exception
_Logger.Error(ex)
End Try
' If control name is empty, use coordinates
If oControl.ControlName Is Nothing OrElse oControl.ControlName = String.Empty Then
Dim oControlBounds As Dictionary(Of String, Window.RectangleInfo)
@@ -471,6 +483,7 @@ Public Class ProfileFilter
If oRow.Item("PROFILE_ID") = ProfileId Then
oControlList.Add(New ControlData() With {
.Guid = oRow.Item("GUID"),
.ProcessName = NotNull(oRow.Item("PROCESS_NAME"), String.Empty),
.ControlName = NotNull(oRow.Item("CONTROL_NAME"), String.Empty),
.Description = NotNull(oRow.Item("DESCRIPTION"), String.Empty),
.WindowId = oRow.Item("WINDOW_ID"),

View File

@@ -113,7 +113,7 @@ Partial Public Class frmAdmin
oMatchingProfiles = oProfileFilter.FilterProfilesByClipboardRegex(oMatchingProfiles, oClipboardContents)
oMatchingProfiles = oProfileFilter.FilterProfilesByProcess(oMatchingProfiles, oWindowInfo.ProcessName)
oMatchingProfiles = oProfileFilter.FilterWindowsByWindowTitleRegex(oMatchingProfiles, oWindowInfo.WindowTitle)
oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControlLocation(oMatchingProfiles, oClipboardContents, Handle)
oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControl(oMatchingProfiles, oClipboardContents, Handle)
oMatchingProfiles = Await Task.Run(Function()
Return oProfileFilter.FilterProfilesBySearchResults(
oMatchingProfiles,

View File

@@ -57,6 +57,7 @@
Public Regex As String
Public AutomationId As String
Public ControlName As String
Public ProcessName As String
Public IsMatched As Boolean = False
Public TopLeft As ControlBounds
Public TopRight As ControlBounds