Error: /var/folders/wc/ymvh1gv88xn895006s6vz9br1111aa/T/Keyboard-Maestro-Script-F7B85985-210F-477F-19D3-E5ABCAC615BC:10434:10385: execution error: The variable r is not defined. (-2753)
Stuff I’ve tried:
Restarting the Keyboard Maestro Engine.
Executing the macro on a different page.
Running the JS directly in Safari’s Console. RESULT: It works fine and selects the corresponding element.
As far as I know, there is no “variable r”. At least not one that I’ve defined.
I may or may not have restarted the computer since this started. Do you think that could do it?
The error is caused by a bug in Safari, such that the do javascript command, when the javascript does not return anything, returns something that is so nothing that it removes the resulting variable from AppleScript’s mind.
Basically, the AppleScript that is executed looks like this:
set r to do javascript …
if r is missing value then
set r to ""
end if
And the result from Safari is such that the second like complains “The variable r is not defined”. Which is madness, since it is clearly defined on the line before.
Such is AppleScript unfortunately.
I will look at working around the Safari bug (which has also been reported to Apple).
[quote=“peternlewis, post:8, topic:7700”]
And the result from Safari is such that the second like complains “The variable r is not defined”. Which is madness, since it is clearly defined on the line before.[/quote]
Ahh.
I think I understand
That’s great, thanks.
Knowing that’s it’s basically nothing, and the macro is likely otherwise working fine, is good enough. I can deal with the error window for now