Skip to content

Instantly share code, notes, and snippets.

@nkrumm
Last active May 26, 2023 16:48
Show Gist options
  • Save nkrumm/95db0b70c1875abf18f3d8a2a6995bc4 to your computer and use it in GitHub Desktop.
Save nkrumm/95db0b70c1875abf18f3d8a2a6995bc4 to your computer and use it in GitHub Desktop.
Label Printer Driver Script
(*
DYMO Label Software v8 SDK
This example demonstrates how to create an address label from scratch by adding a new Address Object and setting its attributes.
*)
on SplitString(TheBigString, fieldSeparator)
tell AppleScript
set oldTID to text item delimiters
set text item delimiters to fieldSeparator
set theItems to text items of TheBigString
set text item delimiters to oldTID
end tell
return theItems
end SplitString
on DefaultHandler(params)
set {barcodevalue, sampleidvalue, patientnamevalue, patientdobvalue, sample_statevalue} to SplitString(params, ";")
tell application "DYMO Label"
openLabel in "NCGL-Sample-Tube.label"
set brc to a reference to first item of print objects
tell brc
set barcodeText to barcodevalue
end tell
set sampleid to a reference to second item of print objects
tell sampleid
set content to sampleidvalue
set disableShrinkToFit to false
set firstLineFontSize to 8
set firstLineFontName to "Helvetica"
end tell
set patientname to a reference to third item of print objects
tell patientname
set content to patientnamevalue
set disableShrinkToFit to false
set firstLineFontSize to 12
set firstLineFontName to "Helvetica"
end tell
set patientdob to a reference to fourth item of print objects
tell patientdob
set content to patientdobvalue
set disableShrinkToFit to false
set firstLineFontSize to 11
set firstLineFontName to "Helvetica"
end tell
set top_sampleid to a reference to fifth item of print objects
tell top_sampleid
set content to sampleidvalue
set disableShrinkToFit to false
set firstLineFontSize to 12
set firstLineFontName to "Helvetica"
end tell
set sample_state to a reference to sixth item of print objects
tell sample_state
set content to sample_statevalue
set disableShrinkToFit to false
set firstLineFontSize to 7
set firstLineFontName to "Helvetica"
end tell
set top_sample_state to a reference to seventh item of print objects
tell top_sample_state
set content to sample_statevalue
set disableShrinkToFit to false
set firstLineFontName to "Helvetica"
end tell
redrawLabel
printLabel2
end tell
return true
end DefaultHandler
DefaultHandler("1234;s10001;Kassandra Chauvin;9/24/1973;gDNA")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment