MS WindowTitleMAtch
This commit is contained in:
parent
6d9f41ea09
commit
be1f74ceb0
@ -74,10 +74,13 @@ Public Class clsHotkey
|
|||||||
End Class
|
End Class
|
||||||
Public Shared Sub Refresh_Profile_Links()
|
Public Shared Sub Refresh_Profile_Links()
|
||||||
Try
|
Try
|
||||||
Dim sql = String.Format("SELECT * FROM VWCW_USER_PROFILE WHERE USER_ID = {0}", USER_ID)
|
Dim oSql = String.Format("SELECT * FROM VWCW_USER_PROFILE WHERE USER_ID = {0}", USER_ID)
|
||||||
DT_USER_PROFILES = clsDatabase.Return_Datatable(sql)
|
DT_USER_PROFILES = clsDatabase.Return_Datatable(oSql)
|
||||||
If DT_USER_PROFILES.Rows.Count = 0 Then
|
If DT_USER_PROFILES.Rows.Count = 0 Then
|
||||||
MsgBox("No profiles configured for this user so far!", MsgBoxStyle.Exclamation)
|
MsgBox("No profiles configured for this user so far!", MsgBoxStyle.Exclamation)
|
||||||
|
Else
|
||||||
|
oSql = $"SELECT * FROM VWCW_PROFILE_REL_WINDOW WHERE USER_ID = {USER_ID}"
|
||||||
|
DTPROFILE_REL_WINDOW = clsDatabase.Return_Datatable(oSql)
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MsgBox("Unexpected Error in Refresh_Profile_Links: " & ex.Message, MsgBoxStyle.Critical)
|
MsgBox("Unexpected Error in Refresh_Profile_Links: " & ex.Message, MsgBoxStyle.Critical)
|
||||||
|
|||||||
@ -504,8 +504,14 @@ Public Class frmResultDoc
|
|||||||
frmProfileMatch.BringToFront()
|
frmProfileMatch.BringToFront()
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_frmProfileMatch.Show()
|
If Not IsNothing(CurrDT_PROFILE_MATCH) Then
|
||||||
_frmProfileMatch.BringToFront()
|
If CurrDT_PROFILE_MATCH.Rows.Count > 1 Then
|
||||||
|
_frmProfileMatch.Show()
|
||||||
|
_frmProfileMatch.BringToFront()
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ Public Class frmStart
|
|||||||
' .AppendText(String.Concat(vbNewLine, vbNewLine, "Text = '", _
|
' .AppendText(String.Concat(vbNewLine, vbNewLine, "Text = '", _
|
||||||
' Clipboard.GetText, "'", vbNewLine, vbNewLine))
|
' Clipboard.GetText, "'", vbNewLine, vbNewLine))
|
||||||
'End With
|
'End With
|
||||||
Dim found As Boolean = False
|
Dim oFound As Boolean = False
|
||||||
CLIPBOARD_TEXT = Clipboard.GetText
|
CLIPBOARD_TEXT = Clipboard.GetText
|
||||||
Logger.Debug(String.Format(" >>[{0}] Clipboard-Watcher fired for process '{1}'", Now.ToString, CurrPROC_Name), False)
|
Logger.Debug(String.Format(" >>[{0}] Clipboard-Watcher fired for process '{1}'", Now.ToString, CurrPROC_Name), False)
|
||||||
Dim oDTMatchProfiles As DataTable = New DataTable
|
Dim oDTMatchProfiles As DataTable = New DataTable
|
||||||
@ -48,21 +48,43 @@ Public Class frmStart
|
|||||||
oDTMatchProfiles.Columns.Add("COMMENT")
|
oDTMatchProfiles.Columns.Add("COMMENT")
|
||||||
|
|
||||||
For Each oProfileRow As DataRow In DT_USER_PROFILES.Rows
|
For Each oProfileRow As DataRow In DT_USER_PROFILES.Rows
|
||||||
|
Dim oProfileID = oProfileRow.Item("GUID")
|
||||||
'If found = True Then Exit For
|
'If found = True Then Exit For
|
||||||
|
'#### 1st CHECK: PROCESSNAME EQUAL ####
|
||||||
If CurrPROC_Name.ToUpper = oProfileRow.Item("PROC_NAME").ToString.ToUpper Then
|
If CurrPROC_Name.ToUpper = oProfileRow.Item("PROC_NAME").ToString.ToUpper Then
|
||||||
Dim regex_expression = oProfileRow.Item("REGEX_EXPRESSION")
|
'### 2nd CHECK: MATCH ClipboardValue
|
||||||
Dim regex As New System.Text.RegularExpressions.Regex(regex_expression)
|
Dim oRegex_expression = oProfileRow.Item("REGEX_EXPRESSION")
|
||||||
Dim match As System.Text.RegularExpressions.Match = regex.Match(CLIPBOARD_TEXT)
|
Dim oRegex As New System.Text.RegularExpressions.Regex(oRegex_expression)
|
||||||
If match.Success Then
|
Dim oMatch As System.Text.RegularExpressions.Match = oRegex.Match(CLIPBOARD_TEXT)
|
||||||
|
If oMatch.Success Then
|
||||||
' If match.Groups(0).Value <> CURR_MATCH_RESULT Then
|
' If match.Groups(0).Value <> CURR_MATCH_RESULT Then
|
||||||
CURR_MATCH_RESULT = match.Groups(0).Value
|
CURR_MATCH_RESULT = oMatch.Groups(0).Value
|
||||||
If Not IsNothing(CURR_MATCH_RESULT) Then
|
If Not IsNothing(CURR_MATCH_RESULT) Then
|
||||||
|
'#### 3rd CHECK: WindowTitle Match
|
||||||
|
Dim oMatchWindow As Boolean = True
|
||||||
|
Dim oCountWindowDefinitions As Integer = 0
|
||||||
|
For Each oWindowMatchRow As DataRow In DTPROFILE_REL_WINDOW.Rows
|
||||||
|
If oWindowMatchRow.Item("PROFILE_ID") = oProfileID Then
|
||||||
|
oCountWindowDefinitions += 1
|
||||||
|
oRegex_expression = oWindowMatchRow.Item("REGEX")
|
||||||
|
oRegex = New System.Text.RegularExpressions.Regex(oRegex_expression)
|
||||||
|
oMatch = oRegex.Match(CURR_FOCUSED_WINDOWNAME)
|
||||||
|
oMatchWindow = oMatch.Success
|
||||||
|
If oMatchWindow = True Then
|
||||||
|
Logger.Debug($"Found a match on windowtitle [{CURR_FOCUSED_WINDOWNAME}]")
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If oMatchWindow = False Then
|
||||||
|
Logger.Debug($"Found NO MATCH on windowtitle [{CURR_FOCUSED_WINDOWNAME}], but [{oCountWindowDefinitions}] definitions are configured")
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
'CURR_MATCH_WM_SEARCH = oProfileRow.Item("WD_SEARCH")
|
'CURR_MATCH_WM_SEARCH = oProfileRow.Item("WD_SEARCH")
|
||||||
Dim oSQL_COUNT As String = oProfileRow.Item("SQL_COUNT_RESULT")
|
Dim oSQL_COUNT As String = oProfileRow.Item("SQL_COUNT_RESULT")
|
||||||
Dim oRESULTDocs As Integer
|
Dim oRESULTDocs As Integer
|
||||||
If oSQL_COUNT <> String.Empty Then
|
If oSQL_COUNT <> String.Empty Then
|
||||||
oSQL_COUNT = clsPatterns.ReplaceAllValues(oSQL_COUNT, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfileRow.Item("GUID"))
|
oSQL_COUNT = clsPatterns.ReplaceAllValues(oSQL_COUNT, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfileID)
|
||||||
Try
|
Try
|
||||||
oRESULTDocs = ClassDatabase.Execute_Scalar(oSQL_COUNT, MyConnectionString)
|
oRESULTDocs = ClassDatabase.Execute_Scalar(oSQL_COUNT, MyConnectionString)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@ -71,13 +93,16 @@ Public Class frmStart
|
|||||||
Else
|
Else
|
||||||
oRESULTDocs = 99998
|
oRESULTDocs = 99998
|
||||||
End If
|
End If
|
||||||
Dim onewMatchRow As DataRow = oDTMatchProfiles.NewRow
|
If (oRESULTDocs <> 99998 And oRESULTDocs <> 99998 And oRESULTDocs <> 0) Then
|
||||||
onewMatchRow("GUID") = oProfileRow.Item("GUID")
|
Dim onewMatchRow As DataRow = oDTMatchProfiles.NewRow
|
||||||
onewMatchRow("NAME") = oProfileRow.Item("NAME")
|
onewMatchRow("GUID") = oProfileID
|
||||||
onewMatchRow("COMMENT") = oProfileRow.Item("COMMENT")
|
onewMatchRow("NAME") = oProfileRow.Item("NAME")
|
||||||
onewMatchRow("COUNT") = oRESULTDocs
|
onewMatchRow("COMMENT") = oProfileRow.Item("COMMENT")
|
||||||
oDTMatchProfiles.Rows.Add(onewMatchRow)
|
onewMatchRow("COUNT") = oRESULTDocs
|
||||||
found = True
|
oDTMatchProfiles.Rows.Add(onewMatchRow)
|
||||||
|
oFound = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
'Else
|
'Else
|
||||||
@ -86,12 +111,12 @@ Public Class frmStart
|
|||||||
' Exit For
|
' Exit For
|
||||||
'End If
|
'End If
|
||||||
Else
|
Else
|
||||||
Logger.Debug(String.Format(" >> {0} - No regex-match for cliboardtext '{1}'", Now.ToString, match.Groups(0).Value), False)
|
'Logger.Debug(String.Format(" >> {0} - No regex-match for cliboardtext '{1}'", Now.ToString, oMatch.Groups(0).Value), False)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
If found = False Then
|
If oFound = False Then
|
||||||
Logger.Debug(String.Format(" >> {0} - Process '{1}' not configured!", Now.ToString, CurrPROC_Name), False)
|
Logger.Debug(String.Format(" >> {0} - oFound is false - no match on Clipboardvalue '{1}'!", Now.ToString, CURR_MATCH_RESULT), False)
|
||||||
CurrDT_PROFILE_MATCH = Nothing
|
CurrDT_PROFILE_MATCH = Nothing
|
||||||
Else
|
Else
|
||||||
CurrDT_PROFILE_MATCH = oDTMatchProfiles
|
CurrDT_PROFILE_MATCH = oDTMatchProfiles
|
||||||
@ -198,7 +223,7 @@ Public Class frmStart
|
|||||||
End Sub
|
End Sub
|
||||||
Private Sub ReceiveHotKey(ByVal HotKeyID As String) Handles Hotkey.HotKeyPressed
|
Private Sub ReceiveHotKey(ByVal HotKeyID As String) Handles Hotkey.HotKeyPressed
|
||||||
If HotKeyID = 354523017 Then
|
If HotKeyID = 354523017 Then
|
||||||
If Not IsNothing(CURR_MATCH_RESULT) Then
|
If Not IsNothing(CURR_MATCH_RESULT) And Not IsNothing(CurrDT_PROFILE_MATCH) Then
|
||||||
CHECK_PROFILE_MATCH()
|
CHECK_PROFILE_MATCH()
|
||||||
End If
|
End If
|
||||||
'If Not IsNothing(CURR_MATCH_RESULT) And Not IsNothing(CURR_MATCH_WM_SEARCH) Then
|
'If Not IsNothing(CURR_MATCH_RESULT) And Not IsNothing(CURR_MATCH_WM_SEARCH) Then
|
||||||
|
|||||||
@ -58,6 +58,8 @@ Module modCurrent
|
|||||||
|
|
||||||
Public CLIENT_SELECTED As Integer = 0
|
Public CLIENT_SELECTED As Integer = 0
|
||||||
Public CurrDT_PROFILE_MATCH As DataTable
|
Public CurrDT_PROFILE_MATCH As DataTable
|
||||||
|
Public DTPROFILE_REL_WINDOW As DataTable
|
||||||
|
|
||||||
Public CURRENT_DT_DOC_SEARCHES As DataTable
|
Public CURRENT_DT_DOC_SEARCHES As DataTable
|
||||||
Public CURRENT_DT_DATA_SEARCHES As DataTable
|
Public CURRENT_DT_DATA_SEARCHES As DataTable
|
||||||
Public CurrDocSearch2Load As Object
|
Public CurrDocSearch2Load As Object
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user