从SAP GUI中获取状态栏中的文本。

huangapple go评论53阅读模式
英文:

How to get text from status bar in SAP GUI

问题

我试图在SAP GUI中自动化一个特定的过程。但我无法编写脚本来处理这个特定的部分。

它会读取,直到我在绿色显示的字段上双击。

从SAP GUI中获取状态栏中的文本。

之后会打开以下窗口:

从SAP GUI中获取状态栏中的文本。

我如何在VBA中获取这个数字?有什么想法吗?

英文:

I'm tying to automate a certain process in SAP GUI. But I can't get the script this specific part.

It reads until I double click in this field shown in color green.

从SAP GUI中获取状态栏中的文本。

After that the following window is opened:

从SAP GUI中获取状态栏中的文本。

How do I get this number in VBA? Any ideas?

答案1

得分: 3

这段代码在Excel VBA中应该在任何地方都能运行(docNumber 是你的结果):

Dim objRegEx As Object
Dim theMatches As Object
Dim statusPanel As String
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.IgnoreCase = True
objRegEx.Global = True

objRegEx.Pattern = "[^\D]+"
statusPanel = session.FindById("wnd[0]/sbar/pane[0]").Text
Set theMatches = objRegEx.Execute(statusPanel)

For Each Match In theMatches
  docNumber = Match.Value
Next
英文:

This should work everywhere in Excel VBA(docNumber is your result):

Dim objRegEx As Object
Dim theMatches As Object
Dim statusPanel As String
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.IgnoreCase = True
objRegEx.Global = True

objRegEx.Pattern = "[^\D]+"
statusPanel = session.FindById("wnd[0]/sbar/pane[0]").Text
Set theMatches = objRegEx.Execute(statusPanel)

For Each Match In theMatches
  docNumber = Match.Value
Next

huangapple
  • 本文由 发表于 2023年2月8日 23:00:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75387641.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定