I am running “High Sierra” 10.13.4 and was using Safari 11.1. I had done a number of things before the crash that might have messed up SD so I’ll list what I was doing before the crash.
I started out writing something to figure out if the web page was done loading. I tried the line (do JavaScript “document.readyState” in document 1) but it it got an error saying “Safari got an error: You must enable the ‘Allow JavaScript from Apple Events’ option in Safari’s Develop menu to use ‘do JavaScript’.”
I tried setting the “Allow JavaScript from Apple Events” in the “Develop” menu in “Safari” but it never had any effect. I tried to do a do shell script “defaults write -app Safari AllowJavaScriptFromAppleEvents 1” in “Script Debugger” but the same problem occurred.
So I gave up after a while and just tried using loops. This is when it crashed. The script is messy because I was just trying to find anything that worked.
I uploaded a file called “Load web page.scpt.zip” which is a zipped version of the script I was using. The problem I had was I needed delays because referencing a “TheDocument” property, in this case “name” would error no matter how much of a delay I used. So I used an on error and just kept looping until it no longer got an error referencing the “TheDocument.” Doing this I was able to get the name from the document but it returned the name “Untitled”. So I figured the the script need more time to fully create the document. I ran it again to see if I still got the name “Untitled” and it crashed.
This script reliably crashes SD every time I run it.
Do you know why why (do JavaScript “document.readyState” in document 1) got a privilege error? Nothing I tried in Safari would get rid of that error. Not even using default to disable the error worked.
I included the “Apple crash report in Apple Crash log.txt.zip” and included the SD crash report in “Script Debugger crash report.txt”
I believe this particular crash is resolved in the Script Debugger 7.0.2 beta build. Please download that build and see if you can reproduce the crash.
I ran the script with Script Debugger 7.0.2 and it no longer crashes.
I still can’t tell when the web page has finished loading. But instead of crashing it just goes forever in the wait loop which is what I expected when it crashed.
I suspect this is because I just updated to “High Sierra” just before the statement below stopped working.
(do JavaScript "document.readyState" in document 1)
I was trying to use the JavaScript statement above to download the documentation for Pages 7.0 so I can do the export from the database. I went though and figured out how the help system works. That part is simple. Then I went through the help text and found all the data points that make up the help text. There are 196 data points. Each of these points are accessed by a URL that starts with “https://help.apple.com/pages/mac/7.0/#/” followed by the identifier for the particular help text, for example “tan014c3bd19” which is the help text for “Keyboard shortcut symbols.” But the help system uses JavaScript.
What this all comes down to is the help system gets very temperamental about timing stuff. If I do things too quickly then it crashes, or I get part or no help text. But I can not stand the online help system Apple uses. One thing I really hate is not all the information can be reached directly. Sometimes you just have to click various things until you find the buried links. If I perform a search in help it doesn’t work because I need to know what I’m looking for before I can find what I’m looking for. In fact there are 43 links are not accessible at the top level of the help system. They don’t become accessible until you click other links and there is no real hint how to find those links or what information missing from the top level.
To export to Pages I have to work a lot between FileMaker Pro data and the Pages application. I have to pull together a lot of separate parts in the database and put them in a pages document with proper formatting and in a way that makes sense.
So if anybody reading this knows how to tell if a page in Safari is done loading I would love to hear about it.
I’m no sure how the quote marks got educated. They started out as dumb quotes. I copied the line from the script and put it in a text editor window while I typed the post. I guess the editor changed the quote marks.
Thanks for pointing that out. I changed the quote marks in the post.