Google search via AppleScript I would like to make a Google search with an AppleScript. The code looks like this:

set search to text returned of (display dialog "Google Search" buttons {"OK"} default answer {""})
open location ("https://www.google.de/#q=" &amp; search)


The problem is, how can I change the spaces to a +?
Here's a subroutine for replacing characters:


on replace_chars(this_text, search_string, replacement_string)
  set AppleScript's text item delimiters to the search_string
  set the item_list to every text item of this_text
  set AppleScript's text item delimiters to the replacement_string
  set this_text to the item_list as string
  set AppleScript's text item delimiters to ""
  return this_text
end replace_chars



Source: http://www.macosxautomation.com/applescript/sbrt/sbrt-06.html

Between those two lines of AppleScript, insert the following:

set search to replace_chars(search," ","+")