Jump to content

Need Help: Website search with 2 arguments

Recommended Posts

Hi folks,

i need your help with a pretty easy workflow i think but i don't get it.


I want to search the website dejure.de. If you search for example like for paragraph 433 BGB (german law) the url looks like this: 


I now want to use 2 arguments to search for like 433 BGB so the url in the Alfred workflow would look like 

http://dejure.org/gesetze/"argument 2"/"argument 1"

 but i dont know how to write the script to do that. Unfortunately i have no experience with scripting at all.


I would appreciate any help with that.

Edited by Sssascha
Link to comment

This could be done but not so much with a custom search unless you put the full thing in the custom search. For instance, you could just make a custom search with the url "http://dejure.org/gesetze/{query}" and, using your example, just pass "BGB/433" as the parameter


The other way would require using a simple script to read the input and build the url. Wouldn't be hard. How would you prefer to do it?

Link to comment

The first version with using BGB/433 as query is what i use for now, but i would be "nicer" when i could write 433 BGB like it is natively written. so i would prefer a simple script. i would write it myself if i had a tutorial. :)


If you wanted to do it as a simple shell script you could...

arg1=$(echo $query | cut -d " " -f 1)
arg2=$(echo $query | cut -d " " -f 2)
open "$url"

That would save whatever you input to the workflow as a variable named query and then create two variables that are the first and second word of the input string saved in $query. Then build the new url variable with the values in their correct place and open that url. This script would be done using a Run Script item. Don't forget to untick the option to Escape Spaces.

Link to comment
  • 3 years later...
  • 1 month later...

I would like to second this request. 

I am also trying to build a workflow for the same website, but I have no idea how. 

It would be great if someone could help me with it. 


Thank you very much in advance!


Edited by Cheiron
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...