Skip to main content

A Python wrapper for AHK

Project description

# ahk

A Python wrapper around AHK.

[![Build](https://ci.appveyor.com/api/projects/status/2c53x6gglw9nxgj1/branch/master?svg=true)](https://ci.appveyor.com/project/spyoungtech/ahk/branch/master)
[![version](https://img.shields.io/pypi/v/ahk.svg?colorB=blue)](https://pypi.org/project/ahk/)
[![pyversion](https://img.shields.io/pypi/pyversions/ahk.svg?)](https://pypi.org/project/ahk/)
[![Coverage](https://coveralls.io/repos/github/spyoungtech/ahk/badge.svg?branch=master)](https://coveralls.io/github/spyoungtech/ahk?branch=master)


# Installation

```
pip install ahk
```


# Usage

```python
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)
```

![ahk](https://raw.githubusercontent.com/spyoungtech/ahk/master/docs/_static/ahk.gif)

## non-blocking modes

You can also opt for a non-blocking interface, so you can do other stuff while AHK scripts run.

```python
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)
```


## 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

```python
from ahk import AHK
ahk = AHK(executable_path=r'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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ahk-0.2.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

ahk-0.2.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file ahk-0.2.2.tar.gz.

File metadata

  • Download URL: ahk-0.2.2.tar.gz
  • Upload date:
  • Size: 6.1 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

Hashes for ahk-0.2.2.tar.gz
Algorithm Hash digest
SHA256 57dde1a46ef9a72d42b49e3f4e461ee2a9d48d53c726b8c0ced3ba87522e407b
MD5 8ab5d63bd0f5492dfdaa1b34a8b2539e
BLAKE2b-256 73a5da50ce28f9f52a427161f25c765db43e46012924adec7a8f4e74f7b098dc

See more details on using hashes here.

File details

Details for the file ahk-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ahk-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.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

Hashes for ahk-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 67e8aff152f1ff5c7155fa9465919364821e9a20014bf09823a7e390bdb0f5ba
MD5 c7bfb0be1267d1b3c22a94d8e2c69c2b
BLAKE2b-256 fb22e6f4813aee913453866efffd4f6954e017373706ad0159169ddd1c322bd9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page