Page 1 of 1

Need help turning simple things into extension buttons

Posted: Wed Oct 04, 2023 3:03 am
by Scabby
I do most of my work with a pen on a touchscreen, this is the most comfortable way for me to work due to problems with my hands.

The UI for Moho isn't built for this, though. I've added extensions for a lot of things that really need to be in there, like undo/redo and deselect all, which save me a ton of time. But I could save so much more time if I had buttons for other things like delete. It seems like such a simple thing to implement, something even someone bad at scripting like me should be able to figure out, but I've had no luck.

Is it possible to make a script that simply inputs a key (or key combination) when tapped? If I could do that for at least the delete key it would save a lot of time, and if I could make a new one for any key or key combo then I could do most of my work without having to bring out the keyboard.

Re: Need help turning simple things into extension buttons

Posted: Wed Oct 04, 2023 3:37 am
by synthsin75
If you're on Windows, you might try Greenlaw's MQC: viewtopic.php?f=9&t=32882#p189939

Re: Need help turning simple things into extension buttons

Posted: Wed Oct 04, 2023 5:25 am
by Scabby
Ah yes, that does help LOT, thanks! :D

For future reference though, is there a way to script an extension that's just a key press or combination? I'm sure it'll come up again at some point. I've searched around a lot, but I guess it's something so simple that nobody's wanted to do it or needed any help to figure it out. :?

Re: Need help turning simple things into extension buttons

Posted: Wed Oct 04, 2023 1:01 pm
by SimplSam
Scabby wrote: Wed Oct 04, 2023 5:25 am ... For future reference though, is there a way to script an extension that's just a key press or combination? ...
So far - my only solution to send keys from a Moho tool button back into Moho is to invoke an external Python script that sets focus back to Moho and then issues the desired key sequence.

Similar to below - which reloads Moho scripts:

Lua:

Code: Select all

cmd = 'python "' .. moho:UserAppDir() .. '/scripts/utils/ss_moho_reload.py"'
os.execute(cmd)
ss_moho_reload.py:

Code: Select all

import pyautogui
import pygetwindow as gw
wnd = gw.getWindowsWithTitle('.moho - Moho')[0]
wnd.restore()
wnd.activate()
pyautogui.hotkey('ctrl', 'alt', 'shift', 'l');