topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday April 20, 2024, 4:56 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Search Google for references to a filename - from Windows Explorer "Send To"  (Read 3470 times)

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
I came across this rather nifty bit of code today here on the xplorer² website blog.
It is also discussed on the xplorer² discussion forum here.
By automating the process it is a potential timesaver, as it shortens the process that we might otherwise use to do the same thing manually (and sometimes quite frequently).

Post is copied here, together with simple VBA code:
Spoiler
From: the xplorer² website blog

[xplorer²] — Search online for a file
Sometimes you may be wondering what some file is doing on your PC. An easy way to find out if it is good or bad is to search online for it. For example Process Explorer has an online search menu command that will show information about any running process so you can be sure it isn't some malware infecting your computer.

To search for a file online the obvious solution would be to copy its filename, open your internet browser, and use the search box to start a search for it. But that is too much work; wouldn't you prefer a context menu command to google search a file selected in windows explorer or xplorer²? Surprisingly there is no such command available, so let's create one. The simplest solution would be to create a WSH script that accepts the filename as an argument:
Set objArgs = WScript.Arguments
Set WshShell = WScript.CreateObject("WScript.Shell")

' extract the filename from the full path
pos = InstrRev(objArgs(0), "\")
filename = mid(objArgs(0), pos+1)

WshShell.Run "http://google.com/search?q=" & filename
You can use notepad to type this script and save it as GOOGLESEARCH.VBS — or simply download it from here. You don't need to understand how this script works, but in essense it just launches a google search by running a suitably formatted URL that contains the filename to search. This will open your default internet browser.

How do we pass the filename to this script? One solution would be to save this GOOGLESEARCH.VBS on your desktop and drag-drop the file you want to inspect on its icon. But as we are looking for a convenient context menu approach we will save it in the system Send To folder, so that it appears in the SendTo submenu when you right click on a file — see the picture to the right.    send to google search

Commands that appear in the send to submenu are just shortcuts in a folder called C:\Users\someUser\AppData\Roaming\Microsoft\Windows\SendTo (you can access this folder easily from xplorer² using Goto > Special folders > Send to menu command). For example if you paste a shortcut to windows Notepad in there, there will be a command to send a file to notepad (i.e. edit it as text). As our script is really small we don't put a shortcut to it, but store the whole file in the send to folder.

So in summary, to enable google search for files on your computer:
  • Download the script and save it on your computer
  • Copy this script in the SendTo folder using xplorer² Goto > Special folders menu
  • Right click on any file you want examined and pick the google search command from the send to menu

I didn't find it having been discussed on the DCF, so I posted about it here in case it might be of help/interest to DCF members.