Dymo labelprinter

Mac OSX specific forum
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

Dymo labelprinter

Post by jesperbrannmark »

I've been struggling with the Dymo labelprinter SDK (applescript) for weeks now. The examples that came along with the SDK is not working at all.... at all... and everyone keep saying they are soooo good... well - they are not.

Here is a working example when doing simple labels. I have on purpose NOT defined the label - its better to have the user do this in the dymo labelwriter software.

Hope its useful for someone (and thanks once again for the heaven sent applescript bridge.... which there was something similar in windows)

Code: Select all

Procedure dymo_printlabel(text.s)
  text.s=ReplaceString(text.s,#CR$,Chr(34)+" & crlf & "+Chr(34))
  text.s=ReplaceString(text.s,Chr(10),"")
  a.s="try"+#CRLF$
  a.s+"set crlf to (ASCII character 13) & (ASCII character 10)"+#CRLF$
  a.s+"set the_address To "+Chr(34)+text.s+Chr(34)+#CRLF$
  a.s+"tell application "+Chr(34)+"DYMO Label"+Chr(34)+#CRLF$
  a.s+"set object text of address 1 To the_address"+#CRLF$
  a.s+"set content of address 1 To the_address"+#CRLF$
  a.s+"printLabel2"+#CRLF$
  a.s+"End tell"+#CRLF$
  a.s+"End try"+#CRLF$
  COCOA_AppleScript(a.s)
EndProcedure
dymo_printlabel("this is a text"+#CRLF$+"second line")