V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
vtoexsir
V2EX  ›  Python

Python 怎么操控使用 Java 写的 pc 桌面软件的窗口?

  •  
  •   vtoexsir · 2019-03-14 09:43:50 +08:00 · 2370 次点击
    这是一个创建于 1841 天前的主题,其中的信息可能已经有所发展或是发生改变。

    普通的 pc 桌面软件窗口,使用 pywinauto 到可以操控. 但是使用 java 写的桌面软件的窗口,pywinauto 不能操控. 请问 python 怎么才能操控 java 写的软件的窗口呢? 多谢!

    4 条回复    2019-03-14 20:12:23 +08:00
    wellwisher
        1
    wellwisher  
       2019-03-14 11:24:39 +08:00   ❤️ 1
    用 pyautogui 试试。跑题一下下,可以考虑用 AutoHotKey,按键精灵之类的试试。
    ysc3839
        2
    ysc3839  
       2019-03-14 12:48:51 +08:00   ❤️ 1
    Windows 的话按 Win+Ctrl+Enter 打开讲述人,然后点击 Java 界面看看能不能识别里面的元素。能的话应该可以使用 pywinauto 的 uia 模式。
    hkitdog
        3
    hkitdog  
       2019-03-14 13:00:32 +08:00 via iPhone   ❤️ 1
    Swing 寫的嗎,做過類似項目,可以用這個插件获取窗口句柄
    http://www.dmwebsite.net
    vtoexsir
        4
    vtoexsir  
    OP
       2019-03-14 20:12:23 +08:00
    @ysc3839 有效,但不能取到所有子窗口
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1203 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 23:20 · PVG 07:20 · LAX 16:20 · JFK 19:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.