Skip to content

Instantly share code, notes, and snippets.

@cclauss
Last active September 15, 2017 07:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cclauss/6708024 to your computer and use it in GitHub Desktop.
Save cclauss/6708024 to your computer and use it in GitHub Desktop.
ZBar delivers barcode data to Pythonista.
# helloBarcode - ZBar delivers barcode data to Pythonista
programName = sys.argv[0].rpartition('/')[2]
theBarcode = sys.argv[1] if len(sys.argv) > 1 else None
fmt = '{} was launched with barcode: {}'
print(fmt.format(programName, theBarcode))
# Save this file in Pythonista as 'helloBarcode'.
# Download free app ZBar from the iTunes App Store.
# Launch ZBar on your device.
# Scan the barcode on a book, coke can, whatever.
# On the Barcode Detail screen, click Edit in the upper right.
# Scroll to the bottom fo the screen and Add New Link.
# Set the Name to Pythonista helloBarcode.
# Set the URL to pythonista://helloBarcode?action=run&argv=
# Click the plus (+) in the upper right of the screen.
# I selected GTIN-13 for everyday products.
# Click Edit Link URL in the upper left of the screen.
# This should complete the URL so it ends in &argv={GTIN-13}
# Click Done and then click Save and then click Done.
# Click the Pythonista helloBarcode line.
# Pythonista's helloBarcode should be launched...
# ... your barcode should appear!
@cclauss
Copy link
Author

cclauss commented Sep 26, 2013

ZBar delivers barcode data to Pythonista

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment