Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ahk-json

This is an extension package intended to be used with the Python ahk package.

It provides interfaces from cocobelgica/AutoHotkey-JSON for working with JSON in AutoHotkey. The extensions in this package do not provide any additional methods, but simply provide a convenient way to include Jxon.ahk and/or JSON.ahk into other extensions.

This package provides two extensions: JXON and JSON. It also registers a JSON message type (ahk_json.message.JsonResponseMessage)

Installation

Install this extension using pip

pip install ahk-json

Usage

Typically, you use this as a dependency when building your own extensions.

In the following example, a simple extension (my_extension) is created. It implements an AHK function MyTestFunction -- the registered to the extension using the Python function my_test_function.

from ahk.extensions import Extension
from ahk import AHK

from ahk_json import JXON  # importing is necessary for ``extensions='auto'`` to work, even if this is not used

ext_script = '''\
MyTestFunction(ByRef command) {
    arg := command[2]
    obj := Object("test", arg)
    res := Jxon_Dump(obj) ; this is available thanks to the extension
    return FormatResponse("ahk_json.message.JsonResponseMessage", res)
}
'''

my_extension = Extension(script_text=ext_script)

@my_extension.register
def my_test_function(ahk: AHK, arg: str):
    return ahk.function_call('MyTestFunction', [arg])


def main():
    ahk = AHK(extensions='auto')  # automatically use all imported/created extensions
    # or use the extensions explicitly:
    # ahk = AHK(extensions=[JXON, my_extension])

    # now ``.my_test_function`` is a method on the `ahk` instance:
    assert ahk.my_test_function('foo') == {'test': 'foo'}

License

This work is licensed under the MIT license.

This package includes substantial portions of the original AutoHotkey-JSON. The code included from AutoHotkey-JSON is owned and copyrighted by its original author(s) and is used/redistributed under the terms of the WTFPL.

Download files

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

Source Distribution

ahk-json-0.1.0rc2.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ahk_json-0.1.0rc2-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file ahk-json-0.1.0rc2.tar.gz.

File metadata

  • Download URL: ahk-json-0.1.0rc2.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for ahk-json-0.1.0rc2.tar.gz
Algorithm Hash digest
SHA256 97748224e75d4daecef9b6fa661f82d1fe1b0bdaf1e53efde2c41f2f8aa46469
MD5 32bc81284257b14f81960b892ded8aed
BLAKE2b-256 eb1d6729ab0c4fbdb23f61f30e2cc0330bc36625be0264a10d094f1eea0fef66

See more details on using hashes here.

File details

Details for the file ahk_json-0.1.0rc2-py3-none-any.whl.

File metadata

  • Download URL: ahk_json-0.1.0rc2-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for ahk_json-0.1.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 64fcf02a98623df3322ed617bb78652d5aa427cff1180674ab7c792a7e688ff9
MD5 900ca1ebd3f9f1881dda5394b5688cfc
BLAKE2b-256 0882c636789d1e970d1ab682968e4f108901fd11014959b076e8c81460e66838

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0rc2 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page