So I am trying to write a service in Automator & cannot figure out how to take the current selected page url of Safari or Chrome to variable within this on run.
I obviously set ytURL explicitly here, but want to use a variable set to the page url instead.
When set explicitly it does work from testing.
on run {input, parameters}
set ytURL to "https://www.youtube.com/watch?v=Y-NB0GiPvh0"
tell application "Terminal"
activate
do script with command ("youtube-dl --extract-audio --audio-format mp3 " & ytURL)
end tell
return input
end run
So I guess what automator action step should I have above this one?
Is it “Set variable”? and if so how would I do that?
ANSWER:
Okay this is how I did it:
1st Automator step was “Get current webpage from Safari”
2nd Automator step was “Run Applescript”
on run {input, parameters}
set ytURL to input
tell application "Terminal"
activate
do script with command ("youtube-dl --extract-audio --audio-format mp3 " & ytURL)
end tell
return input
end run