I have a script that is designed to get Safari to activate, and go to a particular URL that happens to be a php file. Here is a modified version of it…
tell application "Safari"
activate
set URL of document 1 to "https://www.mysite.org/dump_set1.php"
end tell
Everything works fine if …
- Safari is not open; or
- Safari is open, and a browser window is active, either on screen or in the dock (minimized).
It does not work if Safari is open, but no window is active. Instead I get an error message, “Can’t get document 1. Invalid index.” If I’m running this script from within a FMP10 script, I get an additional error message, " Unknown Error: -1719."
What do I need to do to this code to fix this issue? BTW, I do have the home page set to a file on my computer, but this is not a problem, for the script opens that page, and then sets its URL according to the script.
Thanks,
Charlie