Search code examples
macosautomator

Web search for filename using Automator


I'm attempting to formulate an Automator script that takes a filename from Finder and searches for it on a specific website using Google.

It looks like I'm getting the filename right and can put it in a variable, but I can't figure out if there is a way to pass the variable to the search URL. There is no variable input field for URLs. Can perhaps some intermediate function be used?

enter image description here


Solution

  • You can use this script, it return an URL (no need for other actions or variables):

    on run {input, parameters}
        set tName to name of (info for (item 1 of input) without size)
        return "https://www.google.com/search?q=" & tName & "%20site%3Amywebpage.com"
    end run