Fixed Wait for Safari to Finish Loading Plug In Action


Here is a Plug In Action that performs similarly to the Wait For Safari to Finish Loading action. It is not as good, since the Stop menu used to be quite helpful in determining whether a page was loading, but since that is no longer the case in Safari 12.1 this will have to do.

It is pretty straight forward, but I have not done much testing of it. Hopefully it works - if any AppleScript gurus (@ccstone?) want to look and check I have not messed up my AppleScript coding, that might be wise.

Fixed Wait for Safari to Finish (17.6 KB)

Mojave 10.14.4 - [SOLVED] Wait For Safari to Finish Loading not working properly
Safari 12.1 broke the Wait For Safari to Finish Loading action

Hey Peter,

It looks okay to me.



Working perfectly for me Peter. Thank you!


Working for me too. Thanks!


Unfortunately, I can't get the Plug In Action to work for me. I've put it into my macro in place of the "Wait for Safari to Finish Loading" Action (which I disabled), but the macro fails at the next action (because Safari hasn't finished loading). The log says:

2019-04-06 10:43:54 /Users/justus/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions/Fixed Wait for Safari to Finish Loading/Action.scpt: execution error: Can’t make "3693.340345" into type number. (-1700)

From what I can see with my limited AppleScript knowledge, it's happening in the line

tell application "Keyboard Maestro Engine" to set n to 0 + (calculate "SECONDS()")

Any ideas?


I fixed it myself by changing the line as follows:

tell application "Keyboard Maestro Engine" to set n to 0 + (round (calculate "SECONDS()"))

Now it seems to be working, even though I am not sure why it wasn’t working on my system before.


The problem with that is you want the calculation to work with fractions, which is why I chose to use SECONDS(). If you are working in a non-english language, it is likely that AppleScript is using a different format for decimal numbers, and failing to cope with Keyboard Maestro (which always uses decimal numbers with “.”).


That was it, thank you! My system is set to English, but the decimal separator (Settings > Language & Region > Advanced) is set to comma. I've now modified the AppleScript with an additional function to replace the dot with a comma and the conversion works without any problems.


The plugin's working for me. Thanks!