Is it just me or is %SafariURL% broken under 10.11.6 / Security Update 2017-004?

I’ve just upgraded my copy of El Capitan to the latest version of Safari (11.0.1) and the latest security update from Apple (2017-004), and now it seems as if the %SafariURL% token might be broken. Is anyone else seeing this?

In case, it might help, here’s a quick test macro: Paste the current Safari URL.kmmacros (2.2 KB). When I run that macro with a text editor in front, nothing gets pasted.

Any help is much appreciated!

— Ashley

My system is running the same recent updates as yours, and your macro worked in Mail as it’s configured.

Hey Ashley,

Your macro works perfectly for me on macOS 10.12.6 with Safari 11.0.1 (12604.

Make sure Safari hasn’t been hidden using the system’s Hide command.

Safari doesn’t respond well when it has been hidden and can return the wrong page’s URL.

If you’re still having trouble make sure to restart Safari.

If still having trouble then reboot.

If still having trouble then report back here.


(JM’s post below is quite possibly the cause.
Although I did NOT get bitten by that nasty worm when I applied the update on Sierra, it has bitten me a couple of times in the past.)

You may be just now suffering from an issue Apple created, that most of us have already encountered.



I suspect there’s something else at play here because I do not have that setting (Develop > Allow JavaScript from Apple Events) enabled and @handcoding’s macro worked on my Mac running 10.11.6 with Security Update 2017-004. And I use essentially an identical macro on my own system.

Allow JavaScript from Apple Events is probably not required for the SafariURL token, since that is straight AppleScript, basically:

tell app "Safari" to tell document 1 to URL

(it's more complicated than that, but no JavaScript).

You can try the above AppleScript, either from Script Editor or from osascript in the Terminal to see if they work.

1 Like

Thanks to everyone for their ideas and suggestions! I thought I’d share the denouement for anyone who might be following along.

As JMichaelTX suggested, I tried toggling Safari’s Develop → Allow JavaScript from Apple Events setting. For whatever reason, that didn’t seem to change anything.

Then, as a shot in the dark, I reset my MacBook Pro’s PRAM and its SMC, and I rebooted the machine. And now, voilà—everything is back to working again. ¯_(ツ)_/¯

Thanks again for all the ideas. I’m not sure what may have been the cause, but I’m just happen to have Keyboard Maestro back in good health again :).

— Ashley