Umlaut letters not pasted correctly into URL

I’ve been working on an AppleScript for a couple of weeks now to automate some site searches. It works pretty much as I need, but after trying to add a new resource today, I found that this failed because the German umlaut letters (ä,ö,ü) were not being pasted correctly into the required URL.

Here is the site:

http://dict.uni-leipzig.de/

If you put enter an umlauted word (for instance “selbständig”) at the site itself, this is converted to “selbst%E4ndig”.

Clearly, I need my script to convert the umlaut letters to their HTML equivalents so that searches can be processed. Please note this isn’t a problem for all the sites in my script, only some. But if you change the umlaut letters to their HTML equivalents, this seems to work for all the sites, thus my desire to find a way to convert them.

I found the following in the lists.apple.com archives, but am not sure if it’s what i need or how to apply it in my script:

http://lists.apple.com/archives/Applescript-users/2002/Mar/msg00900.html


property SZListe : {"C", "\"", "<", ">", "B!", "B\"", "B#", "B%", "B'", "B(", "B)", "B*", "B+", "B,", "B.", "B0", "B1", "B4", "B5", "B6", "B7", "B8", "B:", "B;", "B?", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C ", "C
", "C", "C", "C
", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C ", "C!", "C\"", "C#", "C$", "C%", "C&", "C'", "C(", "C)", "C*", "C+", "C,", "C-", "C.", "C/", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "C:", "C;", "C<", "C?", "b\"", "b", "b\"", "b,", "b", "b", "b", "b", "b", "b"}

property ESListe : {"ß", """, "<", ">", "¡", "¢", "£", "¥", "§", "¨", "©", "ª", "«", "¬", "®", "°", "±", "´", "µ", "¶", "·", "¸", "º", "»", "¿", "À", "Á", "", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "Ø", "Ù", "Ú", "Û", "Ü", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ÿ", "•", "⁄", "™", "€", "‘", "’", "‚", "“", "”", "„"}

set theText to "Whatever you like to test"

considering case, diacriticals and punctuation
	if theText is not "" then
		if theText contains "&" then
			set oldDelims to AppleScript's text item delimiters
			
			set AppleScript's text item delimiters to {"&"}
			set ls to text items of theText
			set AppleScript's text item delimiters to {"&"}
			set theText to ls as string
			
			set AppleScript's text item delimiters to oldDelims
		end if
		
		repeat with i from 1 to the count of items in SZListe
			if theText contains item i of SZListe then
				set oldDelims to AppleScript's text item delimiters
				set AppleScript's text item delimiters to item i of SZListe
				set ls to text items of theText
				set AppleScript's text item delimiters to item i of ESListe
				set theText to ls as string
				set AppleScript's text item delimiters to oldDelims
			end if
		end repeat
	end if
end considering

I tried copying it into the top of my script and changing “theText” to “search” (my search variable), but this sadly did not work.

Here is my script:

set search to text returned of (display dialog "Enter Search Query - Joint Terms with \"+\":" default answer "" buttons {"Search", "Cancel"} default button "Search")
set lang to {"German", "Dutch", "Google Tools", "Reference", "Currency Converter"}
set langSelect to (choose from list lang with prompt "Make Selection:" without multiple selections allowed) as text
if langSelect is "German" then
	set sites to {"Linguee", "Woerterbuch.info", "Uni Leipzig", "Langenscheidt", "Google", "Google Images", "Wiki.de", "Lisa", "SAP.com", "Pons", "Dict.cc", "Eur-Lex", "UBS Banking", "MS Language Portal", "WIPO", "IATE", "All Sites"}
	set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
	if chosen is "Linguee" then
		open location "http://www.linguee.com/english-german/search?sourceoverride=none&source=auto&query=" & search
	else if chosen is "Woerterbuch.info" then
		open location "http://www.woerterbuch.info/?query=" & search & "&s=dict&l=en"
	else if chosen is "Uni Leipzig" then
		open location "http://dict.uni-leipzig.de/"
	else if chosen is "Langenscheidt" then
		open location "http://www.wissen.de/wde/generator/wissen/services/suche/wb/index.html?dictqry=" & search & "&Start=%A0%A0Suchen%A0%A0&dictlang=en"
	else if chosen is "Google" then
		open location "http://translate.google.com/?hl=en&eotf=0&sl=de&q=" & search
	else if chosen is "Google Images" then
		open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
	else if chosen is "Wiki.de" then
		open location "http://de.wikipedia.org/wiki/" & search
	else if chosen is "Lisa" then
		open location "http://lisa-woerterbuch.de/%C3%9Cbersetzung/Deutsch-Englisch/" & search & ".html"
	else if chosen is "SAP.com" then
		open location "http://help.sap.com/saphelp_glossary/de/index.htm"
	else if chosen is "Pons" then
		open location "http://mobile.pons.eu/dict/search/mobile-results/?l=deen&q=" & search
	else if chosen is "Dict.cc" then
		open location "http://www.dict.cc/?s=" & search
	else if chosen is "Eur-Lex" then
		open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=de&RechType=RECH_mot&Submit=Suche"
	else if chosen is "UBS Banking" then
		open location "http://www.ubs.com/3/g?lo=t&qt=" & search & "&utf=€"
	else if chosen is "MS Language Portal" then
		open location "http://www.microsoft.com/Language/en-US/Search.aspx"
	else if chosen is "WIPO" then
		open location "http://www.wipo.int/classifications/nivilo/nice/index.htm?lang=DE#"
	else if chosen is "IATE" then
		open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
	else if chosen is "All Sites" then
		open location "http://www.linguee.com/english-german/search?sourceoverride=none&source=auto&query=" & search
		open location "http://www.woerterbuch.info/?query=" & search & "&s=dict&l=en"
		open location "http://dict.uni-leipzig.de/"
		open location "http://www.wissen.de/wde/generator/wissen/services/suche/wb/index.html?dictqry=" & search & "&Start=%A0%A0Suchen%A0%A0&dictlang=en"
		open location "http://translate.google.com/?hl=en&eotf=0&sl=de&q=" & search
		open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
		open location "http://de.wikipedia.org/wiki/" & search
		open location "http://lisa-woerterbuch.de/%C3%9Cbersetzung/Deutsch-Englisch/" & search & ".html"
		open location "http://help.sap.com/saphelp_glossary/de/index.htm"
		open location "http://mobile.pons.eu/dict/search/mobile-results/?l=deen&q=" & search
		open location "http://www.dict.cc/?s=" & search
		open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=de&RechType=RECH_mot&Submit=Suche"
		open location "http://www.ubs.com/3/g?lo=t&qt=" & search & "&utf=€"
		open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		open location "http://www.wipo.int/classifications/nivilo/nice/index.htm?lang=DE#"
		open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
	end if
else
	if langSelect is "Dutch" then
		set sites to {"MWB", "Google", "Wiki.nl", "van Dale", "Woordenboek.eu", "Dict.cc", "LookWayUp", "BabLa", "Vertalen.nu", "Euro-Lex", "IATE", "MS Language Portal", "All Sites"}
		set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
		if chosen is "MWB" then
			open location "http://www.mijnwoordenboek.nl/vertalen.php?woord=" & search
		else if chosen is "Google" then
			#open location "http://translate.google.com/#nl|en|" & search
			open location "http://translate.google.com/?hl=en&eotf=0&sl=nl&q=" & search
		else if chosen is "Wiki.nl" then
			open location "http://nl.wikipedia.org/wiki/" & search
		else if chosen is "van Dale" then
			open location "http://www.vandale.nl/vandale/zoekService.do?selectedDictionary=nn&selectedDictionaryName=Nederlands&searchQuery=" & search
		else if chosen is "Woordenboek.eu" then
			open location "http://www.online-languages.info/_ud2/ud2.php?l1=dutch&disa=1&rad=exact&w=" & search & "&searchword=" & search & "&nllang=Engels"
		else if chosen is "Dict.cc" then
			open location "http://ennl.dict.cc/?s=" & search
		else if chosen is "LookWayUp" then
			open location "http://lookwayup.com/lwu.exe/lwu/toEng?s=d&w=" & search & "&slang=Nld"
		else if chosen is "BabLa" then
			open location "http://nl.bab.la/woordenboek/nederlands-engels/" & search
		else if chosen is "Vertalen.nu" then
			open location "http://www.vertalen.nu/vertaal?vertaal=" & search & "&van=nl&naar=eng"
		else if chosen is "Euro-Lex" then
			open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=nl&RechType=RECH_mot&Submit=Zoeken"
		else if chosen is "IATE" then
			open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
		else if chosen is "MS Language Portal" then
			open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		else if chosen is "All Sites" then
			open location "http://www.mijnwoordenboek.nl/vertalen.php?woord=" & search
			open location "http://translate.google.com/?hl=en&eotf=0&sl=nl&q=" & search
			open location "http://nl.wikipedia.org/wiki/" & search
			open location "http://www.vandale.nl/vandale/zoekService.do?selectedDictionary=nn&selectedDictionaryName=Nederlands&searchQuery=" & search
			open location "http://www.online-languages.info/_ud2/ud2.php?l1=dutch&disa=1&rad=exact&w=" & search & "&searchword=" & search & "&nllang=Engels"
			open location "http://ennl.dict.cc/?s=" & search
			open location "http://lookwayup.com/lwu.exe/lwu/toEng?s=d&w=" & search & "&slang=Nld"
			open location "http://nl.bab.la/woordenboek/nederlands-engels/" & search
			open location "http://www.vertalen.nu/vertaal?vertaal=" & search & "&van=nl&naar=eng"
			open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=nl&RechType=RECH_mot&Submit=Zoeken"
			open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
			open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		end if
	else
		if langSelect is "Google Tools" then
			set sites to {"Site Translation", "Books", "Images", "Blogs", "Finance", "News", "Products", "Trends", "All Sites"}
			set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
			if chosen is "Site Translation" then
				open location "http://translate.google.co.uk/translate?hl=en&sl=fr&tl=en&u=" & search
			else if chosen is "Books" then
				open location "http://www.google.co.uk/search?tbm=bks&tbo=1&q=" & search
			else if chosen is "Images" then
				open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
			else if chosen is "Blogs" then
				open location "http://www.google.co.uk/search?tbm=blg&hl=en&source=hp&biw=&bih=&q=" & search & "&btnG=Search"
			else if chosen is "Finance" then
				open location "http://www.google.co.uk/finance?q=" & search
			else if chosen is "News" then
				open location "http://www.google.co.uk/search?aq=f&hl=en&gl=uk&tbm=nws&btnmeta_news_search=1&q=" & search
			else if chosen is "Products" then
				open location "http://www.google.co.uk/search?q=" & search & "&hl=en&tbm=shop&aq=f&oq=&aq=f"
			else if chosen is "Trends" then
				open location "http://www.google.co.uk/trends?q=" & search
			else if chosen is "All Sites" then
				open location "http://www.google.co.uk/search?tbm=bks&tbo=1&q=" & search
				open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
				open location "http://www.google.co.uk/search?tbm=blg&hl=en&source=hp&biw=&bih=&q=" & search & "&btnG=Search"
				open location "http://www.google.co.uk/finance?q=" & search
				open location "http://www.google.co.uk/search?aq=f&hl=en&gl=uk&tbm=nws&btnmeta_news_search=1&q=" & search
				open location "http://www.google.co.uk/search?q=" & search & "&hl=en&tbm=shop&aq=f&oq=&aq=f"
				open location "http://www.google.co.uk/trends?q=" & search
			end if
		else
			if langSelect is "Reference" then
				set sites to {"Acronyms", "Google Scholar", "Google Images", "OED Online", "JStor", "DOAJ", "ERIC", "InfoMine", "Intute", "Archive.org", "FIS Paedagogik", "BASE", "Scirus", "ScienceDirect", "US Med Library", "All Sites"}
				set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
				if chosen is "Acronyms" then
					open location "http://www.chemie.fu-berlin.de/cgi-bin/acronym?" & search
				else if chosen is "Google Scholar" then
					open location "http://scholar.google.co.uk/scholar?q=" & search & "&hl=en&btnG=Search&as_sdt=1%2C5&as_sdtp=on"
				else if chosen is "Google Images" then
					open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
				else if chosen is "OED Online" then
					open location "http://www.oed.com/search?searchType=dictionary&q=" & search & "&_searchBtn=Search"
				else if chosen is "JStor" then
					open location "http://www.jstor.org/action/doBasicSearch?Query=" & search & "&acc=off&wc=on"
				else if chosen is "DOAJ" then
					open location "http://www.doaj.org/doaj?func=findJournals&uiLanguage=en&hybrid=&query=" & search
				else if chosen is "ERIC" then
					open location "http://eric.ed.gov/ERICWebPortal/search/simpleSearch.jsp?newSearch=true&eric_sortField=&searchtype=keyword&pageSize=10&ERICExtSearch_SearchValue_0=" & search & "&eric_displayStartCount=1&_pageLabel=ERICSearchResult&ERICExtSearch_SearchType_0=kw"
				else if chosen is "InfoMine" then
					open location "http://infomine.ucr.edu/"
				else if chosen is "Intute" then
					open location "http://www.intute.ac.uk/cgi-bin/search.pl?term1=" & search & "&submit=Search&limit=0&subject=All"
				else if chosen is "Archive.org" then
					open location "http://www.archive.org/search.php?query=" & search
				else if chosen is "FIS Paedagogik" then
					open location "http://www.fachportal-paedagogik.de/metasuche/fpp_list.html?feldinhalt1=" & search & "&senden=Suchen&bool1=and&feldname1=Freitext&mtz=20&ckd=yes&art=einfach&searchall=1"
				else if chosen is "BASE" then
					open location "http://www.base-search.net/Search/Results?lookfor=" & search & "&type=all&lem=0&lem=1&refid=dcbasen"
				else if chosen is "Scirus" then
					open location "http://www.scirus.com/srsapp/search?q=" & search & "&t=all&sort=0&g=s"
				else if chosen is "ScienceDirect" then
					open location "http://www.sciencedirect.com/science?_ob=HomePageURL&_method=userHomePage&_btn=Y&_zone=TopNavBar&_origin=quicksearch&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=494fed7897aed3b6989cdd524846b384"
				else if chosen is "US Med Library" then
					open location "http://www.ncbi.nlm.nih.gov/pubmed?term=" & search
				else if chosen is "All Sites" then
					open location "http://www.chemie.fu-berlin.de/cgi-bin/acronym?" & search
					open location "http://scholar.google.co.uk/scholar?q=" & search & "&hl=en&btnG=Search&as_sdt=1%2C5&as_sdtp=on"
					open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
					open location "http://www.oed.com/search?searchType=dictionary&q=" & search & "&_searchBtn=Search"
					open location "http://www.jstor.org/action/doBasicSearch?Query=" & search & "&acc=off&wc=on"
					open location "http://www.doaj.org/doaj?func=findJournals&uiLanguage=en&hybrid=&query=" & search
					open location "http://eric.ed.gov/ERICWebPortal/search/simpleSearch.jsp?newSearch=true&eric_sortField=&searchtype=keyword&pageSize=10&ERICExtSearch_SearchValue_0=" & search & "&eric_displayStartCount=1&_pageLabel=ERICSearchResult&ERICExtSearch_SearchType_0=kw"
					open location "http://infomine.ucr.edu/"
					open location "http://www.intute.ac.uk/cgi-bin/search.pl?term1=" & search & "&submit=Search&limit=0&subject=All"
					open location "http://www.archive.org/search.php?query=" & search
					open location "http://www.fachportal-paedagogik.de/metasuche/fpp_list.html?feldinhalt1=" & search & "&senden=Suchen&bool1=and&feldname1=Freitext&mtz=20&ckd=yes&art=einfach&searchall=1"
					open location "http://www.base-search.net/Search/Results?lookfor=" & search & "&type=all&lem=0&lem=1&refid=dcbasen"
					open location "http://www.scirus.com/srsapp/search?q=" & search & "&t=all&sort=0&g=s"
					open location "http://www.sciencedirect.com/science?_ob=HomePageURL&_method=userHomePage&_btn=Y&_zone=TopNavBar&_origin=quicksearch&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=494fed7897aed3b6989cdd524846b384"
					open location "http://www.ncbi.nlm.nih.gov/pubmed?term=" & search
				end if
			else if langSelect is "Currency Converter" then
				open location "http://www.xe.com/ucc/convert/?Amount=" & search & "&From=EUR&To=GBP"
			end if
		end if
	end if
end if

Can anyone help?

Thanks,

Bowjest

Something like this?

set theString to "länge größe"
set theCommand to "echo urlencode(" & quoted form of theString & ");"
set urlEncodedString to do shell script "php -r " & quoted form of theCommand

Choose from list returns a list, so chosen will never match your comparisons.

Edit your script this way :



set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
if chosen is false then error number -128
set chosen to item 1 of chosen
if chosen is "Linguee" then
	--
end if


Yvan KOENIG (VALLAURIS, France) vendredi 2 septembre 2011 16:51:50

Yvan,

I tried your suggestion (see script below), but now it doesn’t carry out any searches at all:

set search to text returned of (display dialog "Enter Search Query - Joint Terms with \"+\":" default answer "" buttons {"Search", "Cancel"} default button "Search")
set lang to {"German", "Dutch", "Google Tools", "Reference", "Currency Converter"}
set langSelect to (choose from list lang with prompt "Make Selection:" without multiple selections allowed) as text
if langSelect is "German" then
	set sites to {"Linguee", "Woerterbuch.info", "Uni Leipzig", "Langenscheidt", "Google", "Google Images", "Wiki.de", "Lisa", "SAP.com", "Pons", "Dict.cc", "Eur-Lex", "UBS Banking", "MS Language Portal", "WIPO", "IATE", "All Sites"}
	set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
	if chosen is false then error number -128
	set chosen to item 1 of chosen
	if chosen is "Linguee" then
		open location "http://www.linguee.com/english-german/search?sourceoverride=none&source=auto&query=" & search
	else if chosen is "Woerterbuch.info" then
		open location "http://www.woerterbuch.info/?query=" & search & "&s=dict&l=en"
	else if chosen is "Uni Leipzig" then
		open location "http://dict.uni-leipzig.de/index.php?wort=" & search & "&anzahlen=on&fuzzy=on&x=0&y=0"
	else if chosen is "Langenscheidt" then
		open location "http://www.wissen.de/wde/generator/wissen/services/suche/wb/index.html?dictqry=" & search & "&Start=%A0%A0Suchen%A0%A0&dictlang=en"
	else if chosen is "Google" then
		open location "http://translate.google.com/?hl=en&eotf=0&sl=de&q=" & search
	else if chosen is "Google Images" then
		open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
	else if chosen is "Wiki.de" then
		open location "http://de.wikipedia.org/wiki/" & search
	else if chosen is "Lisa" then
		open location "http://lisa-woerterbuch.de/%C3%9Cbersetzung/Deutsch-Englisch/" & search & ".html"
	else if chosen is "SAP.com" then
		open location "http://help.sap.com/saphelp_glossary/de/index.htm"
	else if chosen is "Pons" then
		open location "http://mobile.pons.eu/dict/search/mobile-results/?l=deen&q=" & search
	else if chosen is "Dict.cc" then
		open location "http://www.dict.cc/?s=" & search
	else if chosen is "Eur-Lex" then
		open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=de&RechType=RECH_mot&Submit=Suche"
	else if chosen is "UBS Banking" then
		open location "http://www.ubs.com/3/g?lo=t&qt=" & search & "&utf=€"
	else if chosen is "MS Language Portal" then
		open location "http://www.microsoft.com/Language/en-US/Search.aspx"
	else if chosen is "WIPO" then
		open location "http://www.wipo.int/classifications/nivilo/nice/index.htm?lang=DE#"
	else if chosen is "IATE" then
		open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
	else if chosen is "All Sites" then
		open location "http://www.linguee.com/english-german/search?sourceoverride=none&source=auto&query=" & search
		open location "http://www.woerterbuch.info/?query=" & search & "&s=dict&l=en"
		open location "http://www.wissen.de/wde/generator/wissen/services/suche/wb/index.html?dictqry=" & search & "&Start=%A0%A0Suchen%A0%A0&dictlang=en"
		open location "http://translate.google.com/?hl=en&eotf=0&sl=de&q=" & search
		open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
		open location "http://de.wikipedia.org/wiki/" & search
		open location "http://lisa-woerterbuch.de/%C3%9Cbersetzung/Deutsch-Englisch/" & search & ".html"
		open location "http://help.sap.com/saphelp_glossary/de/index.htm"
		open location "http://mobile.pons.eu/dict/search/mobile-results/?l=deen&q=" & search
		open location "http://www.dict.cc/?s=" & search
		open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=de&RechType=RECH_mot&Submit=Suche"
		open location "http://www.ubs.com/3/g?lo=t&qt=" & search & "&utf=€"
		open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		open location "http://www.wipo.int/classifications/nivilo/nice/index.htm?lang=DE#"
		open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
	end if
else
	if langSelect is "Dutch" then
		set sites to {"MWB", "Google", "Wiki.nl", "van Dale", "Woordenboek.eu", "Dict.cc", "LookWayUp", "BabLa", "Vertalen.nu", "Euro-Lex", "IATE", "MS Language Portal", "All Sites"}
		set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
		if chosen is "MWB" then
			open location "http://www.mijnwoordenboek.nl/vertalen.php?woord=" & search
		else if chosen is "Google" then
			#open location "http://translate.google.com/#nl|en|" & search
			open location "http://translate.google.com/?hl=en&eotf=0&sl=nl&q=" & search
		else if chosen is "Wiki.nl" then
			open location "http://nl.wikipedia.org/wiki/" & search
		else if chosen is "van Dale" then
			open location "http://www.vandale.nl/vandale/zoekService.do?selectedDictionary=nn&selectedDictionaryName=Nederlands&searchQuery=" & search
		else if chosen is "Woordenboek.eu" then
			open location "http://www.online-languages.info/_ud2/ud2.php?l1=dutch&disa=1&rad=exact&w=" & search & "&searchword=" & search & "&nllang=Engels"
		else if chosen is "Dict.cc" then
			open location "http://ennl.dict.cc/?s=" & search
		else if chosen is "LookWayUp" then
			open location "http://lookwayup.com/lwu.exe/lwu/toEng?s=d&w=" & search & "&slang=Nld"
		else if chosen is "BabLa" then
			open location "http://nl.bab.la/woordenboek/nederlands-engels/" & search
		else if chosen is "Vertalen.nu" then
			open location "http://www.vertalen.nu/vertaal?vertaal=" & search & "&van=nl&naar=eng"
		else if chosen is "Euro-Lex" then
			open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=nl&RechType=RECH_mot&Submit=Zoeken"
		else if chosen is "IATE" then
			open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
		else if chosen is "MS Language Portal" then
			open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		else if chosen is "All Sites" then
			open location "http://www.mijnwoordenboek.nl/vertalen.php?woord=" & search
			open location "http://translate.google.com/?hl=en&eotf=0&sl=nl&q=" & search
			open location "http://nl.wikipedia.org/wiki/" & search
			open location "http://www.vandale.nl/vandale/zoekService.do?selectedDictionary=nn&selectedDictionaryName=Nederlands&searchQuery=" & search
			open location "http://www.online-languages.info/_ud2/ud2.php?l1=dutch&disa=1&rad=exact&w=" & search & "&searchword=" & search & "&nllang=Engels"
			open location "http://ennl.dict.cc/?s=" & search
			open location "http://lookwayup.com/lwu.exe/lwu/toEng?s=d&w=" & search & "&slang=Nld"
			open location "http://nl.bab.la/woordenboek/nederlands-engels/" & search
			open location "http://www.vertalen.nu/vertaal?vertaal=" & search & "&van=nl&naar=eng"
			open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=nl&RechType=RECH_mot&Submit=Zoeken"
			open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
			open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		end if
	else
		if langSelect is "Google Tools" then
			set sites to {"Site Translation", "Books", "Images", "Blogs", "Finance", "News", "Products", "Trends", "All Sites"}
			set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
			if chosen is "Site Translation" then
				open location "http://translate.google.co.uk/translate?hl=en&sl=fr&tl=en&u=" & search
			else if chosen is "Books" then
				open location "http://www.google.co.uk/search?tbm=bks&tbo=1&q=" & search
			else if chosen is "Images" then
				open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
			else if chosen is "Blogs" then
				open location "http://www.google.co.uk/search?tbm=blg&hl=en&source=hp&biw=&bih=&q=" & search & "&btnG=Search"
			else if chosen is "Finance" then
				open location "http://www.google.co.uk/finance?q=" & search
			else if chosen is "News" then
				open location "http://www.google.co.uk/search?aq=f&hl=en&gl=uk&tbm=nws&btnmeta_news_search=1&q=" & search
			else if chosen is "Products" then
				open location "http://www.google.co.uk/search?q=" & search & "&hl=en&tbm=shop&aq=f&oq=&aq=f"
			else if chosen is "Trends" then
				open location "http://www.google.co.uk/trends?q=" & search
			else if chosen is "All Sites" then
				open location "http://www.google.co.uk/search?tbm=bks&tbo=1&q=" & search
				open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
				open location "http://www.google.co.uk/search?tbm=blg&hl=en&source=hp&biw=&bih=&q=" & search & "&btnG=Search"
				open location "http://www.google.co.uk/finance?q=" & search
				open location "http://www.google.co.uk/search?aq=f&hl=en&gl=uk&tbm=nws&btnmeta_news_search=1&q=" & search
				open location "http://www.google.co.uk/search?q=" & search & "&hl=en&tbm=shop&aq=f&oq=&aq=f"
				open location "http://www.google.co.uk/trends?q=" & search
			end if
		else
			if langSelect is "Reference" then
				set sites to {"Acronyms", "Google Scholar", "Google Images", "OED Online", "JStor", "DOAJ", "ERIC", "InfoMine", "Intute", "Archive.org", "FIS Paedagogik", "BASE", "Scirus", "ScienceDirect", "US Med Library", "All Sites"}
				set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
				if chosen is "Acronyms" then
					open location "http://www.chemie.fu-berlin.de/cgi-bin/acronym?" & search
				else if chosen is "Google Scholar" then
					open location "http://scholar.google.co.uk/scholar?q=" & search & "&hl=en&btnG=Search&as_sdt=1%2C5&as_sdtp=on"
				else if chosen is "Google Images" then
					open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
				else if chosen is "OED Online" then
					open location "http://www.oed.com/search?searchType=dictionary&q=" & search & "&_searchBtn=Search"
				else if chosen is "JStor" then
					open location "http://www.jstor.org/action/doBasicSearch?Query=" & search & "&acc=off&wc=on"
				else if chosen is "DOAJ" then
					open location "http://www.doaj.org/doaj?func=findJournals&uiLanguage=en&hybrid=&query=" & search
				else if chosen is "ERIC" then
					open location "http://eric.ed.gov/ERICWebPortal/search/simpleSearch.jsp?newSearch=true&eric_sortField=&searchtype=keyword&pageSize=10&ERICExtSearch_SearchValue_0=" & search & "&eric_displayStartCount=1&_pageLabel=ERICSearchResult&ERICExtSearch_SearchType_0=kw"
				else if chosen is "InfoMine" then
					open location "http://infomine.ucr.edu/"
				else if chosen is "Intute" then
					open location "http://www.intute.ac.uk/cgi-bin/search.pl?term1=" & search & "&submit=Search&limit=0&subject=All"
				else if chosen is "Archive.org" then
					open location "http://www.archive.org/search.php?query=" & search
				else if chosen is "FIS Paedagogik" then
					open location "http://www.fachportal-paedagogik.de/metasuche/fpp_list.html?feldinhalt1=" & search & "&senden=Suchen&bool1=and&feldname1=Freitext&mtz=20&ckd=yes&art=einfach&searchall=1"
				else if chosen is "BASE" then
					open location "http://www.base-search.net/Search/Results?lookfor=" & search & "&type=all&lem=0&lem=1&refid=dcbasen"
				else if chosen is "Scirus" then
					open location "http://www.scirus.com/srsapp/search?q=" & search & "&t=all&sort=0&g=s"
				else if chosen is "ScienceDirect" then
					open location "http://www.sciencedirect.com/science?_ob=HomePageURL&_method=userHomePage&_btn=Y&_zone=TopNavBar&_origin=quicksearch&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=494fed7897aed3b6989cdd524846b384"
				else if chosen is "US Med Library" then
					open location "http://www.ncbi.nlm.nih.gov/pubmed?term=" & search
				else if chosen is "All Sites" then
					open location "http://www.chemie.fu-berlin.de/cgi-bin/acronym?" & search
					open location "http://scholar.google.co.uk/scholar?q=" & search & "&hl=en&btnG=Search&as_sdt=1%2C5&as_sdtp=on"
					open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
					open location "http://www.oed.com/search?searchType=dictionary&q=" & search & "&_searchBtn=Search"
					open location "http://www.jstor.org/action/doBasicSearch?Query=" & search & "&acc=off&wc=on"
					open location "http://www.doaj.org/doaj?func=findJournals&uiLanguage=en&hybrid=&query=" & search
					open location "http://eric.ed.gov/ERICWebPortal/search/simpleSearch.jsp?newSearch=true&eric_sortField=&searchtype=keyword&pageSize=10&ERICExtSearch_SearchValue_0=" & search & "&eric_displayStartCount=1&_pageLabel=ERICSearchResult&ERICExtSearch_SearchType_0=kw"
					open location "http://infomine.ucr.edu/"
					open location "http://www.intute.ac.uk/cgi-bin/search.pl?term1=" & search & "&submit=Search&limit=0&subject=All"
					open location "http://www.archive.org/search.php?query=" & search
					open location "http://www.fachportal-paedagogik.de/metasuche/fpp_list.html?feldinhalt1=" & search & "&senden=Suchen&bool1=and&feldname1=Freitext&mtz=20&ckd=yes&art=einfach&searchall=1"
					open location "http://www.base-search.net/Search/Results?lookfor=" & search & "&type=all&lem=0&lem=1&refid=dcbasen"
					open location "http://www.scirus.com/srsapp/search?q=" & search & "&t=all&sort=0&g=s"
					open location "http://www.sciencedirect.com/science?_ob=HomePageURL&_method=userHomePage&_btn=Y&_zone=TopNavBar&_origin=quicksearch&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=494fed7897aed3b6989cdd524846b384"
					open location "http://www.ncbi.nlm.nih.gov/pubmed?term=" & search
				end if
			else if langSelect is "Currency Converter" then
				open location "http://www.xe.com/ucc/convert/?Amount=" & search & "&From=EUR&To=GBP"
			end if
		end if
	end if
end if

Have I put your scriptlet in the wrong place somehow?

Thanks,

Bowjest

omit the as text coercion, because it does (almost) the same as (item 1 of. )

set chosen to (choose from list sites with prompt "Make Selection:") 
if chosen is false then error number -128
set chosen to item 1 of chosen
if chosen is "Linguee" then
   --
end if

without multiple selection is the default setting

Stefan,

Sorry, but making the suggested changes still doesn’t fix things. The script still fails to work at all.

Just to be clear: is adding the suggested scriptlet going to convert ä, ö and ü to HTML equivalents (that is "%E4, %F6 and %FC respectively)?

In other words, I’m trying to achieve the same thing (or similar) to here:

http://www.w3schools.com/TAGS/ref_urlencode.asp

If not, I think we’re talking at cross purposes.

Thanks,

Bowjest

My solution does convert that with the use of PHP above. It converts all those special characters to url encoded strings.

the script works on my machine with this syntax


.
set chosen to (choose from list sites with prompt "Make Selection:")
	if chosen is false then error number -128
	set chosen to item 1 of chosen
	if chosen is "Linguee" then
.

DJ’s snippet (post #2) does the encoding

DJ,

Sorry! I somehow completely missed your post! :slight_smile:

I’ve added that into my script, but it’s still not working for some reason.

The AppleScript events shows that the text is being converted/encoded, but it’s not the code set used at the www3school site and it’s not being pasted to the URL:

tell application "AppleScript Editor"
	display dialog "Enter Search Query - Joint Terms with \"+\":" default answer "" buttons {"Search", "Cancel"} default button "Search"
		--> {text returned:"güter", button returned:"Search"}
	choose from list {"German", "Dutch", "Google Tools", "Reference", "Currency Converter"} with prompt "Make Selection:" without multiple selections allowed
		--> {"German"}
	choose from list {"Linguee", "Woerterbuch.info", "Uni Leipzig", "Langenscheidt", "Google", "Google Images", "Wiki.de", "Lisa", "SAP.com", "Pons", "Dict.cc", "Eur-Lex", "UBS Banking", "MS Language Portal", "WIPO", "IATE", "All Sites"} with prompt "Make Selection:" without multiple selections allowed
		--> {"Uni Leipzig"}
end tell
tell current application
	do shell script "php -r 'echo urlencode('\\''güter'\\'');'"
		--> "g%C3%BCter"
end tell
tell application "AppleScript Editor"
	open location "http://dict.uni-leipzig.de/index.php?wort=g%C3%BCter&anzahlen=on&fuzzy=on&x=0&y=0"
end tell

If I carry out a search at the Uni Leipzig site (see URL above) for the word “güter”, I get the following URL:

http://dict.uni-leipzig.de/index.php?wort=g�ter&anzahlen=on&fuzzy=on&x=0&y=0

Looking at the AppleScript events, however, the value returned is different:

http://dict.uni-leipzig.de/index.php?wort=güter&anzahlen=on&fuzzy=on&x=0&y=0

Regardless, the value is not being pasted to the browser. :frowning:

Here is the amended script. I changed the variable to searchEncoded so that I can clearly see what it is going on with relation to my original script.

The options “Linguee” and “Uni Leipzig” are the only two I have modified, so they are the only two options that will use the scriptlet at the moment.

set search to text returned of (display dialog "Enter Search Query - Joint Terms with \"+\":" default answer "" buttons {"Search", "Cancel"} default button "Search")
set lang to {"German", "Dutch", "Google Tools", "Reference", "Currency Converter"}
set langSelect to (choose from list lang with prompt "Make Selection:" without multiple selections allowed) as text
if langSelect is "German" then
	set sites to {"Linguee", "Woerterbuch.info", "Uni Leipzig", "Langenscheidt", "Google", "Google Images", "Wiki.de", "Lisa", "SAP.com", "Pons", "Dict.cc", "Eur-Lex", "UBS Banking", "MS Language Portal", "WIPO", "IATE", "All Sites"}
	set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
	set theCommand to "echo urlencode(" & quoted form of search & ");"
	set searchEncoded to do shell script "php -r " & quoted form of theCommand
	if chosen is "Linguee" then
		open location "http://www.linguee.com/english-german/search?sourceoverride=none&source=auto&query=" & searchEncoded
	else if chosen is "Woerterbuch.info" then
		open location "http://www.woerterbuch.info/?query=" & search & "&s=dict&l=en"
	else if chosen is "Uni Leipzig" then
		open location "http://dict.uni-leipzig.de/index.php?wort=" & searchEncoded & "&anzahlen=on&fuzzy=on&x=0&y=0"
	else if chosen is "Langenscheidt" then
		open location "http://www.wissen.de/wde/generator/wissen/services/suche/wb/index.html?dictqry=" & search & "&Start=%A0%A0Suchen%A0%A0&dictlang=en"
	else if chosen is "Google" then
		open location "http://translate.google.com/?hl=en&eotf=0&sl=de&q=" & search
	else if chosen is "Google Images" then
		open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
	else if chosen is "Wiki.de" then
		open location "http://de.wikipedia.org/wiki/" & search
	else if chosen is "Lisa" then
		open location "http://lisa-woerterbuch.de/%C3%9Cbersetzung/Deutsch-Englisch/" & search & ".html"
	else if chosen is "SAP.com" then
		open location "http://help.sap.com/saphelp_glossary/de/index.htm"
	else if chosen is "Pons" then
		open location "http://mobile.pons.eu/dict/search/mobile-results/?l=deen&q=" & search
	else if chosen is "Dict.cc" then
		open location "http://www.dict.cc/?s=" & search
	else if chosen is "Eur-Lex" then
		open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=de&RechType=RECH_mot&Submit=Suche"
	else if chosen is "UBS Banking" then
		open location "http://www.ubs.com/3/g?lo=t&qt=" & search & "&utf=€"
	else if chosen is "MS Language Portal" then
		open location "http://www.microsoft.com/Language/en-US/Search.aspx"
	else if chosen is "WIPO" then
		open location "http://www.wipo.int/classifications/nivilo/nice/index.htm?lang=DE#"
	else if chosen is "IATE" then
		open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
	else if chosen is "All Sites" then
		open location "http://www.linguee.com/english-german/search?sourceoverride=none&source=auto&query=" & search
		open location "http://www.woerterbuch.info/?query=" & search & "&s=dict&l=en"
		open location "http://www.wissen.de/wde/generator/wissen/services/suche/wb/index.html?dictqry=" & search & "&Start=%A0%A0Suchen%A0%A0&dictlang=en"
		open location "http://translate.google.com/?hl=en&eotf=0&sl=de&q=" & search
		open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
		open location "http://de.wikipedia.org/wiki/" & search
		open location "http://lisa-woerterbuch.de/%C3%9Cbersetzung/Deutsch-Englisch/" & search & ".html"
		open location "http://help.sap.com/saphelp_glossary/de/index.htm"
		open location "http://mobile.pons.eu/dict/search/mobile-results/?l=deen&q=" & search
		open location "http://www.dict.cc/?s=" & search
		open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=de&RechType=RECH_mot&Submit=Suche"
		open location "http://www.ubs.com/3/g?lo=t&qt=" & search & "&utf=€"
		open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		open location "http://www.wipo.int/classifications/nivilo/nice/index.htm?lang=DE#"
		open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
	end if
else
	if langSelect is "Dutch" then
		set sites to {"MWB", "Google", "Wiki.nl", "van Dale", "Woordenboek.eu", "Dict.cc", "LookWayUp", "BabLa", "Vertalen.nu", "Euro-Lex", "IATE", "MS Language Portal", "All Sites"}
		set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
		if chosen is "MWB" then
			open location "http://www.mijnwoordenboek.nl/vertalen.php?woord=" & search
		else if chosen is "Google" then
			#open location "http://translate.google.com/#nl|en|" & search
			open location "http://translate.google.com/?hl=en&eotf=0&sl=nl&q=" & search
		else if chosen is "Wiki.nl" then
			open location "http://nl.wikipedia.org/wiki/" & search
		else if chosen is "van Dale" then
			open location "http://www.vandale.nl/vandale/zoekService.do?selectedDictionary=nn&selectedDictionaryName=Nederlands&searchQuery=" & search
		else if chosen is "Woordenboek.eu" then
			open location "http://www.online-languages.info/_ud2/ud2.php?l1=dutch&disa=1&rad=exact&w=" & search & "&searchword=" & search & "&nllang=Engels"
		else if chosen is "Dict.cc" then
			open location "http://ennl.dict.cc/?s=" & search
		else if chosen is "LookWayUp" then
			open location "http://lookwayup.com/lwu.exe/lwu/toEng?s=d&w=" & search & "&slang=Nld"
		else if chosen is "BabLa" then
			open location "http://nl.bab.la/woordenboek/nederlands-engels/" & search
		else if chosen is "Vertalen.nu" then
			open location "http://www.vertalen.nu/vertaal?vertaal=" & search & "&van=nl&naar=eng"
		else if chosen is "Euro-Lex" then
			open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=nl&RechType=RECH_mot&Submit=Zoeken"
		else if chosen is "IATE" then
			open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
		else if chosen is "MS Language Portal" then
			open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		else if chosen is "All Sites" then
			open location "http://www.mijnwoordenboek.nl/vertalen.php?woord=" & search
			open location "http://translate.google.com/?hl=en&eotf=0&sl=nl&q=" & search
			open location "http://nl.wikipedia.org/wiki/" & search
			open location "http://www.vandale.nl/vandale/zoekService.do?selectedDictionary=nn&selectedDictionaryName=Nederlands&searchQuery=" & search
			open location "http://www.online-languages.info/_ud2/ud2.php?l1=dutch&disa=1&rad=exact&w=" & search & "&searchword=" & search & "&nllang=Engels"
			open location "http://ennl.dict.cc/?s=" & search
			open location "http://lookwayup.com/lwu.exe/lwu/toEng?s=d&w=" & search & "&slang=Nld"
			open location "http://nl.bab.la/woordenboek/nederlands-engels/" & search
			open location "http://www.vertalen.nu/vertaal?vertaal=" & search & "&van=nl&naar=eng"
			open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=nl&RechType=RECH_mot&Submit=Zoeken"
			open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
			open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		end if
	else
		if langSelect is "Google Tools" then
			set sites to {"Site Translation", "Books", "Images", "Blogs", "Finance", "News", "Products", "Trends", "All Sites"}
			set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
			if chosen is "Site Translation" then
				open location "http://translate.google.co.uk/translate?hl=en&sl=fr&tl=en&u=" & search
			else if chosen is "Books" then
				open location "http://www.google.co.uk/search?tbm=bks&tbo=1&q=" & search
			else if chosen is "Images" then
				open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
			else if chosen is "Blogs" then
				open location "http://www.google.co.uk/search?tbm=blg&hl=en&source=hp&biw=&bih=&q=" & search & "&btnG=Search"
			else if chosen is "Finance" then
				open location "http://www.google.co.uk/finance?q=" & search
			else if chosen is "News" then
				open location "http://www.google.co.uk/search?aq=f&hl=en&gl=uk&tbm=nws&btnmeta_news_search=1&q=" & search
			else if chosen is "Products" then
				open location "http://www.google.co.uk/search?q=" & search & "&hl=en&tbm=shop&aq=f&oq=&aq=f"
			else if chosen is "Trends" then
				open location "http://www.google.co.uk/trends?q=" & search
			else if chosen is "All Sites" then
				open location "http://www.google.co.uk/search?tbm=bks&tbo=1&q=" & search
				open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
				open location "http://www.google.co.uk/search?tbm=blg&hl=en&source=hp&biw=&bih=&q=" & search & "&btnG=Search"
				open location "http://www.google.co.uk/finance?q=" & search
				open location "http://www.google.co.uk/search?aq=f&hl=en&gl=uk&tbm=nws&btnmeta_news_search=1&q=" & search
				open location "http://www.google.co.uk/search?q=" & search & "&hl=en&tbm=shop&aq=f&oq=&aq=f"
				open location "http://www.google.co.uk/trends?q=" & search
			end if
		else
			if langSelect is "Reference" then
				set sites to {"Acronyms", "Google Scholar", "Google Images", "OED Online", "JStor", "DOAJ", "ERIC", "InfoMine", "Intute", "Archive.org", "FIS Paedagogik", "BASE", "Scirus", "ScienceDirect", "US Med Library", "All Sites"}
				set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
				if chosen is "Acronyms" then
					open location "http://www.chemie.fu-berlin.de/cgi-bin/acronym?" & search
				else if chosen is "Google Scholar" then
					open location "http://scholar.google.co.uk/scholar?q=" & search & "&hl=en&btnG=Search&as_sdt=1%2C5&as_sdtp=on"
				else if chosen is "Google Images" then
					open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
				else if chosen is "OED Online" then
					open location "http://www.oed.com/search?searchType=dictionary&q=" & search & "&_searchBtn=Search"
				else if chosen is "JStor" then
					open location "http://www.jstor.org/action/doBasicSearch?Query=" & search & "&acc=off&wc=on"
				else if chosen is "DOAJ" then
					open location "http://www.doaj.org/doaj?func=findJournals&uiLanguage=en&hybrid=&query=" & search
				else if chosen is "ERIC" then
					open location "http://eric.ed.gov/ERICWebPortal/search/simpleSearch.jsp?newSearch=true&eric_sortField=&searchtype=keyword&pageSize=10&ERICExtSearch_SearchValue_0=" & search & "&eric_displayStartCount=1&_pageLabel=ERICSearchResult&ERICExtSearch_SearchType_0=kw"
				else if chosen is "InfoMine" then
					open location "http://infomine.ucr.edu/"
				else if chosen is "Intute" then
					open location "http://www.intute.ac.uk/cgi-bin/search.pl?term1=" & search & "&submit=Search&limit=0&subject=All"
				else if chosen is "Archive.org" then
					open location "http://www.archive.org/search.php?query=" & search
				else if chosen is "FIS Paedagogik" then
					open location "http://www.fachportal-paedagogik.de/metasuche/fpp_list.html?feldinhalt1=" & search & "&senden=Suchen&bool1=and&feldname1=Freitext&mtz=20&ckd=yes&art=einfach&searchall=1"
				else if chosen is "BASE" then
					open location "http://www.base-search.net/Search/Results?lookfor=" & search & "&type=all&lem=0&lem=1&refid=dcbasen"
				else if chosen is "Scirus" then
					open location "http://www.scirus.com/srsapp/search?q=" & search & "&t=all&sort=0&g=s"
				else if chosen is "ScienceDirect" then
					open location "http://www.sciencedirect.com/science?_ob=HomePageURL&_method=userHomePage&_btn=Y&_zone=TopNavBar&_origin=quicksearch&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=494fed7897aed3b6989cdd524846b384"
				else if chosen is "US Med Library" then
					open location "http://www.ncbi.nlm.nih.gov/pubmed?term=" & search
				else if chosen is "All Sites" then
					open location "http://www.chemie.fu-berlin.de/cgi-bin/acronym?" & search
					open location "http://scholar.google.co.uk/scholar?q=" & search & "&hl=en&btnG=Search&as_sdt=1%2C5&as_sdtp=on"
					open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
					open location "http://www.oed.com/search?searchType=dictionary&q=" & search & "&_searchBtn=Search"
					open location "http://www.jstor.org/action/doBasicSearch?Query=" & search & "&acc=off&wc=on"
					open location "http://www.doaj.org/doaj?func=findJournals&uiLanguage=en&hybrid=&query=" & search
					open location "http://eric.ed.gov/ERICWebPortal/search/simpleSearch.jsp?newSearch=true&eric_sortField=&searchtype=keyword&pageSize=10&ERICExtSearch_SearchValue_0=" & search & "&eric_displayStartCount=1&_pageLabel=ERICSearchResult&ERICExtSearch_SearchType_0=kw"
					open location "http://infomine.ucr.edu/"
					open location "http://www.intute.ac.uk/cgi-bin/search.pl?term1=" & search & "&submit=Search&limit=0&subject=All"
					open location "http://www.archive.org/search.php?query=" & search
					open location "http://www.fachportal-paedagogik.de/metasuche/fpp_list.html?feldinhalt1=" & search & "&senden=Suchen&bool1=and&feldname1=Freitext&mtz=20&ckd=yes&art=einfach&searchall=1"
					open location "http://www.base-search.net/Search/Results?lookfor=" & search & "&type=all&lem=0&lem=1&refid=dcbasen"
					open location "http://www.scirus.com/srsapp/search?q=" & search & "&t=all&sort=0&g=s"
					open location "http://www.sciencedirect.com/science?_ob=HomePageURL&_method=userHomePage&_btn=Y&_zone=TopNavBar&_origin=quicksearch&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=494fed7897aed3b6989cdd524846b384"
					open location "http://www.ncbi.nlm.nih.gov/pubmed?term=" & search
				end if
			else if langSelect is "Currency Converter" then
				open location "http://www.xe.com/ucc/convert/?Amount=" & search & "&From=EUR&To=GBP"
			end if
		end if
	end if
end if

Can anyone see where I’ve gone wrong?

Thanks again, DJ, for your help. I’m sorry I didn’t see your post before.

Bowjest

DJ,

I found this other post of yours:

http://macscripter.net/viewtopic.php?id=36213

would “rawurlencode” make a difference?

I haven’t been able to get it to work, but I also don’t know what I’m doing. :slight_smile:

No makes no difference. I found the error but don’t have a solution (yet). I can look into it monday or when lucky someone else can help you. Sorry for the hold up.

DJ,

Thanks, Monday’s fine. There’s no hurry. I appreciate your help.

Have a good weekend,

Bowjest

Well I promised to give you a feedback and I already founded the problem but didn’t had a solution.

What went wrong is that the do shell script is utf-8 encoded and that your website ‘linguee’ is iso-8859 encoded. So what I needed to was converting lange to iso-8859 enoded and do then the urlencoding. Modern websites are utf-8 encoded and don’t have this problem and you can send the way in my previous posts. So for linguee website you need something like below and for google you’ll need the method I posted above.


set searchEncoded to do shell script "/bin/echo -n " & quoted form of "länge" & " | iconv -f utf8 -t iso-8859-1 | php -r '$handle = fopen (\"php://stdin\",\"r\"); $line = fgets($handle);echo urlencode($line);'"

open location "http://www.linguee.com/english-german/search?sourceoverride=none&source=auto&query=" & searchEncoded

Thanks, DJ. I really appreciate it. I’m sorry to put you to so much trouble.

I’ll see how best I can wedge things in and hopefully get the problem sites to play ball.

Bedankt, hoor!

Bowjest

It is no problem at all. You’ve only showed me that the urlencoding I normally use is not bug free.

Then of course you can implement this several ways but the easiest way will be to make the conversion as last as possible with the help of two handlers.

set search to "länge"
open location "http://www.woerterbuch.info/?query=" & ISO8859URLEncoding(search) & "&s=dict&l=en"
open location "http://translate.google.com/?hl=en&eotf=0&sl=nl&q=" & UTF8URLEncoding(search)

on ISO8859URLEncoding(search)
	return do shell script "/bin/echo -n " & quoted form of search & " | iconv -f utf8 -t iso-8859-1 | php -r '$handle = fopen (\"php://stdin\",\"r\"); $line = fgets($handle);echo urlencode($line);'"
end ISO8859URLEncoding

on UTF8URLEncoding(search)
	set theCommand to "echo urlencode(" & quoted form of search & ");"
	return do shell script "php -r " & quoted form of theCommand
end UTF8URLEncoding

Good to know. Thank you. I’ll make sure I file them both in a safe place!

Just for clarity, here is the final version of the script (for now at least):

-- ------------------------------------------------------------
-- Dialog box into which search queries are entered
-- ------------------------------------------------------------
set search to text returned of (display dialog "Enter Search Query - Joint Terms with \"+\":" default answer "" buttons {"Search", "Cancel"} default button "Search")

-- ------------------------------------------------------------
-- Sets language/tool selection options
-- ------------------------------------------------------------
set lang to {"German", "Dutch", "Google Tools", "Reference", "Currency Converter"}

-- ------------------------------------------------------------
-- Allows for language/tool selection
-- ------------------------------------------------------------
set langSelect to (choose from list lang with prompt "Make Selection:" without multiple selections allowed) as text

-- ------------------------------------------------------------
-- Changes encoding from UTF-8 to predicated ISO-8859-1
-- ------------------------------------------------------------
set searchEncoded to do shell script "/bin/echo -n " & quoted form of search & " | iconv -f utf8 -t iso-8859-1 | php -r '$handle = fopen (\"php://stdin\",\"r\"); $line = fgets($handle);echo urlencode($line);'"

-- ------------------------------------------------------------
-- Begin of if-statements for search engines choices
-- ------------------------------------------------------------
if langSelect is "German" then
	set sites to {"Linguee", "Woerterbuch.info", "Langenscheidt", "Uni Leipzig", "Redensarten", "Google", "Google Images", "Wiki.de", "Lisa", "SAP.com", "Pons", "Dict.cc", "Eur-Lex", "UBS Banking", "MS Language Portal", "WIPO", "IATE", "All Sites"}
	set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
	if chosen is "Linguee" then
		open location "http://www.linguee.com/english-german/search?sourceoverride=none&source=auto&query=" & searchEncoded
	else if chosen is "Woerterbuch.info" then
		open location "http://www.woerterbuch.info/?query=" & search & "&s=dict&l=en"
	else if chosen is "Langenscheidt" then
		open location "http://www.wissen.de/wde/generator/wissen/services/suche/wb/index.html?dictqry=" & searchEncoded & "&Start=%A0%A0Suchen%A0%A0&dictlang=en"
	else if chosen is "Uni Leipzig" then
		open location "http://dict.uni-leipzig.de/index.php?wort=" & searchEncoded & "&anzahlen=on&fuzzy=on&x=0&y=0"
	else if chosen is "Redensarten" then
		open location "http://www.redensarten-index.de/suche.php?suchbegriff=" & search & "&bool=relevanz&suchspalte[]=rart_ou&suchspalte[]=bsp_ou"
	else if chosen is "Google" then
		open location "http://translate.google.com/?hl=en&eotf=0&sl=de&q=" & search
	else if chosen is "Google Images" then
		open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
	else if chosen is "Wiki.de" then
		open location "http://de.wikipedia.org/wiki/" & search
	else if chosen is "Lisa" then
		open location "http://lisa-woerterbuch.de/%C3%9Cbersetzung/Deutsch-Englisch/" & search & ".html"
	else if chosen is "SAP.com" then
		open location "http://help.sap.com/saphelp_glossary/de/index.htm"
	else if chosen is "Pons" then
		open location "http://mobile.pons.eu/dict/search/mobile-results/?l=deen&q=" & search
	else if chosen is "Dict.cc" then
		open location "http://www.dict.cc/?s=" & search
	else if chosen is "Eur-Lex" then
		open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=de&RechType=RECH_mot&Submit=Suche"
	else if chosen is "UBS Banking" then
		open location "http://www.ubs.com/3/g?lo=t&qt=" & search & "&utf=€"
	else if chosen is "MS Language Portal" then
		open location "http://www.microsoft.com/Language/en-US/Search.aspx"
	else if chosen is "WIPO" then
		open location "http://www.wipo.int/classifications/nivilo/nice/index.htm?lang=DE#"
	else if chosen is "IATE" then
		open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
	else if chosen is "All Sites" then
		open location "http://www.linguee.com/english-german/search?sourceoverride=none&source=auto&query=" & searchEncoded
		open location "http://www.woerterbuch.info/?query=" & search & "&s=dict&l=en"
		open location "http://www.wissen.de/wde/generator/wissen/services/suche/wb/index.html?dictqry=" & searchEncoded & "&Start=%A0%A0Suchen%A0%A0&dictlang=en"
		open location "http://www.redensarten-index.de/suche.php?suchbegriff=" & search & "&bool=relevanz&suchspalte[]=rart_ou&suchspalte[]=bsp_ou"
		open location "http://dict.uni-leipzig.de/index.php?wort=" & searchEncoded & "&anzahlen=on&fuzzy=on&x=0&y=0"
		open location "http://translate.google.com/?hl=en&eotf=0&sl=de&q=" & search
		open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
		open location "http://de.wikipedia.org/wiki/" & search
		open location "http://lisa-woerterbuch.de/%C3%9Cbersetzung/Deutsch-Englisch/" & search & ".html"
		open location "http://help.sap.com/saphelp_glossary/de/index.htm"
		open location "http://mobile.pons.eu/dict/search/mobile-results/?l=deen&q=" & search
		open location "http://www.dict.cc/?s=" & search
		open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=de&RechType=RECH_mot&Submit=Suche"
		open location "http://www.ubs.com/3/g?lo=t&qt=" & search & "&utf=€"
		open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		open location "http://www.wipo.int/classifications/nivilo/nice/index.htm?lang=DE#"
		open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
	end if
else
	if langSelect is "Dutch" then
		set sites to {"MWB", "Google", "Wiki.nl", "van Dale", "Woordenboek.eu", "Dict.cc", "LookWayUp", "BabLa", "Vertalen.nu", "Euro-Lex", "IATE", "MS Language Portal", "All Sites"}
		set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
		if chosen is "MWB" then
			open location "http://www.mijnwoordenboek.nl/vertalen.php?woord=" & search
		else if chosen is "Google" then
			#open location "http://translate.google.com/#nl|en|" & search
			open location "http://translate.google.com/?hl=en&eotf=0&sl=nl&q=" & search
		else if chosen is "Wiki.nl" then
			open location "http://nl.wikipedia.org/wiki/" & search
		else if chosen is "van Dale" then
			open location "http://www.vandale.nl/vandale/zoekService.do?selectedDictionary=nn&selectedDictionaryName=Nederlands&searchQuery=" & search
		else if chosen is "Woordenboek.eu" then
			open location "http://www.online-languages.info/_ud2/ud2.php?l1=dutch&disa=1&rad=exact&w=" & search & "&searchword=" & search & "&nllang=Engels"
		else if chosen is "Dict.cc" then
			open location "http://ennl.dict.cc/?s=" & search
		else if chosen is "LookWayUp" then
			open location "http://lookwayup.com/lwu.exe/lwu/toEng?s=d&w=" & search & "&slang=Nld"
		else if chosen is "BabLa" then
			open location "http://nl.bab.la/woordenboek/nederlands-engels/" & search
		else if chosen is "Vertalen.nu" then
			open location "http://www.vertalen.nu/vertaal?vertaal=" & search & "&van=nl&naar=eng"
		else if chosen is "Euro-Lex" then
			open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=nl&RechType=RECH_mot&Submit=Zoeken"
		else if chosen is "IATE" then
			open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
		else if chosen is "MS Language Portal" then
			open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		else if chosen is "All Sites" then
			open location "http://www.mijnwoordenboek.nl/vertalen.php?woord=" & search
			open location "http://translate.google.com/?hl=en&eotf=0&sl=nl&q=" & search
			open location "http://nl.wikipedia.org/wiki/" & search
			open location "http://www.vandale.nl/vandale/zoekService.do?selectedDictionary=nn&selectedDictionaryName=Nederlands&searchQuery=" & search
			open location "http://www.online-languages.info/_ud2/ud2.php?l1=dutch&disa=1&rad=exact&w=" & search & "&searchword=" & search & "&nllang=Engels"
			open location "http://ennl.dict.cc/?s=" & search
			open location "http://lookwayup.com/lwu.exe/lwu/toEng?s=d&w=" & search & "&slang=Nld"
			open location "http://nl.bab.la/woordenboek/nederlands-engels/" & search
			open location "http://www.vertalen.nu/vertaal?vertaal=" & search & "&van=nl&naar=eng"
			open location "http://eur-lex.europa.eu/Result.do?arg0=" & search & "&arg1=" & search & "&arg2=&titre=titreettexte&chlang=nl&RechType=RECH_mot&Submit=Zoeken"
			open location "http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load"
			open location "http://www.microsoft.com/Language/en-US/Search.aspx"
		end if
	else
		if langSelect is "Google Tools" then
			set sites to {"Site Translation", "Books", "Images", "Blogs", "Finance", "News", "Products", "Trends", "All Sites"}
			set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
			if chosen is "Site Translation" then
				open location "http://translate.google.co.uk/translate?hl=en&sl=fr&tl=en&u=" & search
			else if chosen is "Books" then
				open location "http://www.google.co.uk/search?tbm=bks&tbo=1&q=" & search
			else if chosen is "Images" then
				open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
			else if chosen is "Blogs" then
				open location "http://www.google.co.uk/search?tbm=blg&hl=en&source=hp&biw=&bih=&q=" & search & "&btnG=Search"
			else if chosen is "Finance" then
				open location "http://www.google.co.uk/finance?q=" & search
			else if chosen is "News" then
				open location "http://www.google.co.uk/search?aq=f&hl=en&gl=uk&tbm=nws&btnmeta_news_search=1&q=" & search
			else if chosen is "Products" then
				open location "http://www.google.co.uk/search?q=" & search & "&hl=en&tbm=shop&aq=f&oq=&aq=f"
			else if chosen is "Trends" then
				open location "http://www.google.co.uk/trends?q=" & search
			else if chosen is "All Sites" then
				open location "http://www.google.co.uk/search?tbm=bks&tbo=1&q=" & search
				open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
				open location "http://www.google.co.uk/search?tbm=blg&hl=en&source=hp&biw=&bih=&q=" & search & "&btnG=Search"
				open location "http://www.google.co.uk/finance?q=" & search
				open location "http://www.google.co.uk/search?aq=f&hl=en&gl=uk&tbm=nws&btnmeta_news_search=1&q=" & search
				open location "http://www.google.co.uk/search?q=" & search & "&hl=en&tbm=shop&aq=f&oq=&aq=f"
				open location "http://www.google.co.uk/trends?q=" & search
			end if
		else
			if langSelect is "Reference" then
				set sites to {"Acronyms", "Google Scholar", "Google Images", "OED Online", "JStor", "DOAJ", "ERIC", "InfoMine", "Intute", "Archive.org", "FIS Paedagogik", "BASE", "Scirus", "ScienceDirect", "US Med Library", "All Sites"}
				set chosen to (choose from list sites with prompt "Make Selection:" without multiple selections allowed) as text
				if chosen is "Acronyms" then
					open location "http://www.chemie.fu-berlin.de/cgi-bin/acronym?" & search
				else if chosen is "Google Scholar" then
					open location "http://scholar.google.co.uk/scholar?q=" & search & "&hl=en&btnG=Search&as_sdt=1%2C5&as_sdtp=on"
				else if chosen is "Google Images" then
					open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
				else if chosen is "OED Online" then
					open location "http://www.oed.com/search?searchType=dictionary&q=" & search & "&_searchBtn=Search"
				else if chosen is "JStor" then
					open location "http://www.jstor.org/action/doBasicSearch?Query=" & search & "&acc=off&wc=on"
				else if chosen is "DOAJ" then
					open location "http://www.doaj.org/doaj?func=findJournals&uiLanguage=en&hybrid=&query=" & search
				else if chosen is "ERIC" then
					open location "http://eric.ed.gov/ERICWebPortal/search/simpleSearch.jsp?newSearch=true&eric_sortField=&searchtype=keyword&pageSize=10&ERICExtSearch_SearchValue_0=" & search & "&eric_displayStartCount=1&_pageLabel=ERICSearchResult&ERICExtSearch_SearchType_0=kw"
				else if chosen is "InfoMine" then
					open location "http://infomine.ucr.edu/"
				else if chosen is "Intute" then
					open location "http://www.intute.ac.uk/cgi-bin/search.pl?term1=" & search & "&submit=Search&limit=0&subject=All"
				else if chosen is "Archive.org" then
					open location "http://www.archive.org/search.php?query=" & search
				else if chosen is "FIS Paedagogik" then
					open location "http://www.fachportal-paedagogik.de/metasuche/fpp_list.html?feldinhalt1=" & search & "&senden=Suchen&bool1=and&feldname1=Freitext&mtz=20&ckd=yes&art=einfach&searchall=1"
				else if chosen is "BASE" then
					open location "http://www.base-search.net/Search/Results?lookfor=" & search & "&type=all&lem=0&lem=1&refid=dcbasen"
				else if chosen is "Scirus" then
					open location "http://www.scirus.com/srsapp/search?q=" & search & "&t=all&sort=0&g=s"
				else if chosen is "ScienceDirect" then
					open location "http://www.sciencedirect.com/science?_ob=HomePageURL&_method=userHomePage&_btn=Y&_zone=TopNavBar&_origin=quicksearch&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=494fed7897aed3b6989cdd524846b384"
				else if chosen is "US Med Library" then
					open location "http://www.ncbi.nlm.nih.gov/pubmed?term=" & search
				else if chosen is "All Sites" then
					open location "http://www.chemie.fu-berlin.de/cgi-bin/acronym?" & search
					open location "http://scholar.google.co.uk/scholar?q=" & search & "&hl=en&btnG=Search&as_sdt=1%2C5&as_sdtp=on"
					open location "http://images.google.co.uk/search?tbm=isch&hl=en&source=hp&biw=1440&bih=723&q=" & search & "&gbv=2&oq=" & search & "&aq=f&aqi=g10&aql=&gs_sm=e&gs_upl=1760l3034l0l4125l6l6l0l0l0l0l183l767l1.5l6l0"
					open location "http://www.oed.com/search?searchType=dictionary&q=" & search & "&_searchBtn=Search"
					open location "http://www.jstor.org/action/doBasicSearch?Query=" & search & "&acc=off&wc=on"
					open location "http://www.doaj.org/doaj?func=findJournals&uiLanguage=en&hybrid=&query=" & search
					open location "http://eric.ed.gov/ERICWebPortal/search/simpleSearch.jsp?newSearch=true&eric_sortField=&searchtype=keyword&pageSize=10&ERICExtSearch_SearchValue_0=" & search & "&eric_displayStartCount=1&_pageLabel=ERICSearchResult&ERICExtSearch_SearchType_0=kw"
					open location "http://infomine.ucr.edu/"
					open location "http://www.intute.ac.uk/cgi-bin/search.pl?term1=" & search & "&submit=Search&limit=0&subject=All"
					open location "http://www.archive.org/search.php?query=" & search
					open location "http://www.fachportal-paedagogik.de/metasuche/fpp_list.html?feldinhalt1=" & search & "&senden=Suchen&bool1=and&feldname1=Freitext&mtz=20&ckd=yes&art=einfach&searchall=1"
					open location "http://www.base-search.net/Search/Results?lookfor=" & search & "&type=all&lem=0&lem=1&refid=dcbasen"
					open location "http://www.scirus.com/srsapp/search?q=" & search & "&t=all&sort=0&g=s"
					open location "http://www.sciencedirect.com/science?_ob=HomePageURL&_method=userHomePage&_btn=Y&_zone=TopNavBar&_origin=quicksearch&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=494fed7897aed3b6989cdd524846b384"
					open location "http://www.ncbi.nlm.nih.gov/pubmed?term=" & search
				end if
			else if langSelect is "Currency Converter" then
				open location "http://www.xe.com/ucc/convert/?Amount=" & search & "&From=EUR&To=GBP"
			end if
		end if
	end if
end if

Everything seems to be working great. Thanks again, DJ!

There’s just one small obstacle I’d like to overcome, if possible.

A couple of the German sites I include in the script don’t have search strings as such that I can plug a variable into (that is, when you load a search query on the site, the URL doesn’t change to show the search syntax, so I can’t include a direct search string in the script).

One of them, the Microsoft site, does, however, place an active cursor in the search field. Is there anyway to get AppleScript to paste the search term entered at the start of the script into such an active field?

http://www.microsoft.com/Language/en-US/Search.aspx

And by extension, for those sites where I presently just load the page (for example: http://iate.europa.eu/iatediff/SearchByQueryLoad.do?method=load) is it possible to put focus on the search field and insert the search term?

Thanks,

Will