I've been having some trouble with this. I'm new to Automator and I'm looking to make a Quick Service to: have a script that copies the selected text (on Safari), adds it to the end of the same URL the text is on, and then saves that new link to the clipboard with some additional characters. Example of what I'm looking for:
URL: https://en.wikipedia.org/wiki/Penny_Mordaunt
Selected Text: She used the word
Desired Result in Clipboard: https://en.wikipedia.org/wiki/Penny_Mordaunt#:~:text=She%20used%20the%20word
I dont have too much so far but what I do have is:
tell application "Safari"
set theURL to URL of current tab of window 1
set theName to theURL & "selected text"
end tell
The first line does get the URL of the tab. The part I'm having trouble in is getting the selected text and appending with the correct special characters in the right places.
This would be adding #:~:text=
before and %20
before every consective word selected.
Any help would be great!