On 04/30/2017, at 20:08, Tony <email@hidden> wrote:
I have several scripts that I use in a FileMaker database to scrape data from various webpages — using a filemaker perform AppleScript step. ... Starting with safari 10.1, the make new document lines are started creating Safari crashes (albeit this script line does not cause an exception if run directly from script editor.
I've no idea why the script when run from FileMaker is crashing Safari, and I don't have FMP to test with.
My best guess would be a text-encoding issue, but that's a complete shot in the dark.
I can tell you that Apple has broken a number of things in Safari 10.1 (12603.1.30.0.34).
For one – it no longer sees its own Preferences window.
You'll have to resort to System Events to work with it:
------------------------------------------------------------------------------
set prefTabList to {"General", "Tabs", "AutoFill", "Passwords", "Search", "Security", "Privacy", "Notifications", "Extensions", "Advanced"} set frontWindowNotPrefs to false
tell application "System Events" tell application process "Safari" tell (first window whose subrole is "AXStandardWindow") if its name is in prefTabList then tell toolbar 1 tell button "Security" perform action "AXPress" end tell end tell else set frontWindowNotPrefs to true end if end tell end tell end tell
if frontWindowNotPrefs then tell application "Safari" # return "Do something with document windows..." make new document with properties {URL:theURL} end tell end if
------------------------------------------------------------------------------
For another – the method I spent days working out and testing back in 2005 to get document windows no longer works.
------------------------------------------------------------------------------ tell application "Safari" set winList to windows where its document is not missing value end tell ------------------------------------------------------------------------------
So far this works for me:
------------------------------------------------------------------------------ tell application "Safari" set winList to windows end tell ------------------------------------------------------------------------------
But reports have come in from a few users of odd-ball invisible windows when using that code, so I'm not inclined to trust it at this time.
The code you used:
------------------------------------------------------------------------------ (every window where visible is true) ------------------------------------------------------------------------------
Is not safe, because minimized windows are not picked up by it.
I'll post a script in a bit that safely gets all document windows.
|