Created
October 20, 2011 00:33
-
-
Save hensleyl/1300096 to your computer and use it in GitHub Desktop.
Use a Microvision ROV Bluetooth Scanner MS2200BT as a keyboard on OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
framework 'ScriptingBridge' | |
application = SBApplication.applicationWithBundleIdentifier("com.apple.systemevents") | |
while true do | |
begin | |
File.open('/dev/tty.Cordless-Spp', 'r') do |rov| | |
while true do | |
scan = rov.gets | |
if scan | |
if scan.size < 20 && scan.chomp =~ /\A\w+\z/ | |
application.keystroke scan, :using => 0 | |
puts scan | |
end | |
else | |
break | |
end | |
end | |
end | |
rescue Errno::EBUSY | |
sleep 0.5 | |
retry | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By any chance do you still use this ROV scanner on macOS? I'm trying to get my old one working as keyboard entry as well, and would love to know any pointers you have for doing so on a modern macOS version, please? Thanks!