分享

Running AHK with python

 dinghj 2019-04-13
       Hi all, i've looked around bit i can't seem to get any code i've found elsewhere working

I'm trying to execute an ahk script via python.

I've downloaded the <!-- m -->https://toh.../AutoHotkey.zip<!-- m --> but i'm not sure whether or not to use the files from the "Win32w" or "Win32a" folders. Similarly, can i just put all those files in the same folder as my scripts?

I'm using python 2.7

so i guess i'm asking, how do i run a .ahk file in the same folder as my python file, via python.

pythoncode.py:
import ctypes,time
import os, sys

ahk = ctypes.cdll.AutoHotkey
ahk.ahktextdll("") #start script in persistent mode (wait for action)
ahk.ahkdll("ahkTestScript.ahk","","")

ahkTestScript.ahk:
Run Notepad

edit: when i run via IDLE, i get the following error:
"WindowsError: exception: access violation reading 0x00000004"
at the line: ahk.ahktextdll("")

Any help would be appreciated.            

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多