Jump to content

Opening URL depending on search term


Recommended Posts

I'm attempting to setup a workflow that allows you to enter a county name and then hit the Enter key to open the website assigned to that county.

 

I have the terms along with their corresponding websites stored in a text file and separated by a colon like the following example:

 

Anderson County:http://www.assessment.cot.tn.gov/re_assessment/SelectCounty.aspx?map=true&SelectCounty=001

Davidson County:http://www.padctn.org/prc/#/search/1

Hickman County:http://hickman.capturecama.com

 

I have the following Input Script Filter setup but cannot figure out how to launch the website. I've tried using both an Open URL action and Run Script action with no luck.

IFS=$'\n' 

match=($(grep -i {query} counties.txt))

echo '<?xml version="1.0"?>'
echo '<items>'
echo ''

for i in ${match[@]}; do
	tncty=($(echo "$i" | cut -d\: -f1))
	ctyw=($(echo "$i" | cut -d\: -f2))

	echo "<item arg=\"$tncty\" valid=\"yes\">"
	echo "<title>$tncty Property Records</title>"
	echo "<subtitle>Enter → Search $tncty Property Records</subtitle>"
	echo "<icon>search.png</icon></item>"
	echo ""
done

echo "</items>"

property_search.png

 

Any point in the right direction would be appreciated. Thanks.

Edited by jarhead
Link to comment

I'm attempting to setup a workflow that allows you to enter a county name and then hit the Enter key to open the website assigned to that county.

 

I have the terms along with their corresponding websites stored in a text file and separated by a colon like the following example:

 

Anderson County:http://www.assessment.cot.tn.gov/re_assessment/SelectCounty.aspx?map=true&SelectCounty=001

Davidson County:http://www.padctn.org/prc/#/search/1

Hickman County:http://hickman.capturecama.com

 

I have the following Input Script Filter setup but cannot figure out how to launch the website. I've tried using both an Open URL action and Run Script action with no luck.

IFS=$'\n' 

match=($(grep -i {query} counties.txt))

echo '<?xml version="1.0"?>'
echo '<items>'
echo ''

for i in ${match[@]}; do
	tncty=($(echo "$i" | cut -d\: -f1))
	ctyw=($(echo "$i" | cut -d\: -f2))

	echo "<item arg=\"$tncty\" valid=\"yes\">"
	echo "<title>$tncty Property Records</title>"
	echo "<subtitle>Enter → Search $tncty Property Records</subtitle>"
	echo "<icon>search.png</icon></item>"
	echo ""
done

echo "</items>"

property_search.png

 

Any point in the right direction would be appreciated. Thanks.

 

The argument within the script filter is automatically passed on the to the next step within the workflow. So, in your sample code above, you would be sending the value of $tncty to the next step which seems to be incorrect. For the <item>'s arg value, use $ctyw. Then attach an Open URL action to the tail end of the Script Filter. If you want to verify the url is coming through correctly, attach a Large Text to the tail end so you can see what is being passed from the Script Filter to the next step.

Link to comment

Anderson County:http://www.assessment.cot.tn.gov/re_assessment/SelectCounty.aspx?map=true&SelectCounty=001
Note that there's more than one colon in there.

 

When you split the string on a colon, you end up with 3 columns. Your first column is the county name, the second is "http" and the third is "//...".

Use tab or some other character that won't appear in the name or URL as the delimiter.

Edited by deanishe
Link to comment
Anderson County:http://www.assessment.cot.tn.gov/re_assessment/SelectCounty.aspx?map=true&SelectCounty=001
Note that there's more than one colon in there.

 

When you split the string on a colon, you end up with 3 columns. Your first column is the county name, the second is "http" and the third is "//...".

Use tab or some other character that won't appear in the name or URL as the delimiter.

 

 

 

Thanks David. Using $ctyw works... kind of. Adding a Large Text output shows that it is only sending http and not the entire website. Tried putting the website in quotes and single quotes unsuccessfully.

 

alfred_http.png

 

Or you could just make the url be the 2nd and 3rd column instead of just the second. Either way.

Link to comment
Anderson County:http://www.assessment.cot.tn.gov/re_assessment/SelectCounty.aspx?map=true&SelectCounty=001
Note that there's more than one colon in there.

 

When you split the string on a colon, you end up with 3 columns. Your first column is the county name, the second is "http" and the third is "//...".

Use tab or some other character that won't appear in the name or URL as the delimiter.

 

 

Figured this out playing with further. Thanks. Missed the obvious.

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...