AppleScript "open location" broken in 10.12.5?

I have several scripts that I use to open customized URLs in Safari ...but they are all failing to execute since I've upgraded to 10.12.5.


If I open the scripts up and run them via script editor they work fine. They just fail to launch when run as an application or through the script menu.


Bug or new security measure?


Thanks!

Posted on May 16, 2017 7:53 AM

Reply
Question marked as ⚠️ Top-ranking reply

Posted on May 16, 2017 4:03 PM

Yep. Same here. I got it working again.


Pre 10.12.5, this worked fine:


open location ("mailto:?Subject=" & pageName & "&Body=" & urlToSend)


I worked on it for about an hour and this is what is required in 10.12.5:


set mailtoURL to ("mailto:?Subject=" & pageName & "&Body=" & urlToSend) as string

tell application "System Events" to open location mailtoURL with error reporting


Don't know why, but that is what fixed it for me.

13 replies
Sort By: 
Question marked as ⚠️ Top-ranking reply

May 16, 2017 4:03 PM in response to zwei

Yep. Same here. I got it working again.


Pre 10.12.5, this worked fine:


open location ("mailto:?Subject=" & pageName & "&Body=" & urlToSend)


I worked on it for about an hour and this is what is required in 10.12.5:


set mailtoURL to ("mailto:?Subject=" & pageName & "&Body=" & urlToSend) as string

tell application "System Events" to open location mailtoURL with error reporting


Don't know why, but that is what fixed it for me.

Reply

May 16, 2017 5:03 PM in response to Auctoris

After playing with this for awhile, I have to say this is only a sporadic fix. It works fine a few times, then throws the same old error again. Then it works a few times, then throws the same error again.


It works better than the code that always gave an error, but I don't think this fix is 100%.


I think we're dealing with an AppleScript bug in 10.12.5.

Reply

May 17, 2017 10:48 AM in response to Auctoris

More info on my "fix" that sometimes throws an error. It only throws an error if System Events is not already running.


If System Events is not already running when I run the script, it throws the same error we initially got in 10.12.5. The next time I run the script, when System Events has been launched, the script works fine. When System Events quits itself after whatever period of inactivity, the script throws the error again the first time it is run with System Events not running. Run it again immediately and it works fine since System Events was activated on the last script run.


I don't know if that is tied to the original 10.12.5 bug, but I think they are related since they throw the same error.


I'm going to play with activating System Events early in the script and delaying by half a second.

Reply

May 23, 2017 1:25 PM in response to EricS

That works, but I'm not going to launch Safari to create an email message. I'll just stick with open location for now. I could use Keyboard Maestro or UI scripting to complete the same action in Thunderbird, but open location works 90% of the time so I'll stick with it.

Reply

Jun 7, 2017 2:05 PM in response to zwei

I reported this as a bug when I discovered it. They said it had already been reported and my report was added to the original. Today I received a message saying the original report had been closed.


I hope this means the fix will appear in 10.12.6.

Reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

AppleScript "open location" broken in 10.12.5?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.