Home
Posted By: artie505 AppleScript question - 11/19/22 12:30 PM
For many years, I've been running these two AppleScripts (which I believe were posted by dkmarsh...thanks):

Code
tell application "Safari Technology Preview"
	activate
	set {theURL, theTitle} to {URL of document 1, do JavaScript ¬
		"document.title" in document 1}
	set theText to theURL & theTitle
	set the clipboard to theText
end tell

Code
tell application "Safari Technology Preview"
	activate
	set {theURL, theTitle} to {URL of document 1, do JavaScript ¬
		"document.title" in document 1}
	set theText to "[url=" & theURL & "]" & theTitle & "[/url]"
	set the clipboard to theText
end tell

They originally invoked Safari, but since I've now switched to Safari Technology Preview, I've changed them, and they no longer work.

My other AppleScripts still work as expected, and these two still work in Safari.

Is STP immune?

Thanks.
Posted By: joemikeb Re: AppleScript question - 11/19/22 06:00 PM
When I first ran the Script I get

Originally Posted by error message
Safari Technology Preview got an error: You must enable the 'Allow JavaScript from Apple Events' option in Safari's Develop menu to use 'do JavaScript'.

Once I made that setting change the scripts are working for me in Safari Technology Preview Release 158 (Safari 16.4, WebKit 18615.1.12.110.1).
Posted By: artie505 Re: AppleScript question - 11/19/22 07:49 PM
Originally Posted by joemikeb
When I first ran the Script I get

Originally Posted by error message
Safari Technology Preview got an error: You must enable the 'Allow JavaScript from Apple Events' option in Safari's Develop menu to use 'do JavaScript'.

Once I made that setting change the scripts are working for me in Safari Technology Preview Release 158 (Safari 16.4, WebKit 18615.1.12.110.1).

Oops! I forgot to coordinate that setting when I moved from S to STP. blush

Thanks for reminding me. (I tried the script many times in STP and never got your pop-up.)
© FineTunedMac