You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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
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.

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.

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.

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.