Setting Opera/Vivaldi URL?

As I’m having a problem using Google Chrome on Sierra with KM, I want to try other browsers like Opera or Vivaldi. Since I’ve been using Set Google Chrome URL and Execute JavaScript in Google Chrome very often, I need those features for Opera or Vivaldi. How can I use them on other browsers besides Chrome and Safari?

Doesn’t sound obviously possible to me …

What problems are arising with Chrome ?

You can probably use the "Open URL" action for this. Don't know about the "Execute JavaScript In" action.

Or with a shell script action, use the -a switch of the open command to specify a particular browser app.

perhaps sth like:

open -a Opera https://forum.keyboardmaestro.com

open -a "Google Chrome" https://forum.keyboardmaestro.com

( In osascript terms, last time I looked at Opera it didn’t seem to be particularly scriptable )

Keyboard Maestro developer @peternlewis has stated numerous times that Keyboard Maestro fully supports macOS Sierra.

This would include all of the KM Actions regarding Google Chrome and Safari.

I have no idea why this is not working for you, but I'd suggest that you post the actual Macro which is not working.

See

I had corresponded with Peter about this via direct message and he also checked the actual macro file but couldn't find what caused the problem. After that, I even had cleaned the system volume and reinstalled Sierra but it didn't work. He said:

Maybe I should go back to El Capitan for now.

Hi

I can confirm @peternlewis’ suspicion with executing AppleScript and having Windows running in a virtual machine.
In my job I need to use Windows for testing. This is done with Parallels Desktop and works fine. But a standard virtual machine shares the applications. So suddenly my AppleScripts for Outlook did not work, because the system could see two “Microsoft Outlook”. The one was the one inside the virtual machine and it could not run AppleScript.

So if you have Parallels Desktop installed, then try to disable Applications sharing on your virtual machine.

Thanks for sharing your experience but I don't use any Windows emulator such as VMware and Parallels Desktop.

There is a preference in Keyboard Maestro to explicitly configure the application for Safari and Google Chrome so it can be “/Applications/Google Chrome.app” and avoid confusion with other versions or virtual machines.

As far as I am aware, Google Chrome and Safari are the only web browsers with AppleScript support that allows the commands like Execute JavaScript in browser to work.

What you describe is not a Sierra issue as far as I am aware.

Under certain circumstances, the system/Chrome gets in a state where the AppleScripts don’t work. It’s happened for many OS releases. Going back to El Capitan might solve it, but so might any other action - without knowing the cause there is no way to know what might change it.

I would try using Execute AppleScript “tell “Google Chrome” to do something” and see if that works or fails, and then if it fails, I would try “tell “/Applications/Google Chrome.app” to do something” and see if that works or fails.

As @peternlewis suggested, sometimes (rarely) Chrome can get in a weird state.

Close Chrome, than run this AppleScript from the Script Editor:

tell application "Google Chrome"
  activate
  set newURL to "http://forum.keyboardmaestro.com"
  if (count of windows) is 0 or front window is not visible then
    make new window
  else
    make new tab at end of tabs of front window
  end if
  
  set URL of active tab of window 1 to newURL
  
end tell

If that works, then put the script in a KM macro action "Execute AppleScript", and test that.

If either of those fail, restart your Mac and try again.
Please let us know the results.

I got it back to El Capitan yesterday, but I’m sure it would work pretty fine on my Mac with Sierra.

The macro didn’t always make problem. It was a loop that has a few AppleScript actions on Google Chrome. The problem was that it would pause after a few minutes or hours running, which had never happened on El Capitan. I had cleaned the system volume and reinstalled Sierra but it couldn’t be a solution.

I’m not sure if your test would still work fine when I have it executed in a loop for hours, just like my macro. Of course I also want to know the cause and use Sierra again. I would like to do some test on this weekend. Making it as a loop can be a good test? If you can give me a bit more ideas for that, it would be really appreciated. I’ll give you the actual macro file via message.

Thank you for your help.

Okay. I’ll update the OS to Sierra again and try it tomorrow. I’ll let you know the results. Thanks!

The problem I've been having is that a macro loop I've used for months without any problem on El Capitan suddenly doesn't work properly after I updated the OS to Sierra. It pauses after a few minutes or a few hours running at some specific actions. I don't use any virtual Windows emulator like Parallels Desktop. For a temporary solution, I reinstalled El Capitan and used it for a few days.

And I updated the OS to Sierra again last weekend and have done some tests on it. The results are below. I have used Keyboard Maestro Debugger for the tests.

(TEST 1)
: It didn't stop or freeze during hours of running on the first two days.

(TEST 2)
: It has frozen sometimes at Set Google Chrome URL and sometimes at Execute JavaScript in Google Chrome after a few minutes to a few hours running.

(TEST 3)
: It happened at Execute JavaScript in Google Chrome. Or sometimes the actions just looked like it's paused, Chrome didn't do anything while Debugger kept showing the actions as if they were still working fine.
: It stopped at Execute AppleScript today. (PST 18:25, Oct 3rd)

Could you guys give me some advice for this issue? And for those who are curious, the Execute JavaScript in Google Chrome action is this:

And this is my Mac:

As Execute AppleScript "tell application "Google Chrome" to do something" fails, I'm going to try "tell "/Applications/Google Chrome.app" to do something" today. (PST 18:25, Oct 3rd)
: I think I don't know how to set this. Would you please make a string for this? tell "/Applications/Google Chrome.app" and tell /Applications/Google Chrome.app don't work.