AutoHotKey and Moho Menu Selection Question

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

AutoHotKey and Moho Menu Selection Question

Post by Greenlaw »

Does anybody here know how to get AutoHotKey to directly select a menu item in Moho?

I can do this by sending Moho keyboard shortcuts but I wish to avoid shortcuts because it would require many custom settings. That's fine for me but I want to distribute this script to others so it's preferable if the script selected the Moho menus by name or level position. I'd rather not require users to change their shortcuts to match my personal settings.

I can get WinMenuSelectItem to work with some programs but unfortunately, Moho isn't one of them. I'm guessing Moho isn't using a menu standard that AHK recognizes. If that's the case, the docs suggest using ControlSend or PostMessage instead, but when I looked into those commands it, it sounds like they're using keyboard shortcuts. I may be mistaken though.

I'm pretty new to using AHK and I'm not sure where to proceed from here.

Thanks in advance for any help or tips.

(Admittedly, my practice project is probably better suited for LUA for Moho. I want to learn LUA too but right now I'm learning AHK and would like to get this project done with AHK if possible.)
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: AutoHotKey and Moho Menu Selection Question

Post by synthsin75 »

Sadly, Moho doesn't report any of this to the OS in a way AutoHotkey can make use of. I've tried.
ControlSend isn't much different than Send, and PostMessage relies on the program reporting the names of its controls...which Moho doesn't.

One alternative to making other users use your hard-coded shortcuts would be to have the AHK script check the custom keyboard shortcuts file.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: AutoHotKey and Moho Menu Selection Question

Post by Greenlaw »

Ah, I was afraid of that. Oh, well. I'll just supply my settings file then.

Thanks for the info, Wes. I had a feeling you'd be the one with the answer. :D

A couple more questions: in a nutshell, would this be easy to do that with LUA? This is probably a dumb question but, in LUA, are you telling Moho to select a menu or calling the command directly? Just curious.

As you might have guessed, I have very minimal experience with LUA but plan to jump in in the near future. (I have some experience with Java/Extendscript for AE, so I hope it won't be too bad to learn.)
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: AutoHotKey and Moho Menu Selection Question

Post by Greenlaw »

synthsin75 wrote:One alternative to making other users use your hard-coded shortcuts would be to have the AHK script check the custom keyboard shortcuts file.
I have questions about this but leaving work for home now. Will ask tonight or tomorrow if that's okay.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: AutoHotKey and Moho Menu Selection Question

Post by synthsin75 »

No, Lua has no access to invoking menu items, selecting tools, etc. in Moho.

But don't lose hope with AHK. It's not impossibly hard to read the user's Moho custom shortcuts file to make sure you are invoking the right menu/tool shortcut. The only hiccup I can think of is if the user didn't have any assigned shortcut for the needed item at all.

Always happy to help, Dennis.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: AutoHotKey and Moho Menu Selection Question

Post by chucky »

Forget Autohotkey, been there tried that'
Also Wacom's utility is clumsy. I've posted before about this, magnet your phone or phablet to the side of your cintiq and use dirty hand keyboard/DHk and android or Air keyboard if you have iPhone . This is easily the best shortcut, macro solution around, Custom keys, labels and colours it freakn rocks.Image
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: AutoHotKey and Moho Menu Selection Question

Post by synthsin75 »

I don't want more peripheral devices, and if Denis is looking to distribute this, he can't rely on that either, I suspect.

AHK isn't for the feint of heart...you do need to learn some actual programming to really make use of it. For those without the time or patience to learn something like AHK, I'd wholeheartedly agree with Chucky's recommendation.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: AutoHotKey and Moho Menu Selection Question

Post by chucky »

synthsin75 wrote:I don't want more peripheral devices, and if Denis is looking to distribute this, he can't rely on that either, I suspect.

AHK isn't for the feint of heart...you do need to learn some actual programming to really make use of it. For those without the time or patience to learn something like AHK, I'd wholeheartedly agree with Chucky's recommendation.
It was more the way autohotkey looked and popped up that I didn't like, although I would love it if windows had a built in solution that worked like a bit like autohotkey, I find it unusual that there aren't more of these types of apps around. Would it be that hard to program/ design / distribute?
How about it .... the Artbar?
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: AutoHotKey and Moho Menu Selection Question

Post by synthsin75 »

There's a lot of macro apps, both paid and free, but AHK has handled everything I've throw at it so far.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: AutoHotKey and Moho Menu Selection Question

Post by chucky »

synthsin75 wrote:There's a lot of macro apps, both paid and free, but AHK has handled everything I've throw at it so far.
Yeah I've seen them all, and I recheck all the time. They all seem like toys for programming enthusiasts , than utilities for users who just want to get the job done without messing around with the internal workings of it.
I did use AHK for a time , but It was too much housekeeping and not pretty enough... unless I've missed out on it's potential.
Do you have a screener that shows it off in a better light than I might have previously seen it?
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: AutoHotKey and Moho Menu Selection Question

Post by synthsin75 »

chucky wrote:Yeah I've seen them all, and I recheck all the time. They all seem like toys for programming enthusiasts , than utilities for users who just want to get the job done without messing around with the internal workings of it.
I did use AHK for a time , but It was too much housekeeping and not pretty enough... unless I've missed out on it's potential.
In this arena, it's kind of like the adage, "you can have it only two of three ways...cheap, good, or fast." The more programming skills the more you can accomplish with tools like AHK. There's just no replacement for needing to know more in order to do more.

No idea what "housekeeping" you're talking about. I have one script that I've run for years. It's in my startup folder, so it starts when my computer does. I never give it a second thought unless I decide to add some new functionality.
Do you have a screener that shows it off in a better light than I might have previously seen it?
Probably not. But I'm just way more concerned with making my computer do what I want than how it looks doing it. I'm not easily put off by poor aesthetics alone.


I think we get it. You had a bad experience using AHK. Everyone's mileage may vary.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: AutoHotKey and Moho Menu Selection Question

Post by chucky »

You had a bad experience using AHK
No, not at all, it wasn't as useful in the long run , when I updated my hardware, I just didn't bother with it again.
I thought was alright, really, just DHK is takes no screen space and is always there.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: AutoHotKey and Moho Menu Selection Question

Post by Greenlaw »

Hi guys,

Just a little background on what I'm doing and why.

I've been using the Wacom OSC button bars with Moho for about two years and it's worked very well for me, especially when working with a tablet and tablet computer. But WOSC only allows 8 buttons per panel, and when I recently started making a third panel for Moho, I decided it was time to learn AutoHotKey and roll my own. Here's what my 'MQC' looks like compared to the original WOSC panels:

Image

As you can see, the Wacom version was taking up way too much screen space, and Moho is already a bit of a screen hog to begin with. :)

When I'm using a tablet and stylus, the button bar has some advantages over using a keyboard or Moho's menus and native buttons, especially when Moho will inconveniently 'hide' certain tool buttons when you really need them--like, for example, Peak, Curve, and Reset Bone. And since I can combine commands in a single button, some buttons will perform multiple commands at once. For example, my Preview Anim button does a 'fit in window' before it runs Preview Animation so the rendered movie's framing looks more like the final output's framing. For me, this makes a lot of Moho commands more easily accessible.

(Oh, I just realized, maybe I should stick Copy Layer/Paste Layer in there so I don't have travel completely across the screen every time I need to do that. That's a real pain in the butt if you're using a mouse. But I'm still hoping the devs will just add this as a right-click command for the Layer Panel...this really needs to happen.)

Anyway, I'm almost done with it. There are just two commands that Moho is misinterpreting for some reason.* If I can't get these two to work, I'll just pull them out, no biggie. This tool was mainly created for myself but I'll share it with my co-workers and post it in this forum if anybody else is interested. It's a shame that Moho doesn't allow AHK to directly select its menus but I guess if anybody is really interested in this thing, they can drag and drop my personal shortcuts settings to the Moho User folder and try it out. Before posting this tool, I'll record a quick demo video to show why I find this useful.

Regarding using a separate device for buttons, I think that's cool but I don't really want to buy another peripheral for my tablet computer. Right now I carry a small bluetooth keyboard and mouse with me but I prefer to use only the stylus most of the time. Plus, my lap isn't big enough for multiple devices. I do have an iPad that can be used as an aux controller but then I'd be afraid of dropping something and breaking it. I'm sure an external button pad is handy for a desktop computer but probably too clunky for mobile computing.

Regarding AHK, I've only been using it for a short time and so far I'm liking it. I still have a lot to learn but I think it will be worth it since I'll be able to apply it to other programs I use. Besides, AHK is free and it lets me create 'standalone' tools that I can share with users who don't want to install or can't install AHK for whatever reason. That makes it perfect for my needs. (Well, except for that menus issue, so it's almost perfect.)

*Fixed!
Last edited by Greenlaw on Sat Sep 09, 2017 8:59 pm, edited 1 time in total.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: AutoHotKey and Moho Menu Selection Question

Post by synthsin75 »

Looks like something that many people would find useful, Dennis.

What two commands are you having trouble with?
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: AutoHotKey and Moho Menu Selection Question

Post by Greenlaw »

Thanks Wes. I know it's a really simple thing but this was a good 'get my feet wet' practice project for me.

Regarding the commands, it was a dumb user error. I mixed up ! and + in the shortcuts for those two buttons.

Wherever I can, I'm using the default shortcuts. I think there are just a few where I needed to configure my own.
Post Reply