jacexh / pyautoit

Python binding for AutoItX3.dll
MIT License
269 stars 74 forks source link

control_tree_view command "GetText" return Error when using pyautoit module, return None when using win32com module #23

Open michealchew opened 6 years ago

michealchew commented 6 years ago

Hi Author,

I have the issue to get the HPE Service Manager 9 x86 version control tree view text and it returns Error (pyautoit) (Python x64) or empty string (win32com) while it has no issue to get the same control tree view text in AutoIT. Besides of GetText command, "Expand" is working fine with the same command in both pyautoit and win32com. Working: autoit.control_tree_view("HPE Service Manager", "SysTreeView321","Expand",extras1="#0")

Both AutoIT and Python are using the same DLL files.

Kindly advice on this.

Thank you

Br, Yoong Loong

Python Code (pyautoit): import autoit sm9_title = "HPE Service Manager" panel_control = "SysTreeView32"

autoit.control_tree_view(sm9_title, panel_control','GetText',extras1="#0|#0")

output: Traceback (most recent call last): File "C:/Python/2018/hpe/hpe.py", line 115, in hp.open_favorite() File "C:/Python/2018/hpe/hpe.py", line 75, in open_favorite c = autoit.control_tree_view(sm9_title,panel_control,'GetText',extras1="#0|#0") File "C:\Python27\lib\site-packages\pyautoit-0.4-py2.7.egg\autoit\autoit.py", line 80, in wrapper raise AutoItError(err_msg) AutoItError: Window/Control could not be found

Python Code (win32com): import win32com.client

autoit = win32com.client.gencache.EnsureDispatch("AutoItX3.Control") autoit.WinActivate("HPE Service Manager") a = autoit.ControlTreeView("HPE Service Manager", "", "SysTreeView321", "GetText", "#0|#0", "") print repr(a)

output: u''

AutoIT Code: $hwnd = WinActivate("HPE Service Manager") $a = ControlTreeView($hwnd,'','SysTreeView321','GetText','#0') consolewrite($a & @CRLF)

output: Connection - PROD