Since there is still no answer to this question I will post my workaround to the problem.
Steps:
- Install Python 2.7 and check the
Add python.exe to Path
checkbox when installing (Yes. I know this is overkill on the first step.)
- Go to the command prompt and type in
pip install pyHook
(case sensitive). It should say something like "Successfully installed pyHook" after a few moments.
- Create a new file and call it
yourname.py
Put this script into the file:
# -*- coding: utf-8 -*-
import pyHook
import pythoncom
import re
import webbrowser
endDomains = ".com|.net|.org|.edu|.gov|.mil|.aero|.asia|.biz|.cat|.coop|.info|.int|.jobs|.mobi|.museum|.name|.post|.pro|.tel|.travel".split("|")
chars = ""
def pressed_chars(event):
global chars
if event.Ascii:
char = chr(event.Ascii)
if event.Ascii == 3:
quit()
else:
chars += char
try:
urls = re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', chars)
print(urls)
except:
urls = re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', chars)
print(urls)
if len(urls) > 0:
for url in urls:
for i in endDomains:
if i in url:
webbrowser.open_new_tab(url)
chars = ""
break
proc = pyHook.HookManager()
proc.KeyDown = pressed_chars
proc.HookKeyboard()
pythoncom.PumpMessages()
Now just open the file.
You should see a black window. If you do and it doesn't close it's working.
Now any link that is typed using the keyboard (or the barcode scanner driver) will be automatically opened in the default web browser.
NOTE:
These links WILL open:
http://www.google.com
https://www.google.com
http://youtube.com
These links will NOT open:
www.google.com
www.google.com
youtube.com
This is so when you type in a link using the keyboard it is not opened with the web browser (because people do not usualy type in the http://
prefix).
TIP: You can auto-run the script upon startup by putting it into the startup folder.
If you have any problems or anything just leave a comment.