I have a small AppleScript that I use to access a few search sites. When it launches, it asks for the search term and then presents a choice of search sites to choose from.
One of the choices is:
http://www.microsoft.com/Language/en-US/Search.aspx
When this site opens, it has focus on the “Search for” box, but I can’t figure out how to “paste” the content of the variable holding the search term into this box.
Here is an abbreviated form of the script as it stands:
set search to text returned of (display dialog "Enter Search Query:" default answer "" buttons {"Search", "Cancel"} default button "Search")
set sites to {"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 "MS Language Portal" then
open location "http://www.microsoft.com/Language/en-US/Search.aspx"
End if
Please note that trying the conventional:
if chosen is "MS Language Portal" then
open location "http://www.microsoft.com/Language/en-US/Search.aspx" & search
End if
will only append the content of the search variable to the URL, it won’t “paste” (or quote) it into the browser where the cursor has focus.
I have searched Google using every set of search terms that I can think of that might apply, but so far have only found scripts for copying the URL of a site, but nothing for pasting or quoting the content of a variable into a text box/search field on a site.
Can anyone offer advice on how to achieve this?
Thanks,
Bowjest