I'm trying to execute the following microscopic AppleScript via KM's "Execute AppleScript" action, but I can't get it to work properly. The script works 100% fine if executed outside of KM as a normal AppleScript, but within KM it does not work as-is.
I tried various ways, I looked at the applescript tag on the form, the KM's help section — all to no avail. I'd really appreciate some help, at this point
Here's the script:
set extract to do shell script ¬
"sed -E 's/.[?][v]=./\1/'<<<" & ¬
(the clipboard as text)'s quoted form
It looks at an URL in the clipboard (sample: https://www.youtube.com/watch?v=RFvNLP8li10&t=14s ) and does a regex on it, storing result in a variable called extract. So the process for this one line script is:
⠀⠀⠀⠀1. Look at value in clipboard (a youtube url)
⠀⠀⠀⠀2. Find a part based on regex via shell script
⠀⠀⠀⠀3. Store what's been found int a variable called extract
Ideally what I'm looking for is a version of the initial AppleScript that would work inside KM's "Execute AppleScript" action. Many thanks in advance for any help or pointers!