SOLVED How to look up a sentence with words with search engine?

Joined
Oct 11, 2022
Messages
2
Reaction score
0
Hello all,

I wrote a service-workflow that takes selected text in Notes app and searches it online. It works with one word only. With more than one word selected, I get this error: The action “Run Shell Script” encountered an error: “The file /Users/main/https:/antwerpen.bibliotheek.be/krantenarchief?q=Vias zet subsidies in voor commerciële does not exist.” How to make this service work with more than one word?
for query in "$@" do open "https://antwerpen.bibliotheek.be/krantenarchief?q=$query" done
 

Cory Cooper

Moderator
Joined
May 19, 2004
Messages
11,106
Reaction score
497
Hi,

Sorry for the delayed response.

I don't have much experience with Automator personally. Maybe another member that does will chime in.

You can also try the folks over at MacScripter, as they may be able to help out as well.

C
 
Joined
Oct 11, 2022
Messages
2
Reaction score
0
The solution was add a line to the shell script that replaces spaces between words for a plus sign. Works nicely as a service :)

for query in "$@" do query_encode="${query//" "/"+"}" open -a "Firefox" "https://antwerpen.bibliotheek.be/krantenarchief?q=$query_encode" done
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top