Edouardg Posted May 28, 2015 Share Posted May 28, 2015 Hello there, I am totally new to Alfredapp and far from understanding programmation languages. I just want to be able to perform quick search on a website. For that I already created a custom web search but I still have to put dashes between words to make it work. Here is some more info: If I want to look for "Villa Yoga", my URL must look like this: https://www.villa-bali.com/en/villa/seminyak/villa-yoga So in the custom search I wrote https://www.villa-bali.com/en/villa/seminyak/{query} Unfortunately, that means I have to write exactly "Villa-Yoga", not really the best. Do you think I can create some kind of script to replace the spaces by dashes before the URL is being opened? Thank you for your help, Best regards, Link to comment
Andrew Posted May 28, 2015 Share Posted May 28, 2015 Hello there, Do you think I can create some kind of script to replace the spaces by dashes before the URL is being opened? Thank you for your help, Best regards, Hi there, I've popped together a simple workflow which will do this for you... https://dl.dropboxusercontent.com/u/6749767/Alfred/Workflows/URL%20with%20Dashes.alfredworkflow Download and double click to install into Alfred, then use the keyword 'villa' in Alfred e.g. villa villa yoga A little about how this workflow works... There is a keyword input which is set to 'villa' connected to a php script containing the following: // replace spaces with - $query = str_replace(' ', '-', "{query}"); // setup the URL to open $command = "open 'https://www.villa-bali.com/en/villa/seminyak/$query'"; // open the URL shell_exec($command); This takes {query} and replaces spaces with -, then constructs the command to open that URL in OS X, then runs the command. Hope this helps! Cheers, Andrew Link to comment
Edouardg Posted May 29, 2015 Author Share Posted May 29, 2015 Hi Andrew, thank you very much! That's exactly what I needed! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now