Suggestions for a stubborn menu command?

My default browser is Safari, but sometimes I need to open the current page in Firefox instead. With Safari's Developer menu revealed, there's a built-in command:

Develop > Open Page With > Firefox

In KM, I've assigned a hotkey trigger for that command via a "Select a Menu" action.

The problem:

If Firefox is already running, the task is completes successfully. But if Firefox is NOT running, Firefox launches—but the URL from Safari doesn't load. This is tricky to troubleshoot, because there's only one step: A menu command.

Any suggestions?

Have you tried Open a URL action with a value of %SafariURL% and open in FireFox?

Thanks. No, I hadn't tried that, as I was unfamiliar with that action. I appreciate the suggestion (and will put that action to use later), but in this case, unfortunately, it behaves exactly like Select or Show a Menu Item action and loads the URL only if Firefox is already running. Otherwise, it launches Firefox, but never loads the URL.

It's as if the URL-loading sequence "times out" before Firefox launches. Put differently, the action isn't "waiting" for Firefox to launch.

Is this perhaps a KM bug?

FireFox is probably ignoring the launch AppleEvent. So it is basically a bug in FireFox. Why not just actively launch FireFox first:

AppleScript:

tell app "FireFox" to launch

Or even just an Activate a Specific Application action, and activate FireFox. Make it conditional on FireFox not being running, so basically:

  • If application FireFox is not running
    • Activate a Specific Application “FireFox”
  • Select menu in Safari: Develop > Open Page With > Firefox

Thanks for the reply. It's unclear what you're suggesting I do with an AppleScript. Save it as a separate applet? Or run it from within KM? The former would seem to defeat the purpose (executing the desired action with one command).

Thanks for this suggestion. Unfortunately, with this method, one of two things happens:

  1. The same as before: If Firefox wasn't running, it launches, but the URL doesn't load.
    Or…
  2. If Firefox wasn't running, it now often launches with an alert, asking me to run it in "Safe Mode."

1 Like

Yep. That's exactly what your macro is telling it to do. The URL only opens if Firefox is running, not after it is activated.

Move the Open URL action out of the If action to the URL is opened whether Firefox is activated or already running.

You're right. I've corrected it, but unfortunately it still doesn't work. Apparently Firefox doesn't like to be summoned in this manner; it now opens in Safe Mode with each attempt.

Thanks.

37%20am

In English, your action says:

If Firefox is not running, activate it. Otherwise (that is, if Firefox is running), open the URL.

So if Firefox is not running it will activate but it will not open the URL.

Thanks. I've corrected/amended my previous reply (above).

Then there must be something very different about your Mac.

I use this Action every day when I startup my Mac, and it always works perfectly:

FireFox is NOT running when
image

I just tested this when FF was NOT running, and it worked perfectly:

image

I'm running Keyboard Maestro 8.2.3 on macOS 10.12.6.
and Firefox 61.0.2 (6118.8.7).

Firefox is opening in Safe Mode because you are holding the Option key down. The same thing would happen if you held the Option key down while launching FireFox with the Finder.

You are, of course, holding the Option key down because the Option key is part of your hot key trigger.

Either change your trigger to a hot key that does not include the Option key, or add a Pause Until action at the start of your macro (or just before the Activate Application/launch application action) to pause until the Modifiers are all (at least the option (⌥)) released.

An excellent tip, Peter. Thanks! That part of the problem is now solved.

Now, I must determine why the URL isn't loading. As you mentioned before, it may be a bug in Firefox, although JMichaelTX is reporting different results.

Thanks again.

Hey @soundsgood,

Try this method.

If it doesn't work then something very peculiar is happening on your system.

-Chris


Open Safari URL in Firefox.kmmacros (4.6 KB)

1 Like

Thanks, @ccstone. I really appreciate your help.

Since I have a few Macs, it finally occurred to me to install Firefox on another one and try these macros there.

The good news is that each of the above methods works on Mac 2—which means the bad news is that something unidentified is preventing them from working on Mac 1.

I'm running Mojave beta on Mac 1 (only), so there's at least a possibility that something in Mojave is at fault. I can't imagine what else it might be. (For the record, I disabled all add-ons in Firefox to rule them out. No change with ALL extensions disabled.)

Under the circumstances, I'm not sure what else I can do on this Mac to troubleshoot this issue. Again, thanks to everyone who's helped so far.

Reports keep rolling in about problems with automation on Mojave...

-Chris

Thanks. I'd gladly file a bug report with Apple, except it's unclear exactly what component of macOS I'd be reporting is (allegedly) broken, especially since the issue involves 3rd-party applications. Even if it is the fault of Mojave, it doesn't seem like we can yet specify what component of Mojave is possibly at fault. If that changes, I'll be happy to file a report.