1

I would like to create a Mac Service where I could search on some websites, from applications like Scrivener. For example (with "{query}" for where the word should be):

https://www.google.ca/search?q={query}&safe=strict&biw=1280&bih=636&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjnysHu8NDPAhVEax4KHRwxB1AQ_AUICCgB

OR

https://www.amazon.ca/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords={query}

I already have the URLs, like the websites above, but I just need to know how to create the service in Automator.

2

        

Set the service to receive selected text, then add a Run Shell Script action with the following content, setting the shell to /bin/bash and passing the input as arguments.

for query in "$@"
do
    open "https://www.google.com/?q=$query"
done

Replace the URL with your desired URL, where $query is where you would like the selected text to be inserted in the string.

Also, that's all you need for a Google search — don't bother with the additional session parameters.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .