Can the AppleScript statement and/or function contain code with a handler? I’ve tried this with the following, which works in the AppleScript Editor or Script Debugger, but doesn’t work in Pano X.
set getSource to “document.body.innerText”
tell application “Safari”
tell the current tab of its front window
set theSource to do JavaScript (getSource)
my PauseMe()
end tell
end tellset the clipboard to theSource
on PauseMe()
tell application “Safari”
tell current tab of its front window
repeat while true
do JavaScript “document.readyState”
if the result = “complete” then exit repeat
delay 0.05
end repeat
end tell
end tell
end PauseMe
This example is a bit contrived, but it appears that handlers don’t work in the applescript statement/function. Could this be fixed?