Help with JavaScript

I am trying to create a Search Action with prompts for where to search (Amazon, App Store, Google, iTunes, etc). I have gotten the prompt to work, as well as bringing up the selected site in SafariViewController but the JavaScript is not using the draft text as the search parameter, it is bringing up the webpage with no search parameter. Here is the action I’m trying to get working. The only two search actions I’ve set up are Amazon and Google. I want to get those working before I re-code the rest of the action. The action is based on a couple of Tim Nahumck’s actions here

Here is how the script is in my action is, this just brings up the search page

Thanks in advance.

Here is Tim’s other action I’m basing my action on. Here is a screenshot of the script.

This is the URL generated by the script. Now to figure why it isn’t grabbing the draft text

Maybe something like:

var content = draft.processTemplte("[[selection]]");
var output = encodeURIComponent(content);
1 Like

Thank you so much. This has fixed the issue

Here is the Search Mega Action I created for Drafts 5. It can search Amazon, App Store, DuckDuckGo, Google, Google Images, Google Translate, IMDB, iTunes, Rotten Tomatoes, Twitter, Wikipedia, Wolfram Alpha, or YouTube.