【问题标题】:VBA detecting text color IBM PCOMMVBA检测文本颜色IBM PCOMM
【发布时间】:2017-08-16 22:28:23
【问题描述】:

最近,我的 IBM PCOMM 在我的工作中已升级到版本 12.0.0.1。从那以后,如果我试图检测空白空间,并且之前已经存在某些内容,那么当我使用 autECLPS.GetText 时,即使我看到的只是黑色,该文本也会出现。我需要一种方法来查看是否有隐藏文本,以便我知道我可以进行下一个程序。我一直在使用autECLPS.GetTextRect 来查看是否可以匹配整个文本块,但这变得乏味。有什么建议吗?

更新

这是我目前所拥有的:

ElseIf LineCount < 3 Then
    ' If we've gone through less than three lines, we need
    ' to determine if the next line is visible.
    ' ***************************************************************
    ' Due to IBM PCOMM changing their process from actually clearing
    ' screens when going from one to the next to changing the
    ' color of the previous data, there may be some ghost data
    ' present. This code checks to see if any previous data is
    ' hidden from view and determines whether or not to continue.
    ' ***************************************************************
    If SMonth = EMonth Or SMonth <> EMonth And j > 1 And k > 1 Then
        If ScreenName = "MHI" And EditWarnMsg = "E065NO MORE CLMS ON FILE," Then
            Result = objUNET.autECLPS.GetTextRect(SvcLn1, 1, SvcLn3, 80)
            If Left(Result, 2) = POS(j) And Trim(Mid(Result, 4, 6)) = Serv(j) And Trim(Mid(Result, 36, 2)) = RC(j) Then
                Exit Do
             ElseIf Left(Result, 2) = POS(j - 1) And Trim(Mid(Result, 4, 6)) = Serv(j - 1) And Trim(Mid(Result, 36, 2)) = RC(j - 1) Then
                 Exit Do
             ElseIf Left(Result, 2) = POS(j - 2) And Trim(Mid(Result, 4, 6)) = Serv(j - 2) And Trim(Mid(Result, 36, 2)) = RC(j - 2) Then
                  Exit Do
              ElseIf Left(Result, 2) = POS(j - 3) And Trim(Mid(Result, 4, 6)) = Serv(j - 3) And Trim(Mid(Result, 36, 2)) = RC(j - 3) Then
                  Exit Do
              ' If the initial If criteria renders ICN to not have been
              ' found, this will cause a range error. We want to resume
              ' on to the next process if such error occurs.
              On Error Resume Next
              ElseIf Trim(Mid(Result, 165, 10)) = ICN(k) And Trim(Mid(Result, 28, 10)) = Draft(k) Then
                  Exit Do
              ElseIf Trim(Mid(Result, 165, 10)) = ICN(k - 1) And Trim(Mid(Result, 28, 10)) = Draft(k - 1) Then
                  Exit Do
              On Error GoTo 0
              Else
                  GoTo POSBlank
              End If
          End If
      End If
  End If
End If

【问题讨论】:

  • 将您的GetTextRect 调用包装到一个实用函数中,调用该函数而不是每次都执行整个操作?如果您 edit 添加您正在使用的代码,人们可以提供帮助。现在我不确定你会得到很多答案,我怀疑 IBM PCOMM 开发人员正在蜂拥使用 Stack Overflow 的 VBA 标签......
  • 很抱歉。我添加了用于搜索的代码。所有这些都是在逐页搜索时创建的数组元素。我将返回此部分以查看在 GetTextRect 中复制的内容是否是我不想再次复制的先前信息。
  • 更改文本颜色以使其不可见听起来可能会构成数据安全威胁。提请您的雇主注意。也许你的雇主会改变一些东西,这样数据就不会留在屏幕上。
  • 安全威胁不大。 PCOMM 访问​​一个非常安全的数据库结构。数据只是被屏蔽而不是被删除......这使得检测空白空间变得困难。

标签: vba ibm-pcomm


【解决方案1】:

在收到有关 SO 的人才的建议并进行更多研究后,我已将代码更改为可行的解决方案。和原版差别不大,但更靠谱。

If SMonth = EMonth Or SMonth <> EMonth And j > 1 And k > 1 Then
    If ScreenName = "MHI" And EditWarnMsg = "E065NO MORE CLMS ON FILE," Then
        ' Attempt to refresh the connection list
        ' to get current data on the screen.
        objConnMgr.autECLConnList.Refresh
        Result = objUNET.auteclps.GetTextRect(SvcLn1, 1, SvcLn3, 80)
        ' See if we've already processed this place of service
        If Left(Result, 2) = POS(j - 1) Or Left(Result, 2) = POS(j - 2) Or Left(Result, 2) = POS(j - 3) Then
            ' See if we've already processed this service code matching the POS
            If Trim(Mid(Result, 4, 6)) = Serv(j - 1) Or Trim(Mid(Result, 4, 6)) = Serv(j - 2) Or Trim(Mid(Result, 4, 6)) = Serv(j - 3) Then
                ' See if we've already processed this remark code matching the POS and service code
                If Trim(Mid(Result, 36, 2)) = RC(j - 1) Or Trim(Mid(Result, 36, 2)) = RC(j - 2) Or Trim(Mid(Result, 36, 2)) = RC(j - 3) Then
                    ' If start month equals end month, stop the process
                    If SMonth = EMonth Then
                        Exit Do
                    Else
                        GoTo POSBlank  ' Continue process by going to label
                    End If
                End If
            End If
            ' See if we've already processed this ICN
            If Trim(Mid(Result, 165, 10)) = ICN(k - 1) Or Trim(Mid(Result, 165, 10)) = ICN(k - 2) Then
                ' See if we've already processed this draft number matching the ICN
                If Trim(Mid(Result, 28, 10)) = Draft(k - 1) Or Trim(Mid(Result, 28, 10)) = Draft(k - 2) Then
                    If SMonth = EMonth Then
                        Exit Do
                    Else
                        GoTo POSBlank
                    End If
                End If
            End If
        End If
    End If
End If

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-31
    • 2011-11-22
    • 2014-05-13
    • 1970-01-01
    • 2018-11-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多