In the last blog, I started out with a simple label printing application using the DLS SDK. If you are planning on using the SDK, you’ll need to become familiar with two objects that will do the bulk of label printing work in your application. The first one the DymoAddin object, the other is the DymoLabels object. We will examine on the DymoAddin object in this post.
Background
The DymoAddin object got its name from the time when DYMO needed to create addins for 3rd party applications. Instead of re-writing all the label printing code in a separate library, then using the library to implement the 3rd party addins (like the DLS MS Office Addins, DLS ACT! Addin, DLS QuickBooks Addin), we simply added a COM interface to the DLS application so we can leverage the label printing functionality from the DLS application. The first interface exposed was called the IDymoAddin interface, and the object that implemented the interface was called the DymoAddin object.
There are many methods exposed in the IDymoAddin interface, however, only a part of it is really intended for the SDK. The methods that don’t fall in this group are there because we (i.e. DYMO) needed it to implement some functionality for the addins we write for other applications. Call it lack of planning or oversight, these methods and properties that are really meant for internal DYMO use are lumped together in the same IDymoAddin interface that is used for SDK applications. For the most part, you should avoid using these methods and properties in your application. But as you sit down to understand the DLS SDK and design your own application, you’ll likely find that these methods and properties are too specialized and are not needed for your SDK application.
But what are these functions and methods that you shouldn’t use? Instead of listing them here, I will instead focus on the methods that are meant to be used by SDK applications.
Main Functionality
In the last blog, I outlined the three main concepts used in the DLS SDK. The first is the concept of a label file. The main functionality of the DymoAddin object is to implement the IDymoAddin interface, which provides operations you can perform on a label file, including opening, saving, and printing a label file. Because printing is part of the functionality, the IDymoAddin interface also provides methods to list and select DYMO printers for use in your SDK application. I will explore these methods and their usage (in C#) below.
File Operations
The Open(), Save(), and SaveAs() methods combined to give you the ability to open and save labels on your computer’s local file system. The same operations can be used on network storage if the storage location is addressable using UNC (i.e. Universal Naming Convention).
The following example shows how to open a label file and then save it with a different file name:
1 private void FileOperatoinsExample() 2 { 3 DymoAddInClass _dymoAddin = new DymoAddInClass(); 4 5 // open a label file using absolute path, relative path 6 // or UNC (for network accessible locations) 7 if (_dymoAddin.Open(@"..LabelsSample.label")) 8 { 9 _dymoAddin.SaveAs(@"..LabelsSampleCopy.label"); 10 } 11 12 if (_dymoAddin.Open(@"C:UsersckhsuLabelsSample.label")) 13 { 14 _dymoAddin.SaveAs(@"C:UsersckhsulabelsSampleCopy.label"); 15 } 16 17 if (_dymoAddin.Open(@"\File ServerSharedLabelsSample.label")) 18 { 19 _dymoAddin.SaveAs(@"\File ServerSharedLabelsSampleCopy.label"); 20 } 21 } 22
Web Applications
Sometimes the label file you need is located in the cloud and you need to access it using an URL. The OpenURL() method is created for this purpose.
Proxy Server and Proxy Bypass
The OpenURL() method is implemented using WinInet. This means that the user’s proxy settings in IE is used when calling the OpenURL(). But depending on your application, this might not be desirable. You can use the following methods and properties to control proxy settings used for the OpenURL() method. These settings are good for the lifetime of the DymoAddinObject, but are not persistent beyond that. So if you free and create another instance of the DymoAddinObject, you will need to setup the custom proxy settings again for the next OpenURL call.
- ProxyBypass property – set to True to bypass all proxy servers. When this property is set to True, it overrides all other proxy settings.
- SetupProxySettings() method – setup custom proxy settings.
- ClearProxySettings() method – clear all proxy settings and revert back to using IE’s proxy settings.
The following example shows how to open a label file using an URL.
1 private void URLFileOperatoinsExample() 2 { 3 DymoAddInClass _dymoAddin = new DymoAddInClass(); 4 5 // use custom proxy setup. 6 // by default, the OpenURL() method uses the same proxy 7 // settings as IE 8 _dymoAddin.proxyBypass = false; 9 _dymoAddin.SetupProxySettings("http", "dymo_proxy_server", 80, "*.internal.dymo.*", "", ""); 10 11 // open a label file using URL 12 if (_dymoAddin.OpenURL("http://www.mylabelprinter.com/labels/shipping.lwl")) 13 { 14 _dymoAddin.SaveAs(@"LabelsSampleCopy.label"); 15 } 16 } 17
Database Operations
If your application uses a database to store label files, you can use the OpenStream() and SaveStream() methods to open and save label files using memory buffers.
The following example shows how to open and save label files into memory buffers:
1 private void OpenAndSaveStreamExample() 2 { 3 DymoAddInClass _dymoAddin = new DymoAddInClass(); 4 5 // this is the buffer that will hold an array of bytes 6 object buf = null; 7 8 if (_dymoAddin.Open(System.IO.Path.Combine( 9 System.IO.Directory.GetCurrentDirectory(), 10 @"DatabaseLabel.label"))) 11 { 12 // get an array of bytes from Save Stream 13 buf = _dymoAddin.SaveStream(); 14 15 // at this point, you can store buf as a blob 16 // in your database 17 byte[] blob = (byte[])buf; 18 } 19 20 // to open a label file from a blob in your database 21 // first, read the blob into into an array of bytes 22 // then pass the array of bytes to OpenStream 23 System.IO.MemoryStream ms = new System.IO.MemoryStream(); 24 25 // the following line is psuedo code aimed to illustrate how one 26 // might read a blob into an array of bytes 27 !!!Database.Table("Labels Table").Field("Shipping Label").SaveToStream(ms); 28 29 // at this point, you can read the bytes 30 _dymoAddin.OpenStream(ms.GetBuffer()); 31 } 32
Printer Related Operations
The DLS SDK (and therefore your SDK applications) can only be used with LabelWriter printers. Because of this, we added printer listing and selection methods to filter out printers that are not compatible with the DLS SDK so your application will not need extra code to deal with printer compatibility and selection issues.
The following example shows how to get a list of LabelWriter printers installed on the computer, and selects a printer named “My LabelWriter” to print a label file:
1 private void SelectPrinterAndPrintLabelExample() 2 { 3 DymoAddInClass _dymoAddin = new DymoAddInClass(); 4 5 string[] printers = _dymoAddin.GetDymoPrinters().Split(new char[] { '|' }); 6 foreach (var printer in printers) 7 { 8 // find the printer we want to print to 9 if (printer == "My LabelWriter") 10 { 11 // select it first 12 _dymoAddin.SelectPrinter(printer); 13 14 // then print the currently open label 15 if (_dymoAddin.IsTwinTurboPrinter(printer)) 16 { 17 // print one copy of label to the left tray 18 _dymoAddin.Print2(1, false, 0); 19 } 20 else 21 { 22 // print one copy of label to the only tray 23 _dymoAddin.Print(1, false); 24 } 25 break; 26 } 27 } 28 } 29
A new method worth mentioning is the IsPrinterOnline() method, which return the online/offline status of a printer.
Conclusion
Although the DymoAddin object’s name may not invoke any ideas of the functionality it provides, it is an important part of the because of the rich features it provides. I hope this blogs gives you a good idea of the DymoAddin object’s capabilities and how to best use the capabilities for your specific application.
I am trying to invoke the SaveStream method to get the bytes of a label. I get this exception:
Memory is locked. (Exception from HRESULT: 0x8002000D (DISP_E_ARRAYISLOCKED))
Any ideas?
This is running in an ASP .NET C# app using .NET 3.5. I am using the 8.2 SDK. I have tried several different versions but my code is this:
DymoAddInClass addIn = new DymoAddInClass();
if (addIn.Open(“HomeVisit.label”))
{
DymoLabelsClass labels = new DymoLabelsClass();
labels.SetField(“BARCODE”, “123456”);
labels.SetField(“TEXT”, “123456”);
labels.SetField(“TEXT_1”, “My Visit”);
labels.SetField(“TEXT_2”, “My Item”);
object theObject = addIn.SaveStream();
}
Hi,
Thank you for the question, it led me to find and fix a bug in the SDK. Anyway, here is the solution:
1. download the zip file containing the fix here.
2. extract the dll from the zip file into the Program FilesDYMODYMO Label Software folder (you will be prompted to replace the existing file, click Yes).
3. rerun your application, the problem will be fixed.
Because DLS 8.2.2.x is just released, the fix will not be there. However, we are making a DLS 8.2.3 release shortly to support x64 SDK applications. The fix will be in that release. For now, you can use the zip file as a workaround. I apologize for the troubles.
Best,
CK
Hi,
I try a following cod snippet but I get 2 error in a code.
I marked both error on code (Here1, and Here2)
Imports System.ComponentModel
Imports System.Text
Imports Dymo
Public Class InsertNewParts
Private Sub Print_Label(ByVal sender As Object, ByVal e As EventArgs)
Dim _dymoAddin As New DymoAddInClass()
Dim _dymoLabel As New DymoLabelsClass()
‘Dim peldany As Int32 = Val(Me.TextBox1.Text)
‘ open the to-do-list label we created earlier
If _dymoAddin.Open(“C:UserDataDymodbarcode.label”) Then
‘ this call returns a list of objects on the label
Dim objNames() As String = _dymoLabel.GetObjectNames(False).Split(New Char() {“|”c})
‘ verify that our text object is on the label
If objNames.Contains(“code1”) Then <<<< Here1. 'Contains' is not a member of 'system.Array'
' take the to-do's list entered by the user
' and put in on the label
If _dymoLabel.SetField("todos", NewIdTbx.Text) Then
' let's print to the first LabelWriter available
' on the pc, if the printer is a TwiTurbo, print
' to the left tray
Dim printers() As String = _dymoAddin.GetDymoPrinters().Split(New Char() {"|"c})
For Each printer In printers <<< Here 2. Name 'printer' is not declared….
If printer Is "SpareP_LabelWriter" Then
' select it first
_dymoAddin.SelectPrinter(printer)
' then print the currently open label
If _dymoAddin.IsTwinTurboPrinter(printer) Then
' print one copy of label to the left tray
_dymoAddin.Print2(1, False, 0)
Else
' print one copy of label to the only tray
_dymoAddin.Print(1, False)
End If
End If
next
End If
End If
End If
End Sub
End Class
Visual Studio 2005
Net-framework 2.0
I wait for your answer.
Thanks and Regards
Robert
for #1 – System.Array class does not have Contains method. Try Exists() or Find() instead.
for #2 – you did not declare Printer variable
Hi Vladimir,
I try a following version (modification):
In the version not visible error, but after call the sub I get error messages….
This is a Sub:
Private Sub Print_Label()
Dim _dymoAddin As New DymoAddInClass()
Dim _dymoLabel As New DymoLabelsClass()
Dim printer As Object
‘ open the to-do-list label we created earlier
If _dymoAddin.Open(“C:UserDataDymodbarcode.lwl”) Then
‘ this call returns a list of objects on the label
Dim objNames() As String = _dymoLabel.GetObjectNames(False).Split(New Char() {“|”c})
‘ verify that our text object is on the label
If objNames.Equals(“WLOK_BARCODE”) Then
‘ take the to-do’s list entered by the user
‘ and put in on the label
If _dymoLabel.SetField(“WLOK_BARCODE”, NewIdTbx.Text) Then
‘ let’s print to the first LabelWriter available
‘ on the pc, if the printer is a TwiTurbo, print
‘ to the left tray
Dim printers() As String = _dymoAddin.GetDymoPrinters().Split(New Char() {“|”c})
For Each printer In printers
If printer Is “DYMO LabelWriter 400″ Then
‘ select it first
_dymoAddin.SelectPrinter(printer)
‘ then print the currently open label
If _dymoAddin.IsTwinTurboPrinter(printer) Then
‘ print one copy of label to the left tray
_dymoAddin.Print2(1, False, 0)
Else
‘ print one copy of label to the only tray
_dymoAddin.Print(1, False)
End If
End If
Next
End If
End If
End If
End Sub
This is the error:
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147221164
Message=”Creating an instance of the COM component with CLSID {09DAFAE2-8EB0-11D2-8E5D-00A02415E90F} from the IClassFactory failed due to the following error: 80040154.”
Source=”SPAREPART INVENTORY SYSTEM”
StackTrace:
at SPAREPART_INVENTORY_SYSTEM.NewParts.Print_Label() in C:UserDatamilusVisualStudio_ProjectsSPAREPART INVENTORY SYSTEMSPAREPART INVENTORY SYSTEMNewParts.vb:line 107
at SPAREPART_INVENTORY_SYSTEM.NewParts.Button1_Click(Object sender, EventArgs e) in C:UserDatamilusVisualStudio_ProjectsSPAREPART INVENTORY SYSTEMSPAREPART INVENTORY SYSTEMNewParts.vb:line 62
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at SPAREPART_INVENTORY_SYSTEM.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
if you are running Windows 32-bit, make sure you have the latest DYMO Label installed. You can download it from http://www.labelwriter.com/software/dls/win/DLS8Setup.8.2.2.996.exe
if you are running Windows 64-bit then there are two options:
– make your application 32-bit. http://www.google.com/search?hl=en&client=firefox-a&hs=TjD&rls=org.mozilla%3Aen-US%3Aofficial&q=compile+VB.NET+app+32-bit&aq=f&aqi=&aql=&oq=&gs_rfai=
– install DYMO Label 8.2.3 that has 64-bit support http://developers.dymo.com/2010/05/25/8-2-3-sdk-beta-release/
Hallo Vladimir,
I hope you are fine.
My program running under 32 BIT, and WinXp
I installed latest program for printer (8.2.2.996)
I created label file etc. everything is fine.
But I when “click”
on Print button then nothing.. nothing happens, and the printer does not react, and then I do not receive an error messages
I attached ftp link with my test program src:
http://printsrc.freeweb.hu/src/PrintersBarcode.zip
I would like to ask for you if you have little free time then you would be able to test the program possibly what may be the trouble how?
Thanks and Regards
you have to debug your application a little bit.
you cannot call objNames.Equals(“todos”) because objNames is Array and “todos” is a String. Use Find or Exists instead.
check the printer name you are using, currently it is “DYMO LabelWriter 400″ Then” that is wrong.
I can’t get the OpenURL() method to work. It always returns false. I’m doing this in Javascript in the browser. I have tried using a URL on the same domain as well as on another domain (should that make any difference?) It works neither in Firefox or IE. I’m not using any special Internet settings, and therefore haven’t configured any custom proxy. In Firefox the DLS SDK 1.2.0.4 is installed. It all works fine with a local file using Open(), but not using a URL with OpenURL(). I have version 8.2.2.996 of the software installed. How can I debug this? Possible to get specific error messages?
BTW, is there a complete language reference with all the methods and properties? The SDK 8.0 only contains the PDF “DLS 7 Compatibility Library Manual.pdf” which basically only describes certain enhancements to the original objects…
What does happen when you open the URL passed to OpenURL() directly in the browser? does the browser open it? I mean, verify that the URL is accessible.
As for documentation, “DLS 7 Compatibility Library Manual.pdf” contains a full list of supported methods, not the changed ones only. Please, read carefully.
sir,
i developed windows application with DYMO label writer400… , when published into server. when print page renders it is giving “retrieving the COM class factory for component with CLSID {09dafae2-8eb0-11d2-8e5d-11d2-8e5d-00a024-15e90f} fialed due to the following Error.”
please can you help how to render this page.
Thnaks Regards
manoj
Hi,
I’m writing a little application for Excel 2003 using VBA.
So far i got something working but i would like to READ also the label Height, Width Left, … properties, but can’t figure out how to do.
Can someone help me?
Any help apreciated.
Sub PrintLabel()
‘deze routine werkt 100% !
‘
‘voor ontwikkel info zie : http://developers.dymo.com/
‘
Dim myDymo As DYMO_DLS_SDK.DymoHighLevelSDK
Dim DymoAddIns As DYMO_DLS_SDK.ISDKDymoAddin
Dim DymoLabels As DYMO_DLS_SDK.ISDKDymoLabels
Dim Q
Dim Cntr As Integer
‘preset values & objects
PrintString = frmDymo.tbBarcode.Value
‘skip if nothing to print
If PrintString “” Then
Set myDymo = New DYMO_DLS_SDK.DymoHighLevelSDK
Set DymoAddIns = myDymo.DymoAddIn
Set DymoLabels = myDymo.DymoLabels
PrintLabelCopies = frmDymo.tbPrintLabelCopies.Value
‘get printer
DymoAddIns.SelectPrinter DymoAddIns.GetDymoPrinters
‘get label
DymoAddIns.Open (ThisWorkbook.Path & “Labels” & DymoLabelName) ‘
‘**************
Dim objNames(20) As String
myObjectnames = DymoLabels.GetObjectNames(False) ‘<< returns ONLY the "MyBarcode" name.
'be sure to set the barcodeprint mode
DymoAddIns.SetGraphicsAndBarcodePrintMode (True)
'
DymoLabels.SetField "MyBarcode", PrintString
DymoAddIns.StartPrintJob
For Cntr = 1 To PrintLabelCopies
If DymoAddIns.IsTwinTurboPrinter(DymoPrintername) = True Then 'print one copy of label to the left tray
Q = DymoAddIns.Print2(PrintLabelCopies, False, 0)
Else
Q = DymoAddIns.Print(1, False) 'print one copy of label to the only tray
End If
PrintLabelCopies = PrintLabelCopies – 1
Next
DymoAddIns.EndPrintJob
'release objects
Set DymoLabels = Nothing
Set DymoAddIns = Nothing
Set myDymo = Nothing
Else
'
End If
End Sub
Regards,
Ludo
to do that you will need to use so called “low level” API. There is no sample in VBA, but the steps are: create LabelEngine object; access LblInfo by using LabelEngine.PrintObjects property; then you can get label properties like LabelWidth, LabelHeight, etc. See documentation for the detail, or C++ sample in the “SamplesLow Level COM” folder.
BTW, out of curiosity, what is your use case? why do you need to access those properties? Thanks.
Hi Vladimir,
Thanks for the fast feedback.
The main purpose of the little utility is as follow.
Using a hand scanner, we copy a barcode (Code 128) and printout a (few) copie(s) of it, without the need of clicking on a ‘Print’ button. So when ever the barcode is scanned, it will be automaticly printed in x copies. I dont think the the Excel add-in is able to do so, because i’m asked for this ‘enhancement’, thats why i’m writing this little application’.
I’m also no software engineer at all, i do it just because i like it to write some utilities for the group i’m working for. Pure interest.
Reading the label info ( + text position on the label) is informative info on the userform.
Could be of little interest if we want to print a too long text on a certain label.
I noticed that you get the text “Barcode doesn’t fit” on the label if the text is to long (or the size is too large to fit).
What i find as a shortcomming is the absence of little examples on how to use the components and there properties in the DLS 7 Compatibility Library Manual.pdf, like you find back in the Help (F1) in the VBA editor. Thats realy handy.
Regards,
Ludo
Thought it is possible to get barcode object position and size on the label, it will not help in determine is the actual barcode fit or not. Barcode object size is fixed, while the actual size of “bars/spaces” depends on the entered/scanned data. Depending on the barcode type you are using you might determine the maximum number of character a current barcode object can hold on a particular label and warn user if the number of entered/scanned character is greater. What barcode type are you using (Code39, Code128, etc)? Usually the barcode size depends on overall number of characters, not the characters themselves, thought sometimes it is important to know the exact string to encode…
Hi again,
We use ‘normally’ Code128 and label 99017.
The scanned barcode to copy on the new labels is only build up with numbers 0 to 9.
The string lenght is 10 characters long ex: 1890221234
I noticed alreddy while experimenting that the barcode doesn’t fit always. I changed the barcode size from “Medium” to “Small” using the DYMO Label V8 application, and now it fit. For the moment i didn’t check how many characters there fit on the specified label.
Once i know that, i can write it also into the registry settings using something similar as following VBA code:
SaveSetting appname:=ThisWorkbook.Name, section:=”Startup”, key:=”LabelName”, setting:=DymoLabelName
So, knowing witch human readable character uses the most space in “Barcode bars / spaces” can help me determine the maximum number of allowed characters to scan.
According to what i found on Wikipedia is this the letter “X”, right?
Thanks again for the quick responce.
Regards,
Ludo
Hi there,
I have, on my Dev PC a LabelWriter 400 installed and my code for quick print on a single label works fine
When installed at the customer site, where they have a Dymo 460 printer I am getting the following error:
Unable to cast COM object of type ‘Dymo.DymoAddInClass’ to interface type ‘Dymo.IDymoAddIn5’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{A1CD66DC-6A1F-4FD6-A7EF-57D00E28E00A}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
I tried installing the customers drivers on my machine but it gives the same error here then
Dymo.DymoAddInClass dymo = new Dymo.DymoAddInClass();
dymo.SmartPasteFromString(sAddress); //errors on this line
I tried dymo.StartPrintJob() instead and declaring labels etc but ti then errored there instead.
What have i done wrong?? – any help much appreciated
Cheers James
DYMO Label software should be installed on the customer machine.
Hi Vladimir,
I’m afraid you might have misunderstood me – I meant when the Application that I have written, that allows the users to print labels is installed on their site.
cheers james
Your application uses DYMO DLS SDK. So, DYMO DLS SDK libraries should be installed on the machine your application is running on. So, DYMO Label software should be installed on that machine, because DYMO Label software installer installs all needed libraries for an SDK application.
Hi Vladimir,
thanks for that – I will try installing the same version of the SDK on the customers machine – I didn’t think installing the SDK would be necessary so I only installed the drivers when installing the printer as I thought that my applications msi installer would include and install all of the files necessary for it to connect.
cheers and thanks for your replies
james
Hi,
We have web page with javascript which is generating and printing label. It works fine with Internet Explorer in version 6. But now some users upgraded IE to version 8. With IE script fails with error “Automation server can’t create object” when DymoAddIn object is being created in the javascript code:
var DymoAddIn = new ActiveXObject(“Dymo.DymoAddIn”);
Can you advise how to deal with this issue?
Make sure users have DYMO Label 8.3 installed. Also, make sure ActiveXs are enabled in IE settings.
Hi!
I need to print tape labels via the lower print head of the LabelWriter Duo.
I am using VBA (or VB6, if you prefer) with Access 2010. The ‘old’ DLS calls no longer work with the new Ver. 8 DLS! What happened to ‘DymoTapeAddIn’?
Please, where is the documentation for the new VBA ver. 8 framework & examples?? I have donwloaded two versions of your SDK and neither one contains the info required to deal with VBA.
Where did the declarations such as ‘DYMO_DLS_SDK.DymoHighLevelSDK’ shown in post #5 come from? I haven’t seen this in any docs from Dymo.
I really need this info soon.
Thanks in advance!
IDymoTapeAddIn is not supported in DLS8. To print on a tape printer you have to use DYMO Label Framework API. Unfortunately there is almost zero documentation and samples for the COM part of the API. You could kind of deduct it the usage from the TLB file and .NET documentation available in BETA SDK in [My Documents]DYMO LabelSDKDYMO Label FrameworkdocDYMOLabelFramework.chm. I know, it is very limited, and I apologize for inconvenience. As for VBA sample, you can find a Access 2010 sample database here.
I cannot get the DymoAddIn.open() working it just return false. any advice ( i am using VC sharp).
make sure you have the latest DLS version installed, that at time of writing is 8.3.0.1242 available from here.
Hi, I found this problem,too
I use VBscript to DymoAddIn.open() and have already installed 8.3.0.1242.
make sure you have DLS 8.4.0 (http://download.dymo.com/download/Win/DLS/DLS8Setup.8.4.0.1524.exe) installed.
its solved,
but print incomplete label, could you provide solution?
Thanks.
I have a Delphi application using the Dymo COM objects.
Some of our users are starting to install Dymo LabelWriter 450 Twin Turbo machines with Dymo v 8 software. Labels saved using this are in the .label format.
The SDK library procedures for GetObjectNames that worked in the previous versions of the Dymo labels do not work with the .label formats.
I loaded down the SDK for version 8 but that has no Delphi support options like the previous versions did. The code also needs to be able to work with all versions of Dymo software and printers.
Are there any options for me to get around this?
There are two ways to fix this. Ether install an update to DLS7 that adds LW450 support, http://www.dymo.com/media/Software/DLS_7_Update.zip; or make sure the customers install the latest version of DLS8, as of 2011-09020 it is 8.3.1, http://download.dymo.com/download/Win/DLS8Setup.8.3.1.1332.exe. The latter way is more preferred in a long run.
Thanks for the response Vladimir.
However, this does not get around my issue that I want to have access to SDK functionality within my Delphi software to support the v8 Dymo software (I can sort out having separate functionality to cope with different sites running different versions of the Dymo labels), but the SDK for v8 does not include any Delphi COM objects that allow me to communicate with labels created in v8 with the .label extensions.
The SDK API in DLS8 is backward compatible, really it provides EXACTLY the same COM interfaces. You can just install DLS 8.3.1 and use your application without recompilation.
Thats fantastic that it is backwards compatible which should mean I don’t have to change my code for the different versions of Dymo printers and label templates.
However, this still leaves me with the fact that there is nothing in the v8 SDK for Delphi. What I was expecting was to have a Delphi directory under High Level Com that contained the Dymo_TBL.pas file that contained the procedures to interface with the printers as there was in the previous versions of the SDK. With the SDK for version 7, the GetObjectNames procedure does not return the objects in a v8 .label template presumably because it doesn’t know that the template file is now an XML document. Therefore I cannot assign contents to the fields on the label so when it then goes to print the label it just produces a blank label.
Make sure you have DLS 8.3.1 installed
I have Dymo Label 8.3.1.1332 and the DYMO Label v.8 SDK (not sure if there is any version number assigned to that) which has a DLS 7 Compatibility Library directory that has a Samples directory which contains a High Level COM directory – under this there are directories for dotNet, Firefox, etc but not one for Delphi as there was in the DLS_SDK for version 7.
Yes, Delphi samples were excluded from DLS8 SDK installer. Please, notice, that the SDK installer contains documentation and samples only, not libraries. Libraries are included with DLS installer itself. And the SDK API is fully binary compatible, although the implementation is different. You can install DLS7 SDK to view old Delphi samples, it is available on http://sites.dymo.com/DeveloperProgram/Pages/LW_SDK_Windows.aspx, http://download.dymo.com/Download%20Drivers/Software%20for%20DYMO%20LabelWriter/Downloads/13/WIN_DLS_SDK_0508.EXE.
If you want to recreate Dymo_TLB.pas (though it is not necessary), use “Project/Import Type Library” menu item in Delphi7, select “DLS SDK COM Type Library”, and press “Create Unit” button.
Now, if you still have a problem (after installing DLS 8.3.1) with GetObjectNames method, please send the label file and the code fragment shows how you call the SDK. Thanks you.
I have version 8.3.1.1332.
I note that in the Dymo_TBL, there are separate IDymoAddins up to IDymoAddin5. Numbers 4 and 5 have procedures for IsTwinTurboPrinter. However, if I try to create an IDymoAddin4 object, I get a Class not registered error message and can’t create the ActiveX object with code below
const
//Dymo Library classes names:
IDymoAddInName = ‘Dymo.DymoAddIn4’;
IDymoLabelsName = ‘Dymo.DymoLabels’;
{ TDymoLabel }
constructor TDymoLabel.create(aOwner: TComponent);
begin
inherited create(aOwner);
//Create Dymo Label ActiveX objects.
try
DL := CreateOleObject(IDymoAddInName) as IDymoAddIn4;
LB := CreateOleObject(IDymoLabelsName) as IDymoLabels;
except
MsgWarning(‘Unable to create Dymo Label ActiveX objects.’);
end;
end;
Does this suggest that the Dymo 8 software has not installed all the classes required and that maybe that is why I cannot get the fields in the label file for the .label files. I was just using the base IDymoAddin object and using the code below which was passed a stringlist of field names and data and the label file to print to get the fields from the label file and print the label. The LB.GetObjectNames(True), didn’t return anything. Also included below is the contents on the .label file.
procedure TDymoLabel.InstantPrintLabel(FieldValues: TStringlist; LabeFile: string;
aCopies: byte = 1; PrintIt: boolean = True);
var
ObjectList: String;
FieldList: tstringlist;
i: integer;
begin
//Create Dymo Label ActiveX objects.
if fileexists(LabeFile) then begin
DL.Open(LabeFile);
FieldList := TStringlist.create;
ObjectList := LB.GetObjectNames(false);
TokenToStringList(LB.GetObjectNames(True),’|’,FieldList);
For i := 0 to FieldList.Count – 1 do
LB.SetField (FieldList[i], StrToDef(RepStr(FieldValues.values[FieldList[i]],’/n’,#13#10),’ ‘));
FieldList.free;
if PrintIt then
DL.Print(aCopies, false);
end
else
LogAppError(‘File not found ‘ + LabeFile,1,”);
end;
Landscape
Shipping
30323 Shipping
CLIENTSHORTNAME
Rotation180
False
True
Left
Top
ShrinkToFit
True
False
Client short name
CLIENTSHORTNAME2
Rotation0
False
True
Left
Top
ShrinkToFit
True
False
Client short name
Thanks
First, COM-class ProgID and the interface name(s) the class support are different things. So, in your code you have to create the object by providing its ProgID, that is ‘‘Dymo.DymoAddIn’, not ‘Dymo.DymoAddIn4′. You still can cast/QueryInterfrace the object to IDymoAddIn4 if you need to access the new methods defined by this interface. Second, it is hard to say why you don’t get object names without debugging. Here are some tips:
– make sure DL.Open(LabeFile) completed succe3ssully. The call returns True on success, False otherwise. If it returns False, make sure the label file does exists, and it is a valid label file. To check it is a valid label file, try to open it using DYMO Label software v8.
– call LB.GetObjectNames(True) and check the result. It should be non-empty string, assuming your label file loaded correctly and the label file contains some label objects.
– install DebugView, run it, run your application, look for any error messages in DebugView
Hi Vladimir,
Setting the class correctly and using the DymoAddin4 appears to have solved the problems. I am now getting the fields in the .label labels as well as being able to process labels created with earlier versions of the Dymo software.
Many thanks for your help with this.
Anytime
Hi,
I have a working Excel VBA application on XP & Excel2003 with a older version of the DLS8 SETUP.
Because of rumors that the company will switch to Win7 / Office2010 i’m trying to get it working on my PC at home
(VISTA / Exel2007), and hope it will work then also on Win7 & Excel2010.
I don’t have a 450Turbo printer at home too.
I installed the DLS8Setup.8.3.1.1332 on the Vista (without a 450 Turbo printer connected at the end of the installation) and checked the checbox ‘DYMO Label software V.8 SDK’ in the VBE references listbox.
I use the same XLA utility as on the XP / Excel2003 machine, but it won’t work at all.
I can’t create the ‘Dymo.DymoAddin’ object.
Here below a snipset of the VBA code.
Anyone any clue why it can’t create the Dymo.DymoAddin object, but does on the XP/ Excel2003 machine?
I need to get it working before the switch to Win7 / Office2010.
Could it be that its because i haven’t connected a DYMO printer at the end of the installation?
——————————————————-
Sub TestIfOnline()
If CreateDymoPrinterObjects Then
Application.Cursor = xlWait
With g_oDymoPrinter
g_sDymoPrintername = .GetCurrentPrinterName
g_bOnLine = .IsPrinterOnline(g_sDymoPrintername)
End With ‘//g_oDymoPrinter
If Not g_bOnLine Then
g_iMyErrorNumber = 1
frmError.Show
End If
Application.Cursor = xlDefault
End If
End Sub
———————————————————
Function CreateDymoPrinterObjects() As Boolean
‘This fuction creates IDYMOAddIn object
On Error Resume Next
If (g_oDymoPrinter Is Nothing) Then
Set g_oDymoPrinter = CreateObject(“Dymo.DymoAddin”) ‘
End If
CreateDymoPrinterObjects = (Err = 0)
If Not CreateDymoPrinterObjects Then
MsgBox “Unable to create OLE objects: Dymo.DymoAddin”
End If
End Function
——————————————–
Any help welcome.
Regards,
Ludo
Hello,
I have a VB.Net 2003 application that use to be installed on windows XP machine, Now my clients uses windows 7/8 but when my application try to call the dymo labelprinter 400 Turbo I got error saying “COM object with CLSID {09DAFAE2-8EB0-11D2-8E5D-00A02415E90F} is either not valid or not registered.” can you please guide me on how to make this work again with windows 7 or windows 8 Please?
Thanks A lot!!
Make sure you have DYMO Label Software installed on the machine. This is a requirement for SDK applications to run. You can download here:
http://www.dymo.com/en-US/online-support/dymo-user-guides
Hello,
in delphi I try to make an easy program to print a label.
Everything seems to go fine untill the moment of printing.
then I get: “floating point invalid operation at …”
The coding I use looks like:
unit DymoApp;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Dymo_TLB, ComObj;
type
TForm2 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
DL : IDymoAddin;
LB : IDymoLabels;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
DL := CreateOleObject(‘Dymo.DymoAddIn’) as IDymoAddin ;
LB := CreateOleObject(‘Dymo.DymoLabels’) as IDymoLabels;
Label1.Caption := DL.GetDymoPrinters ;
if DL.Open(‘J:\ABPf-Software\EtiketLabel.label’)
then
begin
LB.SetField(‘NAAM’,’EUKANUBA hond 10kg’);
LB.SetField(‘PRIJS’,’€14,95′);
LB.SetField(‘STREEPJESCODE’,’1234′);
DL.Print(1,FALSE);
end;
end;
What do I miss?
I’ll start by asking if you have the latest DLS (8.5.1) installed and can you print successfully from the DLS application? DLS is a required install for any SDK application to work.
I’m not very familiar with Delphi but can you narrow down what line is throwing the error? I noticed that you are not checking the return for DL or LB to see if it returned a valid structure. I would start there. Maybe another reader that is familiar with Delphi could help out.
Hi
I am having trouble with some code written in Visual Studio 2010 Visual Basic. I took this code from something I had written earlier for Excel VBA and it worked fine. I had to tweak the code a little for VS 2010 but everything works except one thing. The “myLabel.SetText(“TEXT”, texttoprint) will not send text to the field on the label and actually gives an error saying “Missing Member Exception was unhandled”…”Public member ‘Settext’ on type ‘Boolean’ not found.” I have listed the code below. I feel I am doing something wrong in the creation of the label object. Can you please help?
Thanks, Kevin
Private Sub printlabel(labeltoprint As String, texttoprint As String)
‘print module
Dim myDymo As New Object
Dim myLabel As New Object
Dim sPrinters As String
Dim arrPrinters() As String
‘On Error Resume Next
myDymo = CreateObject(“Dymo.DymoAddIn”)
myLabel = CreateObject(“Dymo.DymoLabels”)
If (myDymo Is Nothing) Or (myLabel Is Nothing) Then
MsgBox(“Unable to create OLE objects.” & Chr(10) & “Please Install Dymo Printing Software” & Chr(10) & “and make sure that a Dymo printer is available.”)
Exit Sub
End If
‘Check forDymo printer(s)
‘If there is one proceed and store the printernames in a variable, else quit
sPrinters = myDymo.GetDymoPrinters()
If sPrinters = “” Then
MsgBox(“No Dymo Printers Found”)
Exit Sub
End If
myDymo.SelectPrinter(sPrinters(0)) ‘0 is first Dymo printer, you could use the printername instead: SelectPrinter “YourPrintername”
‘Open the label template
myLabel = myDymo.Open(serverlocation & labeltoprint)
myLabel.Settext(“TEXT”, texttoprint)
‘Print the label
myDymo.StartPrintJob()
myDymo.Print(1, False) ‘ Print 1 copy
myDymo.EndPrintJob()
‘Clean up
myLabel = Nothing
myDymo = Nothing
‘reset label checkboxes
CheckBox2.Checked = False
CheckBox3.Checked = False
CheckBox4.Checked = False
CheckBox5.Checked = False
CheckBox6.Checked = False
CheckBox7.Checked = False
ComboBox1.SelectedIndex = -1
End Sub
Please make sure that the latest DLS v8.5.1 is installed.
If DLS is already installed, are you able to print from DLS? If yes, are you able to print from the following sample app?
http://labelwriter.com/software/dls/sdk/samples/DymoLabelFramework.accdb
Yes, I have DLS v8.5.1 installed. I can print fine from DLS and the sample you gave me printed slowly but worked and printed 2 labels. Does that help narrow down the problem? Thanks for your help!
Also, just so you know. The code I have will print the correct label I choose with the correct background image, it just will not put the text in the “TEXT” box object.
Thanks, Kevin
Please make sure that opening the label template was successful. Are you loading the label template from a network path? If yes, try loading the label template locally?
The label template is on a server, but even opening it locally, it still gives and error on the “myLabel.Settext” command saying it is not a command in the label object. If I leave in the “On Error Resume Next”, it will print the correct label but there is not text in the text box of the label. Do I need to be creating the label object using “Framework”? If so, how do I do that. Do you have any samples in VB for Visual Studio 2010 or VB.Net (if that is what Visual Studio 2010 uses. The sample you referred to in the link earlier is also in VBA)?
The “myLabel = CreateObject(“Dymo.DymoLabels”)” worked in VBA for Excel on the same label templates (on the server) but will not work with VB in VS 2010. I see examples on the internet where people use a “Framework” in creating the Dymo and Label objects, or they use IDymo and ILabel. I just want to make sure I am creating the Label Object correctly.
Thanks. Kevin
Actually, I don’t think it is opening the label template correctly. If I debug along the program, it creates the “myLabel” as an object (System._ComObject). But then after it runs the “myLabel = myDymo.Open(serverlocation & labeltoprint)” command, it shows myLabel as being “False{Boolean}”. Is there a different command I should use to open the label file?
Correct, the sample I have referred above is in VBA. DYMO doesn’t have any other VB/VBA sample. The sample is using the “DYMO.Label.Framework” and OpenLabelXml() to load the label template.
Are you using an old label template (lwt or lwl file extension)? Please make sure you are using the new label template (label file exension). Use DLS 8.5.1 to design your label and save it as a label template.
I am using the “.Label” file extension. Can you tell me if I need to “Import” anything at the top of my code to have the “Framework” incorporated into the programming? Also, do I need to use the Framework for creating the “myDymo” dymo object as well or just for the “myLabel” label object?
So if I change code to the following, would I need to make other changes?
Dim myDymo As New Object
Dim myLabel As New Object
then
myDymo = CreateObject(“Dymo.DymoAddIn”)
myLabel = CreateObject(“Dymo.Label.Framework”)
then
myLabel = myDymo.OpenLabelXml(serverlocation & labeltoprint)
myLabel.Settext(“TEXT”, texttoprint)
would that seem to be correct?
Thanks and sorry for so many questions,
Kevin
Here comes the embedded code of the DymoLabelFramework.accdb:
Option Compare Database
Option Explicit
Private Sub Form_Load()
LoadPrinterList
End Sub
‘loads available printers into PrinteRList listbox
Private Sub LoadPrinterList()
Dim Framework As IFramework
Dim PrinterCount, i As Integer
Dim Printer As IPrinter
Set Framework = CreateObject(“DYMO.Label.Framework”)
PrinterCount = Framework.Printers.Count
For i = 0 To PrinterCount – 1
‘PrinterList.AddItem Framework.Printers.Item(i).Name
If i > 0 Then
PrinterList.RowSource = PrinterList.RowSource & “;”
End If
PrinterList.RowSource = PrinterList.RowSource & Framework.Printers.Item(i).Name
Next i
‘ select first printer if any
If PrinterList.ListCount > 0 Then
PrinterList.Selected(0) = True
End If
End Sub
Private Sub PrintButton_Click()
Dim Framework As IFramework
Dim PrinterCount, i As Integer
Dim Printer As IPrinter
Set Framework = CreateObject(“DYMO.Label.Framework”)
Set Printer = Framework.GetPrinterByName(PrinterList.Value)
If Printer.PrinterType = “LabelWriter” Then
Call PrintLabelWriterLabel(Framework, Printer)
Else
Call PrintTapeLabel(Framework, Printer)
End If
End Sub
Private Sub PrintLabelWriterLabel(Framework As IFramework, Printer As IPrinter)
Dim LabelXml As String
Dim LabelSet As ILabelSetBuilder
Dim LabelRecord As ILabelRecordBuilder
Dim PrintParams As ILabelWriterPrintParams
Dim Label As ILabel
‘load label xml
LabelXml = DFirst(“LabelXml”, “Labels”, “LabelName = ‘Address'”)
Set Label = Framework.OpenLabelXml(LabelXml)
‘ populate data to be printed
Set LabelSet = CreateObject(“DYMO.Label.Framework.Com.LabelSetBuilder”)
‘ you can add multiple ‘records’ into a label set. Each record represents data for one label to be printed
Set LabelRecord = LabelSet.AddRecord()
‘ each record might contain several ‘fields’ contain data for one label object, in the case below for ‘ADDRESS’ object
Call LabelRecord.AddText(“ADDRESS”, LabelText.Value)
‘ create print parameters
Set PrintParams = CreateObject(“DYMO.Label.Framework.LabelWriterPrintParams”)
PrintParams.PrintQuality = LabelWriterPrintQuality_BarcodeAndGraphics
PrintParams.RollSelection = RollSelection_Auto
Call Label.PrintLabelSet(Printer, PrintParams, LabelSet.XML)
End Sub
please suggest me what need to do
I have 7.8 version installed
I am using interopdymo.dll into refrences & using VS2013
Unable to cast COM object of type ‘Dymo.DymoAddInClass’ to interface type ‘Dymo.IDymoAddin6’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{0C7AADEF-16FC-400D-A827-3F7A93A94DF7}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). ,Stack Trace: at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
what need to change so i can create Dymo.DymoAddIn object & use its methods.
Thanks
Kalpesh
Please make sure that you have the latest DLS 8.5.1 installed.
Hello,
I am having issues running asp.net/vb.net web app. It works locally in local host, but once deployed to stage server, i am getting:
Windows 2012, target x86.
Creating an instance of the COM component with CLSID {09DAFAE2-8EB0-11D2-8E5D-00A02415E90F} from the IClassFactory failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Please help.
Thanks
Al
Here is my code:
Public DymoAddIn As DYMO.DymoAddIn = New DYMO.DymoAddIn
Public DymoLabels As DYMO.DymoLabels = New DYMO.DymoLabels
If DymoAddIn.OpenURL(txtLabelUrl.Text) Then
‘set printer
DymoAddIn.SelectPrinter(txtPrinterName.Text)
‘set label object
DymoLabels.SetField(txtObjectName.Text, txtObjectData.Text)
Dim TraySelection As Integer = 2
‘ check if selected/current printer is a twin turbo printer
Dim twinTurbo As Boolean = DymoAddIn.IsTwinTurboPrinter(txtPrinterName.Text)
If twinTurbo Then
‘ show the current tray selection if the printer
‘ is a twin turbo
Dim i As Integer = DymoAddIn.GetCurrentPaperTray()
If i = 0 Then
TraySelection = 0 ‘ left tray
ElseIf i = 1 Then
TraySelection = 1 ‘ right tray
ElseIf i = 2 Then
TraySelection = 2 ‘ auto switch
Else
TraySelection = 2 ‘ tray selection not set, so default to auto switch
End If
End If
DymoAddIn.Print2(1, False, TraySelection)
End If
Hi Al…
Based on your error message it looks like you may not have DLS installed on your stage server. Try to install DLS there, print a label from DLS to make sure everything is good and then retry your code.
Ron
Creating an instance of the COM component with CLSID from the IClassFactory failed due the following : 80040154 for C# desktop based application.
I have installed Dymo 8.0.0 in our system. please suggest what we can do to fix this issue,
Please install the latest DLS (DYMO Label Software) 8.5.1 which can be found here http://download.dymo.com/dymo/Software/Win/DLS8Setup.8.5.1.exe
Are you running your C# application in a client-server environment? If yes, are the printers locally attached or at the server side? Where has DLS been installed? What kind of OS are you using?
Are you able to print from DLS?
thanks for your prompt reply,
i am developer, i dont have attached printer with my VDI locally,we are sharing the exe to the user and those user are in the factory when they use the application they will have the printer installed with them.
but i am getting errror while developing the applcation
Hi ,
I am using windows -7 OS,
DLS installed at client machines
DYMO software installed at development machine as well, currently i am using 8.2.0 but i am failed to fix this issue, please suggest
The COM error indicates that the required DYMO COM binaries can’t be found. Either DLS isn’t being installed or it is an access/security issue. Sometimes an AntiVirus/Security software is causing such an issue.
Your are running an old DLS version. I strongly recommend to use the latest DLS 8.5.1 version and make sure that you can print from DLS.
Hi,
I tried to print label with bar code of 15 character ,which I was pass from the program.The problem is ,while printing the label the bar code part shows the error message that ” the text is too large”.
Hi,
You will need to adjust the size of your barcode object in your label file. Once the data is too big for the object, this message is displayed. The only solution is to adjust the size of your barcode object.
What happened to the idymoadd.in.show method??
The DLS SDK IDymoAddIn.Show() function has been deprecated to no-op. If your existing application depends on the deprecated feature, then you are required to run DLS 7.
I use these 2 parts in my code to print a lable with the dymo 450.:
Private Sub LabelTestDymo450ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LabelTestDymo450ToolStripMenuItem.Click
‘Vul de aangewezen tekstvakken toe met betreffende teksten om het label aan te maken als betreffende comboboxen zijn ingevuld
If ComboBox2.Text “Kies flake soort!!!!” Then
printlabels(“Lijn Nr.: ” & txtProductielijn1.Text, “Product.: ” & ComboBox2.Text, “Batch Nr.: ” & txtFlakeBatchNr1.Text, 1)
End If
If ComboBox3.Text “Kies flake soort!!!!” Then
printlabels(“Lijn Nr.: ” & txtProductielijn2.Text, “Product.: ” & ComboBox3.Text, “Batch Nr.: ” & txtFlakeBatchNr2.Text, 1)
End If
printlabels(“Lijn Nr.: ” & txtProductielijn1.Text, “Product.: ” & ComboBox1.Text, “Batch Nr.: ” & txtBatchNr.Text, 1)
End Sub
Public Shared Sub printlabels(ByVal labeltext As String, ByVal labeltext1 As String, ByVal labeltext2 As String, ByVal labnum As Integer)
‘Creëer objecten om label via Dymo dll’s aan te spreken.
Dim myDymo As Object = CreateObject(“Dymo.Dymoaddin”) ‘geeft fout bij label printer labo
Dim myLabel As Object = CreateObject(“Dymo.Dymolabels”) ‘geeft fout bij label printer labo
‘Laad het bestemde label vanuit locatie
myDymo.Open(CStr(txtlocation & “\Small30334.label”))
‘Address en Address_1 en Address_2
‘Gebruik de taqnamen in Dymo software van het label om deze aangepast te krijgen.
myLabel.SetField(“Address”, labeltext)
myLabel.SetField(“Address_1”, labeltext1)
myLabel.SetField(“Address_2”, labeltext2)
‘Afdruk aantal van het label.
myDymo.Print(labnum, True)
End Sub
I tryed it on 2 laptops without any problems.
But the third laptop gives me the error that there cannot be a active x control created.
It points to these line.:
Dim myDymo As Object = CreateObject(“Dymo.Dymoaddin”) ‘geeft fout bij label printer labo
Dim myLabel As Object = CreateObject(“Dymo.Dymolabels”) ‘geeft fout bij label printer labo
What can be the problem on the third laptop?
Hello Pascal,
I am sorry you are having this issue. My guess is that you do not have DLS installed on the third laptop. Try installing DLS and let me know if the problem persists.
Ron
Where is RESULTS defined for the IsPrinterOnline() function ?
I am testing this function with printer and get a response of -1 if printer is connected, but 0 if it is not.
That seems strange.
Hello Tester,
Which SDK are you using? javascript, Framework, COM?
Ron
I installed Dymo SDK and Framework on Windows 7. I can’t seem to located the Dymo.DymoAddIn or Dymo.DymoLabels files. Is there something else that needs to be installed to get these?
Thanks.
Hi John,
You will need to install DLS on your machine as well. There are several sample applications that are included in the SDK install. Look these over to get a feel for setting up your own application.
Ron
Thanks Ron for the answer. I installed DLS on my machine but I still can’t seem to find those DLLs. Weird. Well, thanks for the help.
Hi,
I have an application that uses the DYMO SDK and has been working well for many years. This week we have had a customer with one Windows 10 x64 PC that will not open the template file. The Open(FileName) always returns 0. Have tried versions 8.7.1, 8.7.2 and 8.7.3. This is using the Dymo.AddIn COM interface. Customer has a DYMO 450 label printer. The template file opens and prints from the LabelWriter Software successfully.
Any help will be appreciated.
Regards,
Trent
Hi Trent,
I wonder if it is a permissions issue. Can the user open any label files? maybe move the file to a different directory…
Ron
Hi Ron,
The template files are located in ‘C:\Users\Public\Documents\appname’ so shouldn’t have any permissions problems. Also the user can open the template files from this folder directly in the LabelWriter Software. I can’t move the files out of this location as it’s hardcoded into the app. Will ask the client to reset the permissions on this folder though.
Regards,
Trent
Hi Ron,
The folder ‘C:\Users\Public\Documents\appname’ has the default permissions which are read/write by all users. The customer can open the templates from this folder without any issues and print from the LabelWriter Software.
Any other ideas?
Regards,
Trent
Hey Trent,
Is the customer able to see his installed printers? In other words, do other areas of the SDK behave appropriately?
Ron
Hi Ron,
Yes. The SDK works correctly. Test print works correctly. Printing these label templates from inside the LabelWriter Software works correctly (v8.7.1 + v8.7.2 + v8.7.3).
The only problem is my software shows an errorcode of 0 (zero) when trying to open the template files using the Open(TemplateFilePath) command. Only on 1 PC out of hundreds…
Regards,
Trent
Can you try accessing the file, from your code, without using our SDK? Maybe you can get a better error message that way.
Ron
After updating to Windows 10 and the current Dymo software this simple script no longer works. Any help is appreciated:
Sub PrintLabels()
Dim DymoAddIn as object
Dim DymoLabel as object
Set DymoAddIn = CreateObject(“DYMO.DymoAddIn”)
Set DymoLabel = CreateObject(“DYMO.DymoLabels”)
If (DymoAddIn Is Nothing) Or (DymoLabel Is Nothing) Then
document.write(“Unable to create OLE objects”)
Exit Sub
End If
DymoAddIn.Open “C:\Labels\M-Line Part Number Label.label”
DymoLabel.SetField “TEXT”,”PART-NUMBER-HERE”
DymoAddIn.Print 2, TRUE
End Sub
call PrintLabels
Set DymoLabel = Nothing
Set DymoAddIn = Nothing
window.close
Hi Dan,
I assume by “current DYMO software” you are referring to DLS 8.7.3?
when you say “no longer works” can you tell me what happens? Can you still print from DLS?
Ron
Hi Ron, yes 8.7.3 with a 450 labelwriter turbo. I was using vbscript to print labels from an intranet page where the variable is the “PART-NUMBER-HERE” and quantity.
When I call the page from Internet Explorer 11 nothing happens at all. I am not sure how to troubleshoot.
Have the object references or other syntax changed?
Here is the actual script..
Sub PrintLabels()
Dim DymoAddIn as object
Dim DymoLabel as object
Set DymoAddIn = CreateObject(“DYMO.DymoAddIn”)
Set DymoLabel = CreateObject(“DYMO.DymoLabels”)
If (DymoAddIn Is Nothing) Or (DymoLabel Is Nothing) Then
document.write(“Unable to create OLE objects”)
Exit Sub
End If
DymoLabel.Open “C:\Labels\Part Number Label.label”
DymoLabel.SetField “TEXT”,”SF18HZ”
DymoLabel.Print 1, TRUE
End Sub
call PrintLabels
Set DymoLabel = Nothing
Set DymoAddIn = Nothing
window.close
I can print from DLS… that is my workaround right now.
Hi Dan,
Not much has changed. It is unusual to use VBScript from a web page. I would recommend using javascript with our javascript SDK. The javascript SDK was specifically developed to work from a web environment.
Ron
Is there anything this concise in the javascript SDK? I dont see anything that will let me choose a label, add some text to a field and print in this few lines of code.