Dymo LabelWriter
From nswccWiki
Using the Dymo LabelWriter with a Macintosh
I recently was able to use a LabelWriter 400 to make up sticky labels for use in managing class work in science. In the past it was (and probably still is) possible to purchase in bulk, sticky labels to help manage tracking of items. I have considered them rather expensive, and it was not easy to obtain custom designs. All that has changed.
We have had a few issues keeping track of student work submitted for assessment, especially when
- the work may be on one or more types of media (Flash Drive, CD-ROM, printed, poster, model etc)
- identification of work done (by members of a group or class) in practical work for science investigations including Student Research Projects is required.
To deal with this diversity of material I considered using sticky labels generated by and kept track of by a database. Recently, Dymo Labelwriter printer prices have become affordable (less than $200).
The LabelWriter and its application Dymo Label Software works very well on a Macintosh, is very simple to use and is able to easily maintain multiple databases and multiple definitions of label files. There are some aspects that show it’s dual platform heritage. There has been a recent update to version 8(Oct 2009). Be careful with installation because the structure and location of support files (eg. label database and graphics has been significantly altered.
It is a thermal printer system and so does not need ink, only labels. It can import and export lists of text data, as well as print simple images, barcodes and auto incrementing counters. Labels, such as for name tags can be very easily constructed.
Of course, my test of real utility for any Mac application is whether it has an AppleScript dictionary; it does! Unfortunately the scripting interface is not well documented, and frankly is obscure in its implementation of its functions. For me, and I’ve used a lot of applications’ Applescript interfaces, it has got to be one of the most non-intuitive.
But having said that, the interface has opened up the application so that from Applescript, you can literally design a label, and then print it, or as many as you so desire. Because you have direct access to the fields (that are referred to by unique names you choose) on the label, it is possible to directly link corresponding fields or field definitions in a database such as a text file, or Filemaker Pro or Excel. This makes the interface very powerful indeed.
Here is a simple example of how to populate the contents of a label and then print it. The data of course could come from any application, via AppleScript, that could provide appropriate strings- Excel, Word, Filemaker Pro, text file (manually edited)...
-- Vers 0.1 - Adapted from Dymo Mac_DLS_SDK_0508.dmg available from Dymo website -- Ian W. Parker. First worled on: 2009-03-28, Last worked on: 2009-03-28 -- this label model is taken from a standard Dymo label design: Address (99010).DLF -- saved and renamed set label_definition to "StuInfo(99010).DLF" tell application "DYMO Label" -- use label editor plugin functionality loadPlugin name "Label Editor" -- get label type file set label to labels folder & "/" & label_definition -- open label definition openLabel in label -- *********** normally make this into a loop ********** -- taking Name, Group, Class, Teacher info from a database file tell current plugin -- place content into named fields -- label must first be designed and have these named print objects set (content of (print object named "Name")) to "Ian Parker" set (content of (print object named "Group")) to "1" set (content of (print object named "Class")) to "S0812" set (content of (print object named "Teacher")) to "Mr. Parker" end tell -- force label to redraw in order to make changes visible on the screen redrawLabel -- remove comment on next line to print the label -- printLabel -- ************* End loop ************ end tell
This next version will accept data from a plain CSV text file (assumed to be on the desktop) of any number of data records, with the following format.
John Doe,1,S0812,Mr Parker
Note the absence of quotation marks to delimit text.
-- Vers 1.0 - Adapted from Dymo Mac_DLS_SDK_0508.dmg available from Dymo website
-- Ian W. Parker. First worked on: 2009-03-28, Last worked on: 2009-03-31
-- label model is based on a standard Dymo label size: <Address (99010).DLF>
-- -----------------------------------------------------------------------------------------
property eol : ASCII character 10
set label_layout to {}
set label_definition to "StuInfo(99010).DLF"
-- data file assumed CSV format without quotation marks
-- text file line format: <student name>, <group>, <class name>, <teacher name>
-- use a file chooser to find the data file (assumed on desktop)
set newfilePath to choose file with prompt ¬
"Choose Label Data File" default location (path to desktop) without invisibles
set fileRef to open for access newfilePath -- open the data file
-- set up DYMO labeler
tell application "DYMO Label"
activate
-- use label editor plugin functionality
loadPlugin name "Label Editor"
-- get label type file
set label_design to displayOpenFileDialog
--set label_design to labels folder & "/" & label_definition
-- open label definition file
openLabel in label_design
end tell
-- --------------------------------------------------------------------------------------
try -- reading a student record (one line at a time)
-- works for comma separated fields
repeat -- until error or end of file
set label_layout to read fileRef until eol using delimiter ","
-- hand to DYMO Labeler to process
tell application "DYMO Label"
tell current plugin
-- pass content into named fields
-- label must have these print objects on it
set (content of (print object named "Name")) to item 1 of label_layout
set (content of (print object named "Group")) to item 2 of label_layout
set (content of (print object named "Class")) to item 3 of label_layout
set (content of (print object named "Teacher")) to item 4 of label_layout
end tell
-- force DYMO Label to redraw changes so visible on the screen
-- as processing proceeds. Last label processed will remain visible
redrawLabel
printLabel
end tell
end repeat
on error number n
close access fileRef -- ensure clean closure of file access
if n is -39 then
display alert message "Processed all students " default button "OK"
else
display alert message "Error processing labels" as critical default button "OK"
end if
end try
