我試圖在Python 2.7中運行autohotkey(ahk)腳本,但似乎沒有任何工作。我發現的所有在線資源不是過時就是過於複雜。如何在Python中運行autohotkey腳本(2.7)
有沒有人找到一種方法來做到這一點?我只想運行幾個簡單的腳本來激活窗口並打開應用程序。例如:
IfWinExist, Command Prompt - python ...
WinActivate
更新:
我嘗試下載pyahk:
ahk.start() # Ititializes a new script thread
ahk.ready() # Waits until status is True
ahk.execute(mw._['cwd']+"winActivate_cmd.ahk") # Activate cmd window
錯誤:無法加載autohotkey.dll
,並試着這樣:
import win32com.client # Import library/module
dll = win32com.client.Dispatch("AutoHotkey.Script") #Creating DLL object?
dll.ahktextdll() #no idea what this is doing...
dll.ahkExec("WinActivate, Command Prompt - python")
p wintypes.com_error無效類字符串
我已經添加了這個作爲編輯 –