I’m loving my new Android phone. It’s a real smart piece of technology and I keep finding great applications for it. One neat application that I have found is the Android Scripting Environment , which basically does what it says on the tin, allowing you to create quick and dirty scripts, on the device, which make use of the extensive Android API.
One of the example programs that came with the application made use of the barcode scanner to add a book to Google Books. I’ve adapted this program to allow you to quickly add a book to your Bookmooch inventory, just by scanning the barcode on the back of a book.
It’s a bit rough and ready but a fun little hack.
Here’s the code:
import android droid = android.Android() code = droid.scanBarcode() isbn = int(code['result']['SCAN_RESULT']) url = ("http://bookmooch.com/m/add_do?text=%d" %isbn+"&store=amazon.co.uk") droid.startActivity('android.intent.action.VIEW',url)
The original code, along with a load of other examples can be found here . I’d love it if someone were able to develop this a bit more, if only to provide a nice exit routine. Sadly that’s way beyond my ability.