"Doesn't understand the log message"?

I have this code:

tell application "Safari"
	activate
	open location myURL
	my finishedLoading(myURL)

that calls this code:

on finishedLoading(URLtoLoad)
	log "finishedLoading is executed: " & URLtoLoad

which has worked for a long time but suddenly I get this error message:

"finishedLoading is exectued: [URL]" doesn’t understand the “log” message.

one one of my machines. That is, it works on two other machines I have.

Can anyone explain what is going on here?

Hi.

I can’t think of any obvious cause. The only things I can suggest, if you haven’t already tried them, is to restart the problem machine to see if reloading AppleScript solves the problem and/or copy the script file over from one of the good machines in case the one on the problem machine’s become corrupted.

2 Likes

FWIW, I tested the following script on my 2023 Ventura Mac mini without issue. I tested the script on both Script Editor and Script Debugger.

set myURL to "https://www.macscripter.net"

tell application "Safari"
	activate
	open location myURL
	-- instead of above line try the following which makes new window
	-- make new document at end of documents with properties {URL:myURL}
	my finishedLoading(myURL) -- showed in log "(*finishedLoading is executed: https://www.macscripter.net*)"
end tell

on finishedLoading(URLtoLoad)
	log "finishedLoading is executed: " & URLtoLoad
end finishedLoading

Now it happened again, on another computer (but the computer I originally had the problem on started working again after a couple of days).

Weirdly enough, if I run the script using osascript it works. Guess it must be something with Script Editor that needs a restart or something