Silent failure from 'execute javascript in chrome' feature

Hi there,

I really love the ‘execute javascript in chrome’ feature, but I can’t seem to get it to work anymore - basically no matter what i tell KM to do with the results, it just silently fails. It won’t display the results or copy them to the clipboard. I’ve made sure that the chrome window is active when the javascript is supposed to be executing, and the same code works perfectly if i run it via chrome’s javascript console. Any idea what I might be missing?

The Chrome (and Safari) actions work by making AppleScript requests.

Chrome’s auto-update mechanism seems to frequently break the AppleScript connections.

Restarting Google Chrome, Keyboard Maestro Engine, or restarting your Mac will usually resolve the broken connection.

Thanks Peter! You are right, that fixed the problem. Here’s another related (i think) issue: Sometimes when i run a jQuery command that works in Chrome’s console but i get this when i run it with KM:

“0:, 1:, 2:, 3:, 4:, 5:, 6:, 7:, context:missing value, length:8, prevObject:0:, context:missing value, length:1, selector:.theSelector

I edited the italicized text above for confidentiality reasons, but I don’t think it should affect the answer. Let me know if that’s not the case. Any ideas for what could cause this?

No idea I’m afraid. Execute the JavaScript in Chrome is just a thin wrapper AppleScript around “execute active tab javascript” to execute the JavaScript.

tell application "Google Chrome"
	if it is running then
		tell window 1
			set r to execute active tab javascript "document"
			if r is missing value then
				set r to ""
			end if
		end tell
	else
		set r to "Not Running"
	end if
end tell
r