Sssascha Posted August 13, 2013 Share Posted August 13, 2013 (edited) 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: http://dejure.org/gesetze/BGB/433'>http://dejure.org/gesetze/BGB/433 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 August 13, 2013 by Sssascha Link to comment
jdfwarrior Posted August 14, 2013 Share Posted August 14, 2013 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
Sssascha Posted August 14, 2013 Author Share Posted August 14, 2013 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. Link to comment
jdfwarrior Posted August 15, 2013 Share Posted August 15, 2013 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... query="{query}" arg1=$(echo $query | cut -d " " -f 1) arg2=$(echo $query | cut -d " " -f 2) url="http://dejure.org/gesetze/$arg2/$arg1" 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
Sssascha Posted August 15, 2013 Author Share Posted August 15, 2013 thank you! it just works great. Link to comment
hakin Posted December 2, 2016 Share Posted December 2, 2016 I am trying to do the same thing in Alfred 3 the above workflow didnt work for me. How do i input 2 seperate numbers and trigger this script when I press Enter? Link to comment
deanishe Posted December 2, 2016 Share Posted December 2, 2016 The above still works in Alfred 3. You're doing something else wrong (possibly you need to change the input to input as {query}). Please post your non-working workflow, so we can see what isn't working and perhaps tell you why. Link to comment
Cheiron Posted January 5, 2017 Share Posted January 5, 2017 (edited) 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! Cheiron Edited January 6, 2017 by Cheiron 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