Can anyone give me an applescript where you can type text in english and it will give the spanish results in a dialog box? And have it get the results from google translate. And maybe even when you can type in spanish text and it will give english results.
Hello,
try this:
property theURL : "http://translate.google.com/?"
property agent : "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; fr; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3"
property charset : "UTF-8"
property header : "Charset:" & space & charset
set langBtns to {"English", "Spanish"}
set outputLang to {"en", "es"}
-- --------------------------------------------
-- Values subject to change.
-- --------------------------------------------
set snipOpen to "<input type=hidden name=gtrans value=\""
set snipClose to "\"><div id=sug_exp>"
--
set dflt_txt to "Dear Sir,
If a member misbehaves, the IP.Board warning panel allows moderators to apply a number of sanctions, such as requiring approval of future posts, suspending them for a specified time, or even banning them, as well as leave notes for future reference."
-- --------------------------------------------
-- HANDLERS
-- --------------------------------------------
on Split(txt, del)
set {otid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, del}
set txt to text items of txt
set AppleScript's text item delimiters to otid
return txt
end Split
on substitute(s, r, t)
set s to s as list
set r to r as list
set t to t as text
set tid to AppleScript's text item delimiters
repeat with i from 1 to count s
set AppleScript's text item delimiters to s's item i
set t to t's text items
set AppleScript's text item delimiters to r's item i
set t to t as text
end repeat
set AppleScript's text item delimiters to tid
return t
end substitute
-- --------------------------------------------
-- ROUTINE
-- --------------------------------------------
set dialResult to (display dialog "Enter the text to translate to." with title "Translate." default answer dflt_txt buttons {"Cancel"} & langBtns default button 3)
repeat with i from 1 to (count langBtns)
if button returned of dialResult is langBtns's item i then
set chosenLang to outputLang's item i
exit repeat
end if
end repeat
set escapedText to do shell script "/usr/bin/perl -e 'use URI::Escape; print uri_escape(\"" & text returned of dialResult & "\")'"
set TranslatedText to do shell script "/usr/bin/curl" & space & ¬
"-A" & space & quoted form of agent & space & ¬
"-H" & space & quoted form of header & space & ¬
"-d" & space & quoted form of ("&ie=" & charset & "&oe=" & charset & "&langpair=auto|" & chosenLang & "&text=" & escapedText) & space & ¬
quoted form of theURL & space & ¬
"| perl -Mencoding=utf8 -MHTML::Entities -lne 'print decode_entities($_)'"
if TranslatedText = "" then return
try
set txt to Split(TranslatedText, snipOpen)'s item 2
set txt to Split(txt, snipClose)'s item 1
set txt to substitute({"<br>"}, {return}, txt)
display dialog txt with title "Result" buttons {"OK"} default button 1
-- set the chipboard to txt
on error errTxt number errNum
display dialog errTxt with title "Error# " & errNum buttons {"Cancel", "OK"} default button 2 with icon 0 giving up after 0
end try
-- --------------------------------------------
-- LANGUAGES SUPPORTED BY GOOGLE TRANSLATE
-- --------------------------------------------
-- {"Afrikaans", "Albanian", "Arabic", "Belarusian", "Bulgarian", "Catalan", "Chinese", "Croatian", "Czech", "Danish", "Dutch", "English", "Estonian", "Filipino", "Finnish", "French", "Galician", "German", "Greek", "Hebrew", "Hindi", "Hungarian", "Icelandic", "Indonesian", "Irish", "Italian", "Japanese", "Korean", "Latvian", "Lithuanian", "Macedonian", "Malay", "Maltese", "Norwegian", "Persian", "Polish", "Portuguese", "Romanian", "Russian", "Serbian", "Slovak", "Slovenian", "Spanish", "Swahili", "Swedish", "Thai", "Turkish", "Ukrainian", "Vietnamese", "Welsh", "Yiddish"}
-- {"af", "sq", "ar", "be", "bg", "ca", "zh-CN", "hr", "cs", "da", "nl", "en", "et", "tl", "fi", "fr", "gl", "de", "el", "iw", "hi", "hu", "is", "id", "ga", "it", "ja", "ko", "lv", "lt", "mk", "ms", "mt", "no", "fa", "pl", "pt", "ro", "ru", "sr", "sk", "sl", "es", "sw", "sv", "th", "tr", "uk", "vi", "cy", "yi"}
Wow thats awesome thanks.
But how can I make it so that instead of ending the script when you press OK it will return to the first dialog and then whenever you want to quit you press quit.
OK, here is what I did. I added a “repeat” so that the script’s routine would go on until your press “Quit” when I asks for your text. Here is it:
property theURL : "http://translate.google.com/?"
property agent : "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; fr; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3"
property charset : "UTF-8"
property header : "Charset:" & space & charset
set langBtns to {"English", "Spanish"}
set outputLang to {"en", "es"}
-- --------------------------------------------
-- Values subject to change.
-- --------------------------------------------
set snipOpen to "<input type=hidden name=gtrans value=\""
set snipClose to "\"><div id=sug_exp>"
--
set dflt_txt to "Dear Sir,\n\nIf a member misbehaves, the IP.Board warning panel allows moderators to apply a number of sanctions, such as requiring approval of future posts, suspending them for a specified time, or even banning them, as well as leave notes for future reference."
-- --------------------------------------------
-- HANDLERS
-- --------------------------------------------
on Split(txt, del)
set {otid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, del}
set txt to text items of txt
set AppleScript's text item delimiters to otid
return txt
end Split
on substitute(s, r, T)
set s to s as list
set r to r as list
set T to T as text
set tid to AppleScript's text item delimiters
repeat with i from 1 to count s
set AppleScript's text item delimiters to s's item i
set T to T's text items
set AppleScript's text item delimiters to r's item i
set T to T as text
end repeat
set AppleScript's text item delimiters to tid
return T
end substitute
-- --------------------------------------------
-- ROUTINE
-- --------------------------------------------
repeat
set dialResult to (display dialog "Enter the text to translate to." with title "Translate." default answer dflt_txt buttons {"Quit"} & langBtns default button 3 cancel button {"Quit"})
repeat with i from 1 to (count langBtns)
if button returned of dialResult is langBtns's item i then
set chosenLang to outputLang's item i
exit repeat
end if
end repeat
set escapedText to do shell script "/usr/bin/perl -e 'use URI::Escape; print uri_escape(\"" & text returned of dialResult & "\")'"
set TranslatedText to do shell script "/usr/bin/curl" & space & ¬
"-A" & space & quoted form of agent & space & ¬
"-H" & space & quoted form of header & space & ¬
"-d" & space & quoted form of ("&ie=" & charset & "&oe=" & charset & "&langpair=auto|" & chosenLang & "&text=" & escapedText) & space & ¬
quoted form of theURL & space & ¬
"| perl -Mencoding=utf8 -MHTML::Entities -lne 'print decode_entities($_)'"
if TranslatedText = "" then return
try
set txt to Split(TranslatedText, snipOpen)'s item 2
set txt to Split(txt, snipClose)'s item 1
set txt to substitute({"<br>"}, {return}, txt)
display dialog txt with title "Result" buttons {"OK"} default button 1
-- set the chipboard to txt
on error errTxt number errNum
display dialog errTxt with title "Error# " & errNum buttons {"Cancel", "OK"} default button 2 with icon 0 giving up after 0
end try
end repeat
-- --------------------------------------------
-- LANGUAGES SUPPORTED BY GOOGLE TRANSLATE
-- --------------------------------------------
-- {"Afrikaans", "Albanian", "Arabic", "Belarusian", "Bulgarian", "Catalan", "Chinese", "Croatian", "Czech", "Danish", "Dutch", "English", "Estonian", "Filipino", "Finnish", "French", "Galician", "German", "Greek", "Hebrew", "Hindi", "Hungarian", "Icelandic", "Indonesian", "Irish", "Italian", "Japanese", "Korean", "Latvian", "Lithuanian", "Macedonian", "Malay", "Maltese", "Norwegian", "Persian", "Polish", "Portuguese", "Romanian", "Russian", "Serbian", "Slovak", "Slovenian", "Spanish", "Swahili", "Swedish", "Thai", "Turkish", "Ukrainian", "Vietnamese", "Welsh", "Yiddish"}
-- {"af", "sq", "ar", "be", "bg", "ca", "zh-CN", "hr", "cs", "da", "nl", "en", "et", "tl", "fi", "fr", "gl", "de", "el", "iw", "hi", "hu", "is", "id", "ga", "it", "ja", "ko", "lv", "lt", "mk", "ms", "mt", "no", "fa", "pl", "pt", "ro", "ru", "sr", "sk", "sl", "es", "sw", "sv", "th", "tr", "uk", "vi", "cy", "yi"}
Now here is the same one but with all languages:
property theURL : "http://translate.google.com/?"
property agent : "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; fr; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3"
property charset : "UTF-8"
property header : "Charset:" & space & charset
set langBtns to {"Afrikaans", "Albanian", "Arabic", "Belarusian", "Bulgarian", "Catalan", "Chinese", "Croatian", "Czech", "Danish", "Dutch", "English", "Estonian", "Filipino", "Finnish", "French", "Galician", "German", "Greek", "Hebrew", "Hindi", "Hungarian", "Icelandic", "Indonesian", "Irish", "Italian", "Japanese", "Korean", "Latvian", "Lithuanian", "Macedonian", "Malay", "Maltese", "Norwegian", "Persian", "Polish", "Portuguese", "Romanian", "Russian", "Serbian", "Slovak", "Slovenian", "Spanish", "Swahili", "Swedish", "Thai", "Turkish", "Ukrainian", "Vietnamese", "Welsh", "Yiddish"}
set outputLang to {"af", "sq", "ar", "be", "bg", "ca", "zh-CN", "hr", "cs", "da", "nl", "en", "et", "tl", "fi", "fr", "gl", "de", "el", "iw", "hi", "hu", "is", "id", "ga", "it", "ja", "ko", "lv", "lt", "mk", "ms", "mt", "no", "fa", "pl", "pt", "ro", "ru", "sr", "sk", "sl", "es", "sw", "sv", "th", "tr", "uk", "vi", "cy", "yi"}
-- --------------------------------------------
-- Values subject to change.
-- --------------------------------------------
set snipOpen to "<input type=hidden name=gtrans value=\""
set snipClose to "\"><div id=sug_exp>"
--
set dflt_txt to "Dear Sir,\n\nIf a member misbehaves, the IP.Board warning panel allows moderators to apply a number of sanctions, such as requiring approval of future posts, suspending them for a specified time, or even banning them, as well as leave notes for future reference."
-- --------------------------------------------
-- HANDLERS
-- --------------------------------------------
on Split(txt, del)
set {otid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, del}
set txt to text items of txt
set AppleScript's text item delimiters to otid
return txt
end Split
on substitute(s, r, T)
set s to s as list
set r to r as list
set T to T as text
set tid to AppleScript's text item delimiters
repeat with i from 1 to count s
set AppleScript's text item delimiters to s's item i
set T to T's text items
set AppleScript's text item delimiters to r's item i
set T to T as text
end repeat
set AppleScript's text item delimiters to tid
return T
end substitute
-- --------------------------------------------
-- ROUTINE
-- --------------------------------------------
repeat
set dialResult to text returned of (display dialog "Enter the text to translate." with title "Translate." default answer dflt_txt buttons {"Continue", "Quit"} default button {"Continue"} cancel button {"Quit"}) as string
set languagechoose to (choose from list {"Afrikaans", "Albanian", "Arabic", "Belarusian", "Bulgarian", "Catalan", "Chinese", "Croatian", "Czech", "Danish", "Dutch", "English", "Estonian", "Filipino", "Finnish", "French", "Galician", "German", "Greek", "Hebrew", "Hindi", "Hungarian", "Icelandic", "Indonesian", "Irish", "Italian", "Japanese", "Korean", "Latvian", "Lithuanian", "Macedonian", "Malay", "Maltese", "Norwegian", "Persian", "Polish", "Portuguese", "Romanian", "Russian", "Serbian", "Slovak", "Slovenian", "Spanish", "Swahili", "Swedish", "Thai", "Turkish", "Ukrainian", "Vietnamese", "Welsh", "Yiddish"} with prompt "What langauge?") as string
set dialResult to {text returned:dialResult, button returned:languagechoose}
repeat with i from 1 to (count langBtns)
if button returned of dialResult is langBtns's item i then
set chosenLang to outputLang's item i
exit repeat
end if
end repeat
set escapedText to do shell script "/usr/bin/perl -e 'use URI::Escape; print uri_escape(\"" & text returned of dialResult & "\")'"
set TranslatedText to do shell script "/usr/bin/curl" & space & ¬
"-A" & space & quoted form of agent & space & ¬
"-H" & space & quoted form of header & space & ¬
"-d" & space & quoted form of ("&ie=" & charset & "&oe=" & charset & "&langpair=auto|" & chosenLang & "&text=" & escapedText) & space & ¬
quoted form of theURL & space & ¬
"| perl -Mencoding=utf8 -MHTML::Entities -lne 'print decode_entities($_)'"
if TranslatedText = "" then return
try
set txt to Split(TranslatedText, snipOpen)'s item 2
set txt to Split(txt, snipClose)'s item 1
set txt to substitute({"<br>"}, {return}, txt)
display dialog txt with title "Result" buttons {"OK"} default button 1
-- set the chipboard to txt
on error errTxt number errNum
display dialog errTxt with title "Error# " & errNum buttons {"Cancel", "OK"} default button 2 with icon 0 giving up after 0
end try
end repeat
-- --------------------------------------------
-- LANGUAGES SUPPORTED BY GOOGLE TRANSLATE
-- --------------------------------------------
-- {"Afrikaans", "Albanian", "Arabic", "Belarusian", "Bulgarian", "Catalan", "Chinese", "Croatian", "Czech", "Danish", "Dutch", "English", "Estonian", "Filipino", "Finnish", "French", "Galician", "German", "Greek", "Hebrew", "Hindi", "Hungarian", "Icelandic", "Indonesian", "Irish", "Italian", "Japanese", "Korean", "Latvian", "Lithuanian", "Macedonian", "Malay", "Maltese", "Norwegian", "Persian", "Polish", "Portuguese", "Romanian", "Russian", "Serbian", "Slovak", "Slovenian", "Spanish", "Swahili", "Swedish", "Thai", "Turkish", "Ukrainian", "Vietnamese", "Welsh", "Yiddish"}
-- {"af", "sq", "ar", "be", "bg", "ca", "zh-CN", "hr", "cs", "da", "nl", "en", "et", "tl", "fi", "fr", "gl", "de", "el", "iw", "hi", "hu", "is", "id", "ga", "it", "ja", "ko", "lv", "lt", "mk", "ms", "mt", "no", "fa", "pl", "pt", "ro", "ru", "sr", "sk", "sl", "es", "sw", "sv", "th", "tr", "uk", "vi", "cy", "yi"}
There you go.
Very useful script. Thank you clemhoff.
Hmm. This script didn’t work for me, but it’s alright, it’s not really what I was looking for anyway. What I’d like to find is a script that would work as a contextual menu, so that if I right-clicked a word (or phrase) it would just launch a Google Translate webpage with a translation of the word (or phrase). (Or even a URL to translate a whole web page). As an alternative to right-clicking a word to launch Dictionary, which I do very often.
Change the snipopen and snipclose to todays page layout and the script will work again.
I thought this was a very interesting script - both for its original purpose and for learning how its elements work.
Unfortunately, I’ve not been able to get this to work.
The last note mentions changing the SnipOne and SnipOff values, but I don’t understand what this means.
Can anyone advise further? If I can get any of the versions to work, I’m sure I can understand more about how it works and thus be able to learn how to do other useful things.
Thanks,
Bowjest
He means that webpages change their layout from time to time, so the source code does also. You should take a look at the source code of the webpage.
do shell script "curl [url=http://translate.google.com/?]http://translate.google.com/?"[/url]
Thanks, theway.
I’ve done that and it returned the following:
"Error 403 (Forbidden)!!1{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKsAAADVCAMAAAAfHvCaAAAAGFBMVEVYn%2BH%2F%2F%2F%2Bex%2B3U5vd7s%2Bfq8%2Fs0itq72PMLUPvtAAASvklEQVR4AbXBC0JqCQxEwT5Jd7L%2FHc8FdR4g%2BEGtEr8u%2FBHxu7otdzd%2FQPyqlmRp1Pw%2B8aukDfRa1fw28ZtWy4sa89vEb7LCi0zx28RvqgkvouW3id%2FU8pbtWmv5beJXRWNrRmp%2BnfhlHXZm%2BQPi95Vk%2FoD4fZbMHxC%2FryTzB8Tva435A%2BL3rcb8AfH7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kJggg%3D%3D) 100% 5px no-repeat;margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px} > body{padding-right:205px}p{margin:22px 0 0;overflow:hidden}ins,#g{text-decoration:none}ins{color:#777}a img{border:0}#g{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAAA3CAMAAADZn0ObAAABgFBMVEX%2F%2F%2F%2Fy1pHuLjfMm2W4yfA1TrPukgZDats3V8fwTEypjWy8u7oPsSWVsOoBdwwClhI%2FZdlasGjpOUOVlJjx0c20CyZpea36pAdIdebyu7COlqpYaql2hLH40Gn59vayuMlZiOunpqjYGy9wiNLd5PRqlOzzcmz%2Fwi4FpRrqsDisbm7O2O%2FKycrGfHmdo7CFmdPs7Ozz8%2FPIDSvcFC%2BTR0vCw8Xj5OTc3Nynvu7l6%2FfVjyw7Xc%2FSMT%2FZbgbT09NDbuHKz9BKf1Hr5ubiHTLt8vz%2Btxj1%2BOrT1txYedhLcNfwjYjTES6yq6r27Oqnq7NJZsiykpDNEiyxUVOTptiys7LNs6%2FhegO3p5L46MRveZiXcHBFXbY5dkLUysj0Pj9OfOjRS1JVZZzMrZGoXWCzKjn%2BrgpcdsflfIKh26frpKHJGzIqxDe4cC2AoOnOXl%2FYaWx204D4XVWsPEjRXwXqoRqYFSnN5dBhfMwZjipRaLvUmpk3x0SualZBXcJIV5A9nk5h34NHAAAJe0lEQVRo3u1YC1fa2BYGBBJA2lSeRjzyUKmQQgJNAoYhlJciiKJYHx2hYm2rre2140zHmem9f%2F3uE16JOpVZpcuuu%2B5eLpeSsPOdb3%2Fn2%2FtEp%2Ft%2FdAOV3%2F4L4tGj39DI3ynOp%2BznEPaUcZ77LqjKb%2F989%2Be7d5OPreKIDygaz9teWSYIgpJlb9u%2FnUqj8cP6jX87OTn58Pd6dqTkabvfS6z66FgsEKN9rymi4l31x6NjB1YWeODqwTNbfpTURgDlpgNNPrciilmGj7kpQEZQIaE4bmDcJIbFsyPUD6iq%2BGK2rMAhWARCnJC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H7T14MHPTcVT0OGrRqKRTBY%2BnjoF5%2FSbzI4KAj7XY2BESGOraShhjy1Y1%2BYrVyKRWXM6naeZ6quDAN8f58vpnWXAdbKk1%2BvDnucTjmZWS3u0QmAb3O7l%2Fs8DJX5%2F9hZr4HDL5Uo0EkkgrZo429G8cOCyPpMJkFHE6rZxXllWMWqvAFemf%2FfmfMTyB5%2FOgLFktfoJmj0zfPmF2OyudRkUZjYvd3abvPZwl45GV7F4ZSqkMCE8evazEo%2B68hI3P7m68eo4YBM5rVHZ3BiYRMKyVldDqxUJCni0f%2BQIMOzgncRO5HhraysSqfGMoCEE5W2d5YnliYldGNdVZUinFioUQW68UGpBdM2RzfI2HoLpQkACv3n8FCLiqDE3tM%2BKPO1%2B8UIhjXxxdeWj6Rr09UNB9RROELM5hsmKLHf962VWWFkRRSFfVo0B522KCtGxer1Ov8DileJKq%2BZYTvnp38mxYpaBEIXbjvasyMRot3vmCE5ONA2TBhwOytcP1kiJrxyZ1e82CMrnCEAeURB5NwmWT%2F7NvIkQ%2BPffnicQmxdEMZuFVcNxBX3byR5QSfv4nMbhLYpEH%2BAifeI3vCYYx%2FuQ6IIXUDGDSqE8dBPTDMP9YzTjjDToinSoa4aEDRDtSC87vl8Y2xXCRGtKhuLA1j3DssPJRYppHcxOmvbvGxb4OqllSxeH4Y1B9woriseSDV4Nolgh92Pi%2FcLSKZPpa%2FWwFCdnHDx3v6h07GdoOFJlLq1TbEs3HyJn6PG%2FTf%2FH9ie6cY%2BViJA9lUqdQ7f2Be4fFfap2IzSYLG7k1c%2BGDp%2BAFTKJF%2FzufdnZtz7PrrevDZ03GPAaJDjbRA8dGsW6X6cgNmAhSEG%2FUiY%2Fsfiv02O7iVu1LunAAAAAElFTkSuQmCC);display:block;height:55px;margin:0 0 -7px;width:150px}* > #g{margin-left:-2px}#g img{visibility:hidden}* html #g img{visibility:visible}*+html #g img{visibility:visible}
403. That’s an error.
Your client does not have permission to get URL /
from this server. (Client IP address: 80.189.121.162)
That’s all we know."
Again, my apologies, but I don’t know what to do now with this data. Can you advise further?
Thanks,
Bowjest
For some reason, Google does not give you permission to that URL. Go to Google Translate’s page in Safari and copy the URL from there and put it into the curl command.
Firefox is my default browser. Could this be the problem?
I’ll try Safari, but I don’t ever use it (I need the specific functionality of Firefox and its plugins).
I got the same result.
Could it be because the Google API is being shutdown (well, the v1 free version, that is)?
I didn’t know Google Translate was being shut down, I knew that they were getting rid of a number of their widgets. I think you should try the script in Code Exchange. It still works. If it stops, I will fix it and post a comment on that thread. I use that script a lot!
Well as a known translation software developer I have to know what the competition does. Google is still online with it’s translation kit and you’ll need a token to be able to translate a certain amount for free per day using google’s API. The scripts above are not using Google’s API but are website grabbers/scrapers. They pretend to be a certain web browser (Firefox 3) and at least the agent should be updated to make google allow you to make requests. Then Google is continuously updating their sites with a little change in their layout almost monthly without changing the presentation. Maybe this is also done to avoid grabbers and scrapers. Like in my old post above, you’ll need continuously updating your script.
The site that the Code Exchange script accesses has not changed yet. I think that is a better bet than Google.
Thanks to you both. I appreciate it.
I’ll look for that script in the Code Exchange - thanks for the tip.
If there is any way to get the script here working (even if it’s just for the time being) I would appreciate it as I’d like to work down the contents for possible application in other areas.
I don’t really know much about AppleScript and am not a natural programmer, so tend to find things that work, put them in snippets, and then try to modify them as I go for new projects.
Thanks,
Bowjest
I’ve tried running the curl command on another site (linguee.com) and found this gave back a lot of good looking results:
"
Linguee – The web as a dictionary – German/EnglishSearch millions of sentences translated by other people.
[en] English <-> [de] German
[en] English ---> [de] German
[de] German ---> [en] English
[en] English <-> [es] Spanish
[en] English <-> [fr] French
[en] English <-> [pt] Portuguese
All languages:
- English German
- English Spanish
- English French
- English Portuguese
Again, I don’t know what I should be looking for to try to modify the original Google script.
Can someone advise what I need to be aware of for starting and ending points so I can try to tweak the script for this?
I’m hoping to eventually move away from translation sites and use this to display general web results as I carry out site searches (but don’t know how feasible that may be).
Thanks in advance for any advice and help.