It is a function that google searches the highlighted character string with one click of a button. This is a convenient function installed in Logitech's M950 mouse. The reason I reproduced it in Python this time is that this useful feature has disappeared from the next generation of mice.
As an aside, I've been using the M950 for nearly nine years because this feature is so convenient that I can't leave it. I was troubled by chattering on the way, but it is a convenient function that I disassemble, repair and continue to use.
import webbrowser
import pyautogui
import pyperclip
import time
pyautogui.hotkey('alt', 'tab')
time.sleep(0.03)
pyautogui.hotkey('ctrl', 'c')
time.sleep(0.03)
clipboard = pyperclip.paste()
url = 'https://www.google.co.jp/search?hl=ja&q=' + clipboard
webbrowser.open(url)
As a flow,
Create a bat file in any location. First, right-click> New> Text Document. The content of the text is
Path to python.exe (half-width space) Path to .py created in 1
is. Then change the extension of this text file from .txt to .bat. You can ignore the warning that appears at that time.
Right-click the .bat file created in 1.2 and select "Create Shortcut". 2. Right-click on the created shortcut and select "Properties". 3. Select the "Shortcuts" tab, select "Shortcut Keys", and then press any key combination *. 4. Set "Runtime size" to "Minimize" to improve the appearance.
That's it. In the example, I created a file called onetouch.bat and set the shortcut key with "Ctl + Shift + Alt + K". Highlight any character string and press the shortcut key set in 3. Hopefully you should be able to do a google search. If you assign this shortcut key to a mouse button, you can search by simply pressing the mouse button.
--If the highlighted character string starts with "#", you cannot search well. --Slightly slower than the genuine One-Touch Search.
Recommended Posts