mdbridge / bit-bucket

Mark Lillibridge's voice infrastructure in raw form
Other
8 stars 7 forks source link

vocola interfacing with Autohotkey #2

Open soticoker opened 1 year ago

soticoker commented 1 year ago

Hi Mark, have been using your bit bucket code for two years now and think it's really awesome! Many thanks! However, I use Autohotkey a lot now and can't find/understand how I can "interface vocola with Autohotkey" ? Could you point me to the right extension/bit of your code that deals with this ?

Many thanks Soti

mdbridge commented 1 year ago

Soti @.***> writes:

have been using your bit bucket code for two years now and think it's really awesome! Many thanks! However, I use Autohotkey a lot now and can't find/understand how I can "interface vocola with Autohotkey" ? Could you point me to the right extension/bit of your code that deals with this ?

Did you look at AutoHotkey.vch?  https://github.com/mdbridge/bit-bucket/blob/master/voice/my_commands/commands/AutoHotkey.vch

It uses the Subprocess extension to invoke auto hot key at a known

location on my PC. For example usage, you can look at the switching code in switch.vch:

~/voice/my_commands/commands/switch.vch:23:
#
# Switch to a given window or produce an error dialog box which fades
# after a few seconds.
#
SwitchTo(name) := SwitchTo2($name,
                        AutoHotkeyAsync3(async_message,
                        "SwitchTo", "$name: no such window found", 3)
                            Vocola.Abort());

The script being invoked here is at https://github.com/mdbridge/bit-bucket/blob/master/voice/my_commands/AutoHotkey/async_message.ahk

It is also possible to invoke in already running AutoHotkey script

by its hotkey; e.g.:

  # with volume.ahk, this should lower the volume:
invoke a AutoHotkey hotkey   = Repeat(30, Keys.SendInput({win+alt+down}));  # check

I hope this helps.

mdbridge commented 1 year ago

Soti @.***> writes:

however, I wonder if it's possible to call an AHK function from within Vocola ?

I would assume so.  You might find some ideas at https://www.autohotkey.com/boards/viewtopic.php?t=65797

You could presumably create a temporary script using a Python

extension then call that, but if you can find a Windows command line command to do it, you can probably call that directly using Subprocess.System.

I only ask because I've set up so many Vocola functions calling AHK hotkeys, it can become difficult to keep track of all of them, and when I change the hotkey combination in AHK, I have to remember to update my Vocola function code etc.

If you mostly only call AutoHotkey from Vocola, it's probably

possible to make all your AutoHotkey functions start with the same hotkey and have all the Vocola code call a single function to send that key; that way if you have to change the hotkey, you only have two places to change.

Note that Keys.SendInput can send a lot of characters that you can't

physically type so that might be a way to avoid interference with other programs.

soticoker commented 1 year ago

Hi Mark,

Thanks for the pointers!

Much appreciated

Soti

From: Mark @.> Sent: Sunday, June 4, 2023 4:57 AM To: mdbridge/bit-bucket @.> Cc: Soti @.>; Author @.> Subject: Re: [mdbridge/bit-bucket] vocola interfacing with Autohotkey (Issue #2)

Soti @. <mailto:@.> > writes:

however, I wonder if it's possible to call an AHK function from within Vocola ?

I would assume so. You might find some ideas at https://www.autohotkey.com/boards/viewtopic.php?t=65797

You could presumably create a temporary script using a Python extension then call that, but if you can find a Windows command line command to do it, you can probably call that directly using Subprocess.System.

I only ask because I've set up so many Vocola functions calling AHK hotkeys, it can become difficult to keep track of all of them, and when I change the hotkey combination in AHK, I have to remember to update my Vocola function code etc.

If you mostly only call AutoHotkey from Vocola, it's probably possible to make all your AutoHotkey functions start with the same hotkey and have all the Vocola code call a single function to send that key; that way if you have to change the hotkey, you only have two places to change.

Note that Keys.SendInput can send a lot of characters that you can't physically type so that might be a way to avoid interference with other programs.

— Reply to this email directly, view it on GitHub https://github.com/mdbridge/bit-bucket/issues/2#issuecomment-1575367394 , or unsubscribe https://github.com/notifications/unsubscribe-auth/APA73S4QYJQNXFISG4WQE33XJQBQRANCNFSM6AAAAAATJTBXG4 . You are receiving this because you authored the thread. https://github.com/notifications/beacon/APA73S6XRKXSNS2VZVCZFWLXJQBQRA5CNFSM6AAAAAATJTBXG6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS54YZOE.gif Message ID: @. @.> >