Python 和 AutoHotKey 脚本在编译为 exe(pyinstaller)后不起作用

时间:2021-04-05 10:54:25

标签: python pyinstaller exe autohotkey

enter image description here

我通过“ahk 0.12.0”库(pypi)在 Python 中有一个简单的 AHK 脚本。

使用pyinstaller制作后可执行,可执行 退出给我“window/get.ahk”异常。

有没有人遇到过这种情况或知道如何解决?

from ahk import AHK
import time


ahk = AHK(executable_path='C:\Program Files\AutoHotkey\AutoHotkey.exe')

win = ahk.win_get(title='AnyDesk')
win.maximize()
ahk.mouse_move(100, 440, speed=1)
ahk.double_click()
time.sleep(3)
ahk.send_input(xyz)
ahk.key_press(key='Enter')
time.sleep(3)
ahk.mouse_move(100, 10, speed=15)
ahk.double_click()

项目树

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['optiplex_log.py'],
             pathex=['C:\\Users\\Robert\\Desktop\\python\\ahk_python'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          [],
          name='optiplex_log',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=True )

0 个答案:

没有答案
相关问题