从SAP应用程序自定义容器的文本框中获取值

问题描述 投票:1回答:1

我的要求是使用AutoIt自动化SAP流程。当我尝试从用户名文本框下面获取值(测试)时,它没有获取文本框值并显示空值。我想从文本框中获取值,并且需要与字符串进行比较。您能帮我吗?

enter image description here

输出:

enter image description here

我已经在下面提到了链接:

AutoIt finder工具的屏幕截图:

enter image description here

我的AutoIt代码:

Run("C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe")
Local $hWnd = WinWaitActive("SAP Logon 740")

WinSetState($hWnd, "", @SW_MAXIMIZE)

ControlFocus("SAP Logon 740","","SAPTreeList1")
ControlTreeView("SAP Logon 740","","[CLASS:SAPTreeList; INSTANCE:1]","Expand","#0")
ControlClick("SAP Logon 740","","[CLASS:SAPTreeList; INSTANCE:1]","left",2,47,60)
Sleep(2000)
ControlClick("SAP Logon 740","","[CLASS:SAPTreeList; INSTANCE:1]","left",2,59,115)
Sleep(2000)
ControlClick("SAP Logon 740","","[CLASS:SysListView32; INSTANCE:1]","left",1,71,573)

Sleep(1000)
ControlClick("SAP Logon 740","","Log &On")
Sleep(3000)
Local $hNewWnd = WinWaitActive("SAP")
; Retrieve the classlist of the Notepad window using the handle returned by WinWait.
    Local $sClassList = WinGetClassList("SAP")
#ConsoleWrite($sClassList)
    ; Display the classlist.
Sleep(3000)
ControlClick("SAP","","","left",1,179,56)
    # MsgBox(0, "output", $sClassList)
Send("test")
Sleep(1000)
$wrd = ControlGetText("SAP","test","")
MsgBox(0,"Display",$wrd)

控制选项卡:

enter image description here

sap autoit
1个回答
0
投票

请阅读有关thisthis的信息。

#RequireAdmin ;sometimes this is required in order to be able to manipulate windows
Opt("WinTitleMatchMode", 4) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Opt("WinSearchChildren", 1) ;0=no, 1=search children also

$wrd = ControlGetText("[TITLE:SAP]","",100);100 is id from the WindowInfo Tool
If @error Then $wrd = ControlGetText("[TITLE:SAP]","","[CLASS:Afx:68570000:1008; INSTANCE: 1]")
;This is the advanced method. Aslo shown in the WIndowInfo Tool.
MsgBox(0,"Display",$wrd)
© www.soinside.com 2019 - 2024. All rights reserved.