Skip to content

Instantly share code, notes, and snippets.

@rdapaz
Created August 15, 2017 03:40
Show Gist options
  • Save rdapaz/d92e27a19b4cb797a0c2c12ede6d4d3b to your computer and use it in GitHub Desktop.
Save rdapaz/d92e27a19b4cb797a0c2c12ede6d4d3b to your computer and use it in GitHub Desktop.
Python Script to Print to Dymo Labeller
#Testcoding: utf-8
import time
import win32com
import win32com.client
labels_to_print = """
Label 1
Label 2
Label 3
""".splitlines()
labels_to_print = [x for x in labels_to_print if len(x) > 0]
shell = win32com.client.Dispatch("WScript.Shell")
# shell.Run("notepad")
# time.sleep(0.1)
shell.AppActivate('Dymo Label Light')
for label in labels_to_print:
shell.SendKeys("^n")
shell.SendKeys(f"{label}")
shell.sendkeys("^p")
time.sleep(8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment