An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Previous Thread
Next Thread
Print Thread
AppleScript question
#62820 11/19/22 12:30 PM
Joined: Aug 2009
Likes: 7
OP Online

Joined: Aug 2009
Likes: 7
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.


The new Great Equalizer is the SEND button.

In Memory of Harv: Those who can make you believe absurdities can make you commit atrocities. ~Voltaire
Re: AppleScript question
artie505 #62826 11/19/22 06:00 PM
Joined: Aug 2009
Likes: 7
Moderator
Offline
Moderator

Joined: Aug 2009
Likes: 7
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).

Last edited by joemikeb; 11/19/22 06:04 PM. Reason: rephrase

"Sacred cows make the best hamburger"

- Mark Twain
Re: AppleScript question
joemikeb #62829 11/19/22 07:49 PM
Joined: Aug 2009
Likes: 7
OP Online

Joined: Aug 2009
Likes: 7
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.)


The new Great Equalizer is the SEND button.

In Memory of Harv: Those who can make you believe absurdities can make you commit atrocities. ~Voltaire

Moderated by  alternaut, dianne, dkmarsh 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.4.25 Page Time: 0.015s Queries: 20 (0.011s) Memory: 0.5775 MB (Peak: 0.6337 MB) Data Comp: Zlib Server Time: 2022-11-29 07:30:55 UTC
Valid HTML 5 and Valid CSS