Can I turn on Chrome: "Allow JavaScript from Apple Events" with a macro?

I tried this simple action but it seems to have no effect.

Since it's a toggle I'd probably need to test if it is already on. Right now I'm just testing if variables were captured. If not, I thought I could turn this feature ON if it is off.

Edit:

I added an "If not marked" condition. The action seems to be accessing the menu but does not set it to "marked".

I can confirm this unexpected behavior. Here's my macro that is much the same as yours, except I have used the path of the menu item:

MACRO:   TEST Show Menu and Select Item

**Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+**
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

#### DOWNLOAD Macro File:
<a class="attachment" href="/uploads/default/original/3X/3/2/325b8b290b6a186612f2d59d342cb89754307f7b.kmmacros">TEST Show Menu and Select Item.kmmacros</a>
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**


---


<img src="/uploads/default/original/3X/5/a/5a20678d67233573ba9a2e943af39a4566a8cc5c.png" width="630" height="1035">

This does NOT check the `View>Developer>Allow JavaScript from Apple Events` menu item.

So, I thought maybe a more "manual" approach might be needed where the macro does a "type select" of the menu item.  So I modified my macro to do just that:

### MACRO:&nbsp;&nbsp;&nbsp;TEST 2 Show Menu with Type Select

~~~ VER: 1.0&nbsp;&nbsp;&nbsp;&nbsp;2019-12-04 ~~~
**Requires: KM 8.2.4+&nbsp;&nbsp;&nbsp;macOS 10.11 (El Capitan)+**
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

#### DOWNLOAD Macro File:
<a class="attachment" href="/uploads/default/original/3X/d/7/d763e7bf6ba0e6cc5e86dcad2ef5d5b7ea81544a.kmmacros">TEST 2 Show Menu with Type Select.kmmacros</a>
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**


---


<img src="/uploads/default/original/3X/3/5/35b33d565fbda7e842f627fdc80f9feab0ffa9f5.png" width="630" height="1356">

This macro also FAILS to check the target menu item.

@peternlewis, I believe this may be a bug, either with KM or with Chrome.
1 Like

As an addition test, I tried this action:
image

It worked as expected.

So, I think it makes it more likely that the bug is with Chrome.

It doesn't look like a bug, it looks like a (moderately sensible) deliberate choice.

If you can change that menu selection via AppleScript, then the menu is a waste of time as far as security goes (which it probably is anyway, but that ship has sailed).

I expect they explicitly blocked changing that menu.

Even more impressive, you cannot use simulated Type-Ahead to select the menu, so they seem to have done a fairly good job at blocking automated control of the menu selection (of course, that probably also means they have blocked accessibility control).

1 Like

Thank you, gentlemen, for looking at this. It DID cross my mind being able to set this with a script could be a security loophole. :slightly_smiling_face:

@JMichaelTX, thanks for showing how to reuse the Macro Title and write the menu path directly. Both very helpful.

1 Like

It even blocks the use of screen sharing to select it! No effect at all!

I’d thought there was something wrong with my browser or the OS — but as soon as I walked over to the physical computer and used its own trackpad to select “Allow JavaScript from Apple Events,” it worked fine.