Feature Request: Web Server Toggle Action

As much as I try to help, I hate asking for things. One of my many flaws.

I'd like to ask @peternlewis for a Web Server toggle action. I do have a macro that performs the steps of opening KM, going to Preferences and toggling the Web Server Enabled checkbox but sometimes that isn't ideal. If someone knows how to accomplish this via AppleScript, that would work as well and I'd pull this request. I even bought Script Debugger, per @JMichaelTX's suggestions, to try to figure it out. I failed.

In any event, I have made the request. :slight_smile: It's definitely not urgent.

Thanks for the consideration,

KC

1 Like

I will note it down on the todo list to look at.

I can't imagine it is worth an action to do this. At most it would be an AppleScript command to turn it on and off. I'm not entirely sure I want to add an AppleScript command to turn on the web server though - it feels a bit like something that should be manual (and failing that, should require controlling the UI so it is at least apparent).

Controlling the UI to do this should be relatively straight forward - is your issue simply that that is overly intrusive?

@peternlewis - My issue is that I have a machine that requires the KM web server to be close before shutting down. Therefore, the machine will not shutdown. I have no idea why this happens sometimes but the machine will not shutdown until the KM web server is closed.

Scenario:
A few times a week, I have KM shutdown my Mac Mini which is connected to a projector. This machine will not shutdown unless the KM web server has stopped. The logs show the failure of the web server not stopping. So, I created a macro to run through the UI steps to toggle the web server off before shutting down. When it works, it works great. I have KM go through the same steps to cut the web server back on when the machine boots up. If the toggle click fails, during the shutdown macro but still manages to shut down (effectively leaving the web server on), the login procedure will then cut the web server off instead of on because the shutdown failure failed to click the checkbox the night before. An AppleScript or a toggle (or some check) would provide the proper enable/disable mechanisms. Or I can work with you to figure out why the web server doesn’t stop in the first place. I’m hoping this isn’t to confusing.

Of course, this affects the use of the iOS Maestro app which I still find plenty of value in.

Anyway, I thought I’d ask.

Thanks for the response.

KC

This is not something I have ever heard of. I do not know of any way that the web server could block the engine from shutting down.

What failure?

If you are going to launch the Keyboard Maestro editor, why not just select Quit Engine from the File menu? Which should also not be blocked by the web server.

Seems like something else is going on to me.

Nice suggestion. I'll see if adding Quit Engine, to the last step of the macro, achieves success as there are a few other measures that must take place to properly shutdown the machine (i.e. the macro must click the annoying shutdown button if someone is attached to it etc.). If the Quit Engine last step works and as you noted, I can scrap the web toggle issue completely. Either way, I'll work around the issue as it doesn't seem like it's worth the additional development effort and I really don't want to add to your list.

Thanks.

KC

Edited to add: Adding the Quit Engine menu occurs too late in the macro. I'll just deal with it as I have it.