A Python wrapper for AHK
Project description
ahk
A Python wrapper around AHK.
Installation
pip install ahk
Usage
from ahk import AHK
ahk = AHK()
ahk.mouse_move(x=100, y=100, speed=10) # blocks until mouse finishes moving
print(ahk.mouse_position) # (100, 100)
non-blocking modes
You can also opt for a non-blocking interface, so you can do other stuff while AHK scripts run.
import time
from ahk import AHK
ahk = AHK()
ahk.mouse_position = (200, 200) # moves the mouse instantly to the position
start = time.time()
ahk.mouse_move(x=100, y=100, speed=30, blocking=False)
while True: # report mouse position while it moves
t = round(time.time() - start, 4)
position = ahk.mouse_position
print(t, position)
if position == (100, 100):
break
You should see an output something like
0.032 (187, 187)
0.094 (173, 173)
0.137 (164, 164)
...
0.788 (100, 103)
0.831 (100, 101)
0.873 (100, 100)
Non-Python Dependencies
Just the AHK executable. It's expected to be on PATH by default.
Alternatively you can set an AHK_PATH
environment variable.
Or, provide it inline
from ahk import AHK
ahk = AHK(executable_path='C:\\ProgramFiles\\AutoHotkey\\AutoHotkey.exe')
Development
Right now this is just an exploration of an idea. It may not even be a particularly good idea.
There's still a bit to be done in the way of implementation.
The vision is to provide additional interfaces that implement the most important parts of the AHK API in a Pythonic way.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ahk-0.3.0.tar.gz
.
File metadata
- Download URL: ahk-0.3.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a641ab72a3f3424c35171e3b384a15c517c29214dbe15d38b3745ca505162f62 |
|
MD5 | 5432b8bab84aa097d86992a89922b890 |
|
BLAKE2b-256 | 36805b08a1f74388e247e5b488267efd6238269a4a3b567462d5879173ba8a93 |
File details
Details for the file ahk-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: ahk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8eb974f81db95662cd17625f61f5cf2541d03c9a8b297867c9c9dff51052278e |
|
MD5 | de3f415836ede6f04eedfe14bbef327c |
|
BLAKE2b-256 | 57daabc92b8acd5d70f76f3756e993d5fa1e56f6b45ee6ed5e92450080a7bbfe |