Need help turning simple things into extension buttons

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
Scabby
Posts: 8
Joined: Tue Oct 03, 2023 9:29 am

Need help turning simple things into extension buttons

Post 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.
User avatar
synthsin75
Posts: 9976
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Need help turning simple things into extension buttons

Post by synthsin75 »

If you're on Windows, you might try Greenlaw's MQC: viewtopic.php?f=9&t=32882#p189939
User avatar
Scabby
Posts: 8
Joined: Tue Oct 03, 2023 9:29 am

Re: Need help turning simple things into extension buttons

Post 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. :?
User avatar
SimplSam
Posts: 1048
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: Need help turning simple things into extension buttons

Post 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');
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
Post Reply