Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 6, 2013, 04:55 PM   #1
sgthree
macrumors newbie
 
Join Date: Feb 2012
simulating keyboard input from usb rfid reader

I have a usb device which reads rfid tags. On my window pc I have a program which takes the code from a scanned chip and sends it as a 12 character string to whatever program has the keyboard focus. I need to accomplish the same result on a mac running OS X 10.8

I can read the input from the device from /dev/cu.SLAB_USBtoUART, and have written a command line objective-C program that massages the input to remove the extraneous info and sends the required 12 character code to stdout.

How to I get the system to treat the output from this program as keyboard input?

The end result that I want is for the scanned code to be entered into a form field in a web browser running on the mac with a return so that when an rfid chip is scanned, the web brewer submits a form with that chips code.
sgthree is offline   0 Reply With Quote
Old Jan 7, 2013, 02:57 PM   #2
ytk
macrumors regular
 
Join Date: Jul 2010
I think you're saying you just want to send the text you get from the reader as if it were typed text? If so, you can do this with AppleScript.

Code:
tell application "System Events" to keystroke "foobar"
You can easily issue AppleScript commands from the command line (or another application) using osascript:

Code:
osascript -e 'tell application "System Events" to keystroke "foobar"'
ytk is offline   0 Reply With Quote
Old Jan 7, 2013, 03:05 PM   #3
balamw
Moderator
 
balamw's Avatar
 
Join Date: Aug 2005
Location: New England, USA
I'm a bit surprised it doesn't just come up as a HID device instead of a serial port.

e.g. http://www.practicalarduino.com/proj...l-usb-keyboard

B
__________________
MBA (13" 1.7 GHz 128GB), UMBP (15" SD 2.8 GHz), UMB (13" 2.4 GHz), iMac (17" Yonah), 32GB iPad 3 WiFi+LTE, 64 GB iPad WiFi, 32 GB iPhone 5, Airport Extreme
balamw is online now   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Bluetooth keyboard input delay Nanasaki iPad Accessories 3 Feb 25, 2014 10:04 PM
HID Device RFID reader not working aleza84 Mac OS X 10.7 Lion 1 Jan 28, 2014 06:44 AM
Password input request, but no keyboard? Galatian iOS 7 3 Sep 13, 2013 10:21 AM
Input delays after connecting a USB device Sylon Mac Basics and Help 12 Feb 13, 2013 07:45 PM
"Potentially useful" Abbyy Fine Reader script. (does not replace input file) tiriya Mac Programming 0 Aug 9, 2012 09:19 AM

Forum Jump

All times are GMT -5. The time now is 08:44 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC