Skip to content

is there full Hotkey and Hotstring support? #155

Answered by spyoungtech
levavft asked this question in Q&A
Discussion options

You must be logged in to vote

Almost. Technically, every functionality of AHK is supported through the .run_script API. Hotkeys are supported directly in the API (ahk.hotkey), but Hotstrings for text replacement (e.g. ::btw::by the way ) are not directly supported by the API.

Hotstrings that run scripts can work by using the hotkey API.

I'll make a note to implement hotstrings for simple text replacement in the near future.

Using the Hotkey API, you can do this:

import time
from ahk import AHK
ahk = AHK()
hotstring = ahk.hotkey('::btw', 'MsgBox you typed "btw".')
hotstring.start()
print('hotstring active! Press ctrl+c to stop')

# add a loop to stop the Python script from exiting
while True:
    try:
        time.sleep(

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by spyoungtech

This comment has been hidden.

This comment has been hidden.

This comment has been hidden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
enhancement New feature or request question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #121 on June 23, 2022 00:30.