Преглед изворни кода

Version 1.00.190419

Initial Version

Signed-off-by: Imhotheb <Info@Imhotheb.de>
master
Imhotheb пре 5 година
родитељ
комит
23062cdd5a
  1. 16
      .gitignore
  2. BIN
      COMatePLUS/COMatePLUS.chm
  3. 2572
      COMatePLUS/COMatePLUS.pbi
  4. 143
      COMatePLUS/COMatePLUS_Residents.pbi
  5. 732
      DYMO.pbi
  6. 13
      DYMO_CreateDLL.pb
  7. 116
      DYMO_DLL.pbi
  8. 188
      DYMO_Example.pb
  9. 41
      LICENSE
  10. 44
      README.md
  11. 204
      Sample_101x54.label
  12. 200
      Sample_89x28.label
  13. BIN
      Sample_Logo.bmp

16
.gitignore

@ -0,0 +1,16 @@
# ignore PureBasic projects
*.pbp
# ignore binary files
*.exe
*.dll
*.lib
*.obj
# ignore temporary files
*.exp
*.tmp
*.temp
# other
*.bak

BIN
COMatePLUS/COMatePLUS.chm

Binary file not shown.

2572
COMatePLUS/COMatePLUS.pbi

Разлика између датотеке није приказан због своје велике величине

143
COMatePLUS/COMatePLUS_Residents.pbi

@ -0,0 +1,143 @@
;/////////////////////////////////////////////////////////////////////////////////
;***COMatePLUS*** COM OLE automation through iDispatch.
;*===========
;*
;*©nxSoftWare (www.nxSoftware.com) 2009.
;*======================================
;*
;*Header file.
;/////////////////////////////////////////////////////////////////////////////////
#COMate_UnknownObjectType = 1 ;Use this with the GetObjectProperty() method when the object type does not inherit from iDispatch.
;In such cases, the method will return the interface pointer directly (as opposed to a COMate object!)
;The following constant is used with the SetEventHandler() method of the COMateObject class in order to set an optional
;'global' handler for all events (useful for examining which events are being sent etc.)
;This is in addition to any individual handlers which are called after this global one.
#COMate_CatchAllEvents = ""
;The following enumeration is used with the SetEventHandler() method of the COMateObject class to specify the return type
;(if any) of an individual event.
Enumeration
#COMate_NoReturn
#COMate_IntegerReturn
#COMate_RealReturn
#COMate_StringReturn
#COMate_OtherReturn ;This is a special case; please see the COMate manual for details (SetEventHandler()).
#COMate_VariantReturn = #COMate_OtherReturn ;Alias!
#COMate_UnknownReturn = #COMate_OtherReturn ;Alias!
EndEnumeration
;/////////////////////////////////////////////////////////////////////////////////
;-Declaration of 'Public' functions.
Declare.i COMate_CreateObject(progID$, hWnd = 0, blnInitCOM = #True)
Declare.i COMate_GetObject(file$, progID$="", blnInitCOM = #True)
Declare.i COMate_WrapCOMObject(object.iUnknown)
;Statement functions.
Declare.i COMate_PrepareStatement(command$) ;Returns a statement handle or zero if an error.
Declare.i COMate_GetStatementParameter(hStatement, index) ;Returns, if successful, a direct pointer to the appropriate variant structure.
;Index is 1-based.
Declare COMate_FreeStatementHandle(hStatement)
;The two error retrieval functions are completely threadsafe in that, for example, 2 threads could be working with the same COMate object
;and any resuting errors will be stored separately so that one thread's errors will not conflict with another's etc.
Declare.i COMate_GetLastErrorCode()
Declare.s COMate_GetLastErrorDescription()
;OCX (ActiveX) functions.
Declare.i COMate_RegisterCOMServer(dllName$, blnInitCOM = #True)
Declare.i COMate_UnRegisterCOMServer(dllName$, blnInitCOM = #True)
Declare.i COMate_CreateActiveXControl(x, y, width, height, progID$, blnInitCOM = #True)
;Miscellaneous.
Declare.i COMate_GetIIDFromName(name$, *iid.IID)
;/////////////////////////////////////////////////////////////////////////////////
;/////////////////////////////////////////////////////////////////////////////////
;-Class interfaces.
;The following interface details the class methods for COMateObject type objects; the main object type for COMate.
Interface COMateObject
;General methods.
;=================================
Invoke.i(command$, *hStatement=0)
;Returns a HRESULT value. #S_OK for no errors.
Release() ;DO NOT use this until all enumeration objects attached to this object have been freed.
CreateEnumeration.i(command$, *hStatement=0)
;Returns an object of type COMateEnumObject (see below) or zero if an error.
GetCOMObject.i() ;Returns the COMate object's underlying iDispatch object pointer. AddRef() is called on this object
;so the developer must call Release() at some point.
GetContainerhWnd.i(returnCtrlID=0)
;In the case of an ActiveX control, this methods returns either the handle of the container used
;to house the control or the Purebasic gadget#. Returning the gadget# is only viable if using COMate
;as a source code include (or a Tailbitten library!)
SetDesignTimeMode.i(state=#True);In the case of an ActiveX control, this methods attempts to set a design time mode.
;Returns a HRESULT value. #S_OK for no errors.
;Get property methods.
;=================================
GetDateProperty.i(command$, *hStatement=0)
;Returns a PB date value. Of course you can always retrieve a data in string form using GetStringProperty() etc.
GetIntegerProperty.q(command$, *hStatement=0)
;Returns a signed quad which can of course be placed into any integer variable; byte, word etc.
GetObjectProperty.i(command$, *hStatement=0, objectType = #VT_DISPATCH)
;Returns a COMate object or an iUnknown interface pointer depending on the value of the 'objectType' parameter.
;For 'regular' objects based upon iDispatch, leave the optional parameter 'objectType' as it is.
;Otherwise, for unknown object types set objectType to equal #COMate_UnknownObjectType. In these cases,
;this method will return the interface pointer directly (as opposed to a COMate object).
;In either case the object should be released as soon as it is no longer required.
GetRealProperty.d(command$, *hStatement=0)
;Returns a double value which can of course be placed into any floating point variable; float or double.
GetStringProperty.s(command$, *hStatement=0)
GetVariantProperty.i(command$, *hStatement=0)
;For those returns which are not directly supported by the COMate functions.
;The user must use VariantClear_() and FreeMemory() when finished with the variant returned by this method.
;Set property methods.
;=================================
SetProperty.i(command$, *hStatement=0)
;Returns a HRESULT value. #S_OK for no errors.
SetPropertyRef.i(command$, *hStatement=0)
;Returns a HRESULT value. #S_OK for no errors.
CompilerIf Defined(COMATE_NOINCLUDEATL, #PB_Constant)=0
;Event handler methods.
;=================================
SetEventHandler.i(eventName$, callback, returnType = #COMate_NORETURN, *riid.IID=0)
;eventName$ = "" to set an optional handler which will receive all events (useful for examining which events are sent).
;This is in addition to any individual handlers which are called after this 'global' one.
;Returns a HRESULT value. #S_OK for no errors. Set callback = 0 to remove an existing event handler.
GetIntegerEventParam.q(index) ;Only valid to call this during an event handler. Index is a 1-based index.
GetObjectEventParam.i(index, objectType = #VT_DISPATCH)
;Only valid to call this during an event handler. Index is a 1-based index.
;The object returned is NOT in the form of a COMate object. Use COMate_WrapCOMObject() to convert to
;a COMate object if required.
;User must call Release() on this object when done.
GetRealEventParam.d(index) ;Only valid to call this during an event handler. Index is a 1-based index.
GetStringEventParam.s(index) ;Only valid to call this during an event handler. Index is a 1-based index.
IsEventParamPassedByRef.i(index, *ptrParameter.INTEGER=0, *ptrVariant.INTEGER=0)
;Returns zero or a variant #VT_... type constant (minus the #VT_BYREF modifier).
;In the latter case, and if *ptrParameter is non-zero, then the address of the underlying parameter
;is placed into this buffer, enabling the client application to modify the parameter etc.
CompilerEndIf
EndInterface
;The following interface details the class methods for COMateEnumObject type objects.
;Instances of these objects are used to enumerate collections of objects (or variants) exposed by a COM object.
;These objects are created through the CreateEnumeration() method of the COMateObject class (see above).
Interface COMateEnumObject
GetNextObject.i() ;Returns a 'COMateObject' object (or zero if the enumeration is complete).
;The user must use the Release() method on this object when it is no longer required.
GetNextVariant.i() ;Returns a pointer to a variant (or zero if there are no more).
;The user must use VariantClear_() and FreeMemory() when finished with the variant returned by this method.
Reset.i() ;Resets the enumeration back to the beginning. NOTE that there is no guarantee that a second run
;through the underlying collection will produce the same results. Imagine a collection of files in a
;folder for example in which some can be deleted between enumerations etc.
;Returns a HRESULT value. #S_OK for no errors.
Release()
EndInterface
;/////////////////////////////////////////////////////////////////////////////////
; IDE Options = PureBasic 4.31 Beta 1 (Windows - x86)
; ExecutableFormat = Shared Dll
; CursorPosition = 75
; FirstLine = 52
; EnableUnicode
; EnableThread
; Executable = nxReportU.dll

732
DYMO.pbi

@ -0,0 +1,732 @@
EnableExplicit
; DYMO Label Software (DLS) have to be installed.
; This Include is created for DLS v.8+ (year 2015+).
; Maybe it works with lower version, but this is untested.
; Constants
; ===========================================================
; For Printers with more than one tray
Enumeration DYMO_Tray
#DYMO_Tray_Unknown = -1
#DYMO_Tray_Left = 0
#DYMO_Tray_Right = 1
#DYMO_Tray_Auto = 2
EndEnumeration
; for DYMO_SetAddressPOSTNET(POSTNET_Pos)
#DYMO_POSTNET_Pos_None = "NONE"
#DYMO_POSTNET_Pos_Top = "TOP"
#DYMO_POSTNET_Pos_Buttom = "BUTTOM"
; not really needed, but nice to know
#DYMO_False = #False ; 0
#DYMO_True = ~#DYMO_False ; -1
; Initialize all needed components or release them
; ===========================================================
DeclareDLL DYMO_Init()
; Use this BEFORE any use of DYMO_*() commands.
; Prevent any use of DYMO_*() procedures if return value is not #True.
; Return: #True or #False
DeclareDLL DYMO_Release()
; Release all objects created with DYMO_Init()
; After using DYMO_Release() stop using any DYMO_*() command.
; If you want to reuse DYMO_* commands, you can call DYMO_Init() again.
; Return: void
; Manage Printer(s) and printing
; ===========================================================
DeclareDLL DYMO_ExaminePrinters()
; Examine available DYMO printers
; Return: Number of available printers
DeclareDLL.s DYMO_NextPrinter()
; Cycle through the List of DYMO-Printer examined with DYMO_ExaminePrinters()
; Return: Printer name or #Null$ if no more printers available
DeclareDLL.s DYMO_GetCurrentPrinterName()
; Get the name of the currently selected printer
; Return: selected printer name
DeclareDLL DYMO_SelectPrinter(PrinterName.s)
; Redirects output to the selected printer. PrinterName is of the
; form "Printer name on Port". Returns TRUE on success, FALSE
; on error. Example:
; To Select the <LabelWriter EL60 on COM3>, you would use the
; command: DYMO_SelectPrinter("DYMO LabelWriter EL60 on COM3:")
; Return: #DYMO_True or #DYMO_False
DeclareDLL DYMO_IsTwinTurboPrinter(PrinterName.s)
; Returns TRUE if the specified printer (PrinterName) is a
; LabelWriter Twin Turbo, FALSE otherwise.
; Return: #DYMO_True or #DYMO_False
DeclareDLL DYMO_SetPrintMode(HighQuality = #True)
; When "HighQuality" is set to TRUE (Default value), labels containing barcode(s)
; will print at high quality mode but the print speed is reduced.
; Unsetting this mode will cause all labels to print at the fasted print
; speed.
DeclareDLL DYMO_GetCurrentPaperTray()
; Further Information: When the currently selected printer is a
; LabelWriter Twin Turbo, DYMO Label software attempts To
; associate a paper tray With the currently opened label file. As an
; example, If the last label printed on the left tray was "Address
; 30252" And the last label printed on the right tray was "Shipping
; 30323", then when the user opens a label file that uses the
; "Address 30252" paper size, DYMO Label software automatically
; sets the tray selection To left tray.
; Return: the current active paper tray
; Possible Return values include:
; #DYMO_Tray_Unknown = Unknown Tray (program user must specify)
; #DYMO_Tray_Left = Left Tray (Roll)
; #DYMO_Tray_Right = Right Tray (Roll)
; #DYMO_Tray_Auto = Auto Switch
DeclareDLL DYMO_IsPrinterOnline(PrinterName.s)
; This applies to locally connected printers only. Shared printers
; always return true. Returns true if the specified printer is online,
; false if the printer is offline.
; Return: #DYMO_True or #DYMO_False
DeclareDLL DYMO_StartPrintJob()
DeclareDLL DYMO_StopPrintJob()
; Wrapping DYMO_PrintLabel() calls within the DYMO_StartPrintJob() and
; DYMO_EndPrintJob() calls will cause labels to be printed as pages of the
; same print job.
; The benefit is seen with reduced the print job.
;
; Example:
; ; this printing loop creates a 10 page print job
; DYMO_StartPrintJob()
; For i = 1 to 10
; ; update some fields on the label
; DYMO_PrintLabel() ; print one label
; Next
; DYMO_StopPrintJob();
;
; this code above will print labels much faster than the code below: 
;
; ; this printing loop creates 10 different one page print jobs
; For i = 1 to 10
; ; update some fields on the label
; DYMO_PrintLabel() ; print one label
; Next
;
; Return: void
DeclareDLL DYMO_PrintLabel(Copies = 1, Tray = #DYMO_Tray_Unknown, ShowDialog = #False)
; Prints the current label. "Copies" is the number of copies to print.
; "ShowDialog" controls the display of the print-progress dialog. If
; TRUE, then the dialog is displayed. Returns TRUE on success,
; FALSE on error.
; Note: When the currently selected printer is a LabelWriter Twin Turbo, this command defaults to
; use the left roll.
; Possible values For the "Tray" parameter include:
; #DYMO_Tray_Left = Left Roll
; #DYMO_Tray_Right = Right Roll
; #DYMO_Tray_Auto = Auto Switch - This puts the printer in a mode where it starts to
; print from the last printed roll and automatically switch over to the
; other roll when the starting roll runs out of paper. It continues to
; toggle back and forth between rolls as long as the user refills rolls
; once they become empty. This mode of printing is useful when the
; user is printing a large number of labels.
; Return: #DYMO_True or #DYMO_False
; Automatic creation of print-jobs
; ===========================================================
DeclareDLL DYMO_SmartPasteFromClipboard()
; Parses text data in the Clipboard into records and prints a label for
; each record.
; Return: #DYMO_True if the operation was successful,
; #DYMO_False if the operation failed.
DeclareDLL DYMO_SmartPasteFromFile(File.s)
; Parses comma or tab delimited data in a file into records and prints
; a label For each record.
; Return: #DYMO_True if the operation was successful,
; #DYMO_False if the operation failed.
DeclareDLL DYMO_SmartPasteFromString(Text.s)
; Parses text data in "Text" into records and prints a label for each
; record.
; Return: #DYMO_True if the operation was successful,
; #DYMO_False if the operation failed.
; Manage .label files
; ===========================================================
DeclareDLL DYMO_OpenMemory(*Buffer, BufferSize)
; Reads a label file from a buffer (vs. from a file or URL). This is
; useful If you intend to manage the binary data yourself. The
; buffer must be filled with the binary Data of the label file.
; Return: #DYMO_True if the label file was Read from the buffer correctly.
; #DYMO_False if the buffer is invalid.
DeclareDLL DYMO_SaveMemory()
; Returns a pointer, which is actually containing
; the binary data of the label file currently open in DYMO Label
; software.
; You can use MemorySize() tu get the size of the buffer.
; If you not longer need the data use FreeMemory()
; Return: *Buffer
DeclareDLL DYMO_OpenURL(URL.s)
; Opens a label file using an URL. The URL can start with http, https,
; ftp, or file, etc.
; Return: #DYMO_True if the file was opened successfully,
; #DYMO_False if the file does not exist.
DeclareDLL DYMO_OpenLabel(File.s, ShowDialogBoxIfFail = #False)
; Opens a label file. Returns TRUE on success, FALSE on error.
; *Functional Difference Alert:
; The function will try to open the specified label file name With the .label extension first, even If
; the parameter specifies a different file extension.
; For example, If your application calls:
; DYMO_OpenLabel("mylabel.lwl")
; The function will try to look for the file in the following order:
; mylabel.label
; mylabel.lwl
; mylabel.lwt
; * The reason for this behavior has to do with how the implementation handles both ".lwl" and
; ".label" file formats. The implementation converts ".lwl" format into ".label" format internally
; before performing any actions on a label file. What this means is that when a label that was
; opened as ".lwl" will be saved as a ".label" file if the DYMO_SaveLabel() method is called.
; So if an SDK application opens a ".lwl" label file, modifies it, then saves the file. The file would
; be saved as a ".label" file. When the application returns to open the same ".lwl" file expecting to
; see the modifications, the DYMO_OpenLabel() procedure would need to open the ".label" file for the
; modification to be seen.
; If "ShowDIalogBoxIfFail" is set to TRUE and the specified file name is not found, opens the
; Label File Open dialog box.
; Return: #DYMO_True if the file was opened successfully,
; #DYMO_False if the file does not exist.
DeclareDLL DYMO_SaveLabel(File.s = #Null$)
; Saves the current label. Returns TRUE on success, FALSE on
; error. If a "File" is given, saves the current label under a new name.
; *Functional Difference Alert:
; The function will save the specified label file name in the .label file extension, even if the
; parameter specifies a different file extension.
; For example, If your application calls:
; DYMO_SaveLabel("SomeFile.lwl")
; the function will save the file As "SomeFile.label". The label file is in the new DYMO Label v.8
; .label file format.
; Manage Most Recently Used (MRU) .label files
; ===========================================================
DeclareDLL DYMO_MRU_GetFileCount()
; Return: the number of files in the MRU label file list.
DeclareDLL DYMO_MRU_OpenFile(Index)
; Returns a label file name from the MRU label files List. The "Index"
; parameter identifies which file name in the MRU to return. The
; index is zero-based and the file name DOES NOT include the file
; path or extension. Example: "SomeFile"
DeclareDLL.s DYMO_MRU_GetFileName(Index)
DeclareDLL DYMO_MRU_ExamineFiles()
; Examine available MRU files
; Return: Number of available Files
DeclareDLL.s DYMO_MRU_NextFile()
; Cycle through the MRU-List examined with DYMO_MRU_ExamineFiles()
; Return: Filename or #Null$ if no more available
; Proxy-settings (for commands with URL)
; ===========================================================
DeclareDLL DYMO_ProxySetup(Protocol.s, ServerName.s, Port.l, ProxyBypass.s, UserName.s, Password.s)
; Allows customized proxy settings (different from IE’s Default
; proxy settings). All URL related function calls in the SDK will
; adhere to these proxy settings.
DeclareDLL DYMO_ProxyClearSettings()
; Clears all proxy settings and revert back to using IE’s default
; proxy settings.
DeclareDLL DYMO_ProxyBypass(Set = #True) ; #False = default
; Setting the property to TRUE will cause all URL related SDK
; functions To bypass any proxy settings, including IE’s Default
; proxy settings.
; Setting the property to FALSE (the Default value) means all URL
; related SDK functions will use either IE’s Default proxy setting or
; the user specified proxy settings
; Manage currently loaded .label and modify objects
; ===========================================================
DeclareDLL DYMO_ExamineObjects(VariableOnly = #True)
; Examine available objects in the current loaded label. If "VariableOnly" is set to
; TRUE then only variable Objects are examined.
; Return: Number of Objects
DeclareDLL.s DYMO_NextObject()
; Cycle through the objects examined with DYMO_ExamineObjectes()
; Return: ObjectName or #Null$ if no more available
DeclareDLL DYMO_GetAddressFieldCount()
; This procedure returns the number of address objects on the current
; label. Used to determine possible values for the index parameter of
; the DYMO_SetAddressPOSTNET() and DYMO_SetAddress functions.
DeclareDLL.s DYMO_GetText(Object.s)
; Given an "Object" name returns the contents of the object.
; This operation only applies to address, barcode and text objects.
DeclareDLL DYMO_SetAddress(Address.s, Index = 1)
; Given an "Index" of an address object, places the text in the object.
; The index is normally 1, but for designs with more than one
; address object, the index can be greater than one to select other
; address objects.
; Return: #DYMO_True on success or #DYMO_False on error
DeclareDLL DYMO_SetField(Object.s, Text.s)
; Given an object name, and some text, changes the text of the object
; to have the new text. This operation only applies to address,
; barcode, and text objects.
; Return: #DYMO_True on success or #DYMO_False on error
DeclareDLL DYMO_SetAddressPOSTNET(POSTNET_Pos.s, Index = 1)
; Given an index of an address object, changes the POSTNET
; barcode setting for the object. The index is normally 1, but for
; designs with more than one address object, the index can be greater
; than one to select other address objects.
; Position can be #DYMO_POSTNET_Pos_None,
; #DYMO_POSTNET_Pos_Top or #DYMO_POSTNET_Pos_Buttom
; Return: void
DeclareDLL DYMO_PasteFromClipboard(Object.s)
; Paste text from the clipboard to an object by the given
; "Object" name.
; Return: #DYMO_True on success or #DYMO_False on error
DeclareDLL DYMO_SetImageFile(Object.s, File.s)
; Load an image file to a graphic object by the given "Object" name.
; Return: #DYMO_True on success or #DYMO_False on error
DeclareDLL DYMO_SetImageURL(Object.s, URL.s)
; Allows specifying URL as the image source for an image object on
; the label.
; Return: #DYMO_True on success or #DYMO_False on error
DeclareDLL DYMO_PasteImageFromClipboard(Object.s)
; Paste image from the clipboard to an object by the given
; "Object" name.
; Return: #DYMO_True on success or #DYMO_False on error
; Internally used Procedures
; ===========================================================
Declare INTERNAL_DYMO_Variant2Buffer(*Var.VARIANT);Return: *Mem Pointer (use FreeMemory() / MemorySize())
Declare INTERNAL_DYMO_Buffer2Variant(*Buffer, BufferSize);Return: *Variant, use VariantClear_() AND ClearStructure() !!
; some tests for the include
; ===========================================================
CompilerIf Defined(INCLUDE_DYMO, #PB_Constant) ; if DYMO / DYMO_DLL is already included
CompilerError "<" + #PB_Compiler_Filename + "> DYMO already included !!"
CompilerElse
#INCLUDE_DYMO = #True
CompilerEndIf
CompilerIf Defined(INCLUDE_COMATE, #PB_Constant) = #False ; if COMatePLUS is not included
XIncludeFile "COMatePLUS/COMatePLUS_Residents.pbi"
XIncludeFile "COMatePLUS/COMatePLUS.pbi"
;CompilerWarning "<" + #PB_Compiler_Filename + ~"> if you want to include other COMatePLUS Version, you have to include \"COMatePLUS.pbi\""
CompilerEndIf
CompilerIf #PB_Compiler_Unicode = #False
CompilerError "<" + #PB_Compiler_Filename + "> Needs Unicode!!"
CompilerEndIf
; Structures
; ===========================================================
Structure DYMO_Struct_COM
AddIn.COMateObject
Labels.COMateObject
EndStructure
Structure DYMO_Struct_RetVar
NextPrinter.s
GetCurrentPrinterName.s
MRU_NextFile.s
MRU_GetFileName.s
NextObject.s
GetText.s
EndStructure
Structure DYMO_Struct
COM.DYMO_Struct_COM
List Printers.s()
List MRU_Files.s()
List Objects.s()
Initialized.i
RetVar.DYMO_Struct_RetVar
EndStructure
; Procedures
; ===========================================================
ProcedureDLL DYMO_Init()
Global DYMO.DYMO_Struct
; create needed COMate objects
If Not DYMO\Initialized
DYMO\COM\AddIn = COMate_CreateObject("Dymo.DymoAddIn")
DYMO\COM\Labels = COMate_CreateObject("Dymo.DymoLabels")
EndIf
If DYMO\COM\AddIn And DYMO\COM\Labels
DYMO\Initialized = #True
EndIf
ProcedureReturn DYMO\Initialized
EndProcedure
ProcedureDLL DYMO_Release()
; release COMate objects
If DYMO\Initialized
If DYMO\COM\AddIn
DYMO\COM\Labels\Release()
EndIf
If DYMO\COM\Labels
DYMO\COM\AddIn\Release()
EndIf
DYMO\Initialized = #False
EndIf
ClearList(DYMO\MRU_Files())
ClearList(DYMO\Objects())
ClearList(DYMO\Printers())
EndProcedure
ProcedureDLL DYMO_ExaminePrinters()
Protected Temp.s, i
ClearList(DYMO\Printers())
; get string vom dls
Temp.s = DYMO\COM\AddIn\GetStringProperty("GetDymoPrinters()")
; split string and fill list
For i = 0 To CountString(Temp, "|")
AddElement(DYMO\Printers())
DYMO\Printers() = StringField(Temp, i + 1, "|")
Next
ResetList(DYMO\Printers())
ProcedureReturn ListSize(DYMO\Printers())
EndProcedure
ProcedureDLL.s DYMO_NextPrinter()
DYMO\RetVar\NextPrinter = #Null$
If NextElement(DYMO\Printers())
DYMO\RetVar\NextPrinter = DYMO\Printers()
EndIf
ProcedureReturn DYMO\RetVar\NextPrinter
EndProcedure
ProcedureDLL DYMO_SelectPrinter(PrinterName.s)
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("SelectPrinter('" + PrinterName + "')")
EndProcedure
ProcedureDLL DYMO_IsTwinTurboPrinter(PrinterName.s)
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("IsTwinTurboPrinter('" + PrinterName + "')")
EndProcedure
ProcedureDLL DYMO_GetCurrentPaperTray()
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("GetCurrentPaperTray()");
EndProcedure
ProcedureDLL.s DYMO_GetCurrentPrinterName()
DYMO\RetVar\GetCurrentPrinterName = DYMO\COM\AddIn\GetStringProperty("GetCurrentPrinterName()")
ProcedureReturn DYMO\RetVar\GetCurrentPrinterName
EndProcedure
ProcedureDLL DYMO_StartPrintJob()
DYMO\COM\AddIn\Invoke("StartPrintJob()")
EndProcedure
ProcedureDLL DYMO_StopPrintJob()
DYMO\COM\AddIn\Invoke("EndPrintJob()")
EndProcedure
ProcedureDLL DYMO_OpenLabel(File.s, ShowDialogBoxIfFail = #False)
If ShowDialogBoxIfFail
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("Open2('" + File + "')")
Else
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("Open('" + File + "')")
EndIf
EndProcedure
ProcedureDLL DYMO_SaveLabel(File.s = #Null$)
If File = #Null$
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("Save()")
Else
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("SaveAs('" + File + "')")
EndIf
EndProcedure
ProcedureDLL DYMO_PrintLabel(Copies = 1, Tray = #DYMO_Tray_Unknown, ShowDialog = #False)
Select Tray
Case #DYMO_Tray_Left, #DYMO_Tray_Right, #DYMO_Tray_Auto
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("Print2(" + Str(Copies) + "," + Str(ShowDialog) + "," + Str(Tray) + ")")
Default
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("Print(" + Str(Copies) + "," + Str(ShowDialog) + ")")
EndSelect
EndProcedure
ProcedureDLL DYMO_IsPrinterOnline(PrinterName.s)
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("IsPrinterOnline('" + PrinterName + "')")
EndProcedure
ProcedureDLL DYMO_OpenMemory(*Buffer, BufferSize)
Protected *Var.VARIANT
Protected Ret = #False
; Create Variant bufffer and copy data
*Var = INTERNAL_DYMO_Buffer2Variant(*Buffer, BufferSize)
If *Var
Ret = DYMO\COM\AddIn\GetIntegerProperty("OpenStream(" + Str(*Var) + " AS VARIANT BYREF)")
VariantClear_(*Var)
ClearStructure(*Var, VARIANT)
EndIf
ProcedureReturn Ret
EndProcedure
ProcedureDLL DYMO_SaveMemory()
Protected *Var.VARIANT
Protected *Ret = #Null
; get return *variant from property
*Var = DYMO\COM\AddIn\GetVariantProperty("SaveStream()")
If *Var
*Ret = INTERNAL_DYMO_Variant2Buffer(*Var) ; allocate some memory and copy data
VariantClear_(*Var)
EndIf
ProcedureReturn *Ret
EndProcedure
ProcedureDLL DYMO_OpenURL(URL.s)
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("OpenURL('" + URL + "')")
EndProcedure
ProcedureDLL DYMO_MRU_ExamineFiles()
Protected Temp.s, i
ClearList(DYMO\MRU_Files())
; get string from dls
Temp.s = DYMO\COM\AddIn\GetStringProperty("GetMRULabelFiles()")
; split string and fill list
For i = 0 To CountString(Temp, "|")
AddElement(DYMO\MRU_Files())
DYMO\MRU_Files() = StringField(Temp, i + 1, "|")
Next
ResetList(DYMO\MRU_Files())
ProcedureReturn ListSize(DYMO\MRU_Files())
EndProcedure
ProcedureDLL.s DYMO_MRU_NextFile()
DYMO\RetVar\MRU_NextFile = #Null$
If NextElement(DYMO\MRU_Files())
DYMO\RetVar\MRU_NextFile = DYMO\MRU_Files()
EndIf
ProcedureReturn DYMO\RetVar\MRU_NextFile
EndProcedure
ProcedureDLL DYMO_MRU_GetFileCount()
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("GetMRULabelFileCount()")
EndProcedure
ProcedureDLL.s DYMO_MRU_GetFileName(Index)
DYMO\RetVar\MRU_GetFileName = DYMO\COM\AddIn\GetStringProperty("GetMRULabelFileName(" + Str(Index) + ")")
ProcedureReturn DYMO\RetVar\MRU_GetFileName
EndProcedure
ProcedureDLL DYMO_MRU_OpenFile(Index)
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("OpenMRULabelFile(" + Str(Index) + ")")
EndProcedure
ProcedureDLL DYMO_SetPrintMode(HighQuality = #True)
If HighQuality
DYMO\COM\AddIn\Invoke("SetGraphicsAndBarcodePrintMode(#True)")
Else
DYMO\COM\AddIn\Invoke("SetGraphicsAndBarcodePrintMode(#False)")
EndIf
EndProcedure
ProcedureDLL DYMO_SmartPasteFromClipboard()
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("SmartPasteFromClipboard()")
EndProcedure
ProcedureDLL DYMO_SmartPasteFromFile(File.s)
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("SmartPasteFromFile('" + File + "')")
EndProcedure
ProcedureDLL DYMO_SmartPasteFromString(Text.s)
ProcedureReturn DYMO\COM\AddIn\GetIntegerProperty("SmartPasteFromString('" + Text + "')")
EndProcedure
ProcedureDLL DYMO_ProxySetup(Protocol.s, ServerName.s, Port.l, ProxyBypass.s, UserName.s, Password.s)
DYMO\COM\AddIn\Invoke("SetupProxySettings('" +
Protocol + "','" +
ServerName + "'," +
Str(Port) + ",'" +
ProxyBypass + "','" +
UserName + "','" +
Password + "')")
EndProcedure
ProcedureDLL DYMO_ProxyClearSettings()
DYMO\COM\AddIn\Invoke("ClearProxySettings()")
EndProcedure
ProcedureDLL DYMO_ProxyBypass(Set = #True) ; #False = default
If Set
DYMO\COM\AddIn\SetProperty("proxyBypass = #True")
Else
DYMO\COM\AddIn\SetProperty("proxyBypass = #False")
EndIf
EndProcedure
ProcedureDLL DYMO_ExamineObjects(VariableOnly = #True)
Protected Temp.s, i
ClearList(DYMO\Objects())
; get string of objects
If VariableOnly
Temp.s = DYMO\COM\Labels\GetStringProperty("GetObjectNames(#True)")
Else
Temp.s = DYMO\COM\Labels\GetStringProperty("GetObjectNames(#False)")
EndIf
; split string and fill list
For i = 0 To CountString(Temp, "|")
AddElement(DYMO\Objects())
DYMO\Objects() = StringField(Temp, i + 1, "|")
Next
ResetList(DYMO\Objects())
ProcedureReturn ListSize(DYMO\Objects())
EndProcedure
ProcedureDLL.s DYMO_NextObject()
DYMO\RetVar\NextObject = #Null$
If NextElement(DYMO\Objects())
DYMO\RetVar\NextObject = DYMO\Objects()
EndIf
ProcedureReturn DYMO\RetVar\NextObject
EndProcedure
ProcedureDLL.s DYMO_GetText(Object.s)
DYMO\RetVar\GetText = DYMO\COM\Labels\GetStringProperty("GetText('" + Object + "')")
ProcedureReturn DYMO\RetVar\GetText
EndProcedure
ProcedureDLL DYMO_SetAddress(Address.s, Index = 1)
ProcedureReturn DYMO\COM\Labels\GetIntegerProperty("SetAddress(" + Str(Index) + ",'" + Address + "')")
EndProcedure
ProcedureDLL DYMO_SetField(Object.s, Text.s)
ProcedureReturn DYMO\COM\Labels\GetIntegerProperty("SetField('" + Object + "','" + Text + "')")
EndProcedure
ProcedureDLL DYMO_GetAddressFieldCount()
ProcedureReturn DYMO\COM\Labels\GetIntegerProperty("AddressFieldCount()")
EndProcedure
ProcedureDLL DYMO_SetAddressPOSTNET(POSTNET_Pos.s, Index = 1)
DYMO\COM\Labels\Invoke("POSTNET(" + Str(Index) + ",'" + POSTNET_Pos + "')")
EndProcedure
ProcedureDLL DYMO_SetImageFile(Object.s, File.s)
ProcedureReturn DYMO\COM\Labels\GetIntegerProperty("SetImageFile('" + Object + "','" + File + "')")
EndProcedure
ProcedureDLL DYMO_SetImageURL(Object.s, URL.s)
ProcedureReturn DYMO\COM\Labels\GetIntegerProperty("SetImageURL('" + Object + "','" + URL + "',#NUllString)")
EndProcedure
ProcedureDLL DYMO_PasteFromClipboard(Object.s)
ProcedureReturn DYMO\COM\Labels\GetIntegerProperty("PasteFromClipboard('" + Object + "')")
EndProcedure
ProcedureDLL DYMO_PasteImageFromClipboard(Object.s)
ProcedureReturn DYMO\COM\Labels\GetIntegerProperty("PasteImageFromClipboard('" + Object + "')")
EndProcedure
Procedure INTERNAL_DYMO_Variant2Buffer(*Var.VARIANT)
Protected Size, *Ret = #Null, *SafeArray.SAFEARRAY
If *Var And *Var\vt = #VT_ARRAY|#VT_UI1 And *Var\parray
*SafeArray = *Var\parray
Size = *SafeArray\rgsabound[0]\cElements - *SafeArray\rgsabound[0]\lLbound
If Size
*Ret = AllocateMemory(Size)
If *Ret
If SafeArrayLock_(*SafeArray) = #S_OK
CopyMemory(*SafeArray\pvData, *Ret, Size)
SafeArrayUnlock_(*SafeArray)
Else
FreeMemory(*Ret)
*Ret = #Null
EndIf
EndIf
EndIf
EndIf
ProcedureReturn *Ret
EndProcedure
Procedure INTERNAL_DYMO_Buffer2Variant(*Buffer, BufferSize)
Protected *SafeArray.SAFEARRAY, SafeArrayBound.SAFEARRAYBOUND
Protected *Ret_Variant.VARIANT = AllocateStructure(VARIANT)
If *Ret_Variant And *Buffer And BufferSize > 0
VariantClear_(*Ret_Variant)
SafeArrayBound\lLbound = 0
SafeArrayBound\cElements = BufferSize
*SafeArray = SafeArrayCreate_(#VT_UI1, 1, SafeArrayBound)
If *SafeArray
If SafeArrayLock_(*SafeArray) = #S_OK
CopyMemory(*Buffer, *SafeArray\pvData, BufferSize)
*Ret_Variant\vt = #VT_ARRAY|#VT_UI1
*Ret_Variant\parray = *SafeArray
SafeArrayUnlock_(*SafeArray)
EndIf
EndIf
EndIf
ProcedureReturn *Ret_Variant
EndProcedure
DisableExplicit
; CursorPosition = 1
; Folding = AAAAAAAA-
; EnableXP
; CompileSourceDirectory
; EnableCompileCount = 0
; EnableBuildCount = 0
; EnableExeConstant
; EnableUnicode

13
DYMO_CreateDLL.pb

@ -0,0 +1,13 @@
; This is a dummy file ... for easy creation of DLL's
; see DYMO-Project ("DYMO.pbp")
XIncludeFile "DYMO.pbi"
; ExecutableFormat = Shared dll
; CursorPosition = 1
; Executable = DYMO.dll
; CompileSourceDirectory
; EnableCompileCount = 0
; EnableBuildCount = 0
; EnableExeConstant

116
DYMO_DLL.pbi

@ -0,0 +1,116 @@
EnableExplicit
; if you want to change some settings, create your own constants before include this file
CompilerIf Defined(DYMO_DLL_ImportFile_32bit, #PB_Constant) = #False
#DYMO_DLL_ImportFile_32bit = "DYMO32.lib"
CompilerEndIf
CompilerIf Defined(DYMO_DLL_ImportFile_64bit, #PB_Constant) = #False
#DYMO_DLL_ImportFile_64bit = "DYMO64.lib"
CompilerEndIf
CompilerIf Defined(INCLUDE_DYMO, #PB_Constant) ; if DYMO / DYMO_DLL is already included
CompilerError "<" + #PB_Compiler_Filename + "> DYMO already included !!"
CompilerElse
#INCLUDE_DYMO = #True
CompilerEndIf
CompilerSelect #PB_Compiler_Processor
CompilerCase #PB_Processor_x86
#INTERNAL_DYMO_Import_File = #DYMO_DLL_ImportFile_32bit
Import #INTERNAL_DYMO_Import_File
INTERNAL_DYMO_GetCurrentPrinterName() As "_DYMO_GetCurrentPrinterName@0"
INTERNAL_DYMO_NextPrinter() As "_DYMO_NextPrinter@0"
INTERNAL_DYMO_MRU_NextFile() As "_DYMO_MRU_NextFile@0"
INTERNAL_DYMO_NextObject() As "_DYMO_NextObject@0"
INTERNAL_DYMO_GetText(Object.s) As "_DYMO_GetText@4"
INTERNAL_DYMO_MRU_GetFileName(Index) As "_DYMO_MRU_GetFileName@4"
EndImport
CompilerCase #PB_Processor_x64
#INTERNAL_DYMO_Import_File = #DYMO_DLL_ImportFile_64bit
Import #INTERNAL_DYMO_Import_File
INTERNAL_DYMO_GetCurrentPrinterName() As "DYMO_GetCurrentPrinterName"
INTERNAL_DYMO_NextPrinter() As "DYMO_NextPrinter"
INTERNAL_DYMO_MRU_NextFile() As "DYMO_MRU_NextFile"
INTERNAL_DYMO_NextObject() As "DYMO_NextObject"
INTERNAL_DYMO_GetText(Object.s) As "DYMO_GetText"
INTERNAL_DYMO_MRU_GetFileName(Index) As "DYMO_MRU_GetFileName"
EndImport
CompilerEndSelect
Enumeration DYMO_Tray
#DYMO_Tray_Unknown = -1
#DYMO_Tray_Left = 0
#DYMO_Tray_Right = 1
#DYMO_Tray_Auto = 2
EndEnumeration
#DYMO_POSTNET_Pos_None = "NONE"
#DYMO_POSTNET_Pos_Top = "TOP"
#DYMO_POSTNET_Pos_Buttom = "BUTTOM"
Import #INTERNAL_DYMO_Import_File
DYMO_Init()
DYMO_Release()
DYMO_ExaminePrinters()
DYMO_SelectPrinter(PrinterName.s)
DYMO_IsTwinTurboPrinter(PrinterName.s)
DYMO_GetCurrentPaperTray()
DYMO_StartPrintJob()
DYMO_StopPrintJob()
DYMO_OpenLabel(File.s, ShowDialogBoxIfFail = #False)
DYMO_SaveLabel(File.s = #Null$)
DYMO_PrintLabel(Copies = 1, ShowDialog = #False, Tray = #DYMO_Tray_Unknown)
DYMO_IsPrinterOnline(PrinterName.s)
DYMO_OpenMemory(*Buffer, BufferSize)
DYMO_SaveMemory()
DYMO_OpenURL(URL.s)
DYMO_MRU_ExamineFiles()
DYMO_MRU_GetFileCount()
DYMO_MRU_OpenFile(Index)
DYMO_SetPrintMode(HighQuality = #True)
DYMO_SmartPasteFromClipboard()
DYMO_SmartPasteFromFile(File.s)
DYMO_SmartPasteFromString(Text.s)
DYMO_ProxySetup(Protocol.s, ServerName.s, Port.l, ProxyBypass.s, UserName.s, Password.s)
DYMO_ProxyClearSettings()
DYMO_ProxyBypass(Set = #True) ; #False = default
DYMO_ExamineObjects(VariableOnly = #True)
DYMO_SetAddress(Address.s, Index = 1)
DYMO_SetField(Object.s, Text.s)
DYMO_GetAddressFieldCount()
DYMO_SetAddressPOSTNET(POSTNET_Pos.s, Index = 1)
DYMO_SetImageFile(Object.s, File.s)
DYMO_SetImageURL(Object.s, URL.s)
DYMO_PasteFromClipboard(Object.s)
DYMO_PasteImageFromClipboard(Object.s)
EndImport
Macro DYMO_GetCurrentPrinterName()
PeekS(INTERNAL_DYMO_GetCurrentPrinterName())
EndMacro
Macro DYMO_NextPrinter()
PeekS(INTERNAL_DYMO_NextPrinter())
EndMacro
Macro DYMO_MRU_NextFile()
PeekS(INTERNAL_DYMO_MRU_NextFile())
EndMacro
Macro DYMO_NextObject()
PeekS(INTERNAL_DYMO_NextObject())
EndMacro
Macro DYMO_GetText(__Object_s__)
PeekS(INTERNAL_DYMO_GetText(__Object_s__))
EndMacro
Macro DYMO_MRU_GetFileName(__Index__)
PeekS(INTERNAL_DYMO_MRU_GetFileName(__Index__)
EndMacro
DisableExplicit
; CursorPosition = 1
; Folding = A5
; EnableXP
; CompileSourceDirectory
; EnableCompileCount = 0
; EnableBuildCount = 0
; EnableExeConstant

188
DYMO_Example.pb

@ -0,0 +1,188 @@
; if you want to use your version of COMatePLUS include it before include DYMO
;#COMATE_NOINCLUDEATL = #True ; Works, if wanted
;XIncludeFile "COMatePLUS\COMatePLUS_Residents.pbi" ; Include this file too or use IncludePath
;XIncludeFile "COMatePLUS\COMatePLUS.pbi" ; Include COMatePLUS
; include DYMO.pbi !OR! DYMO_DLL.pbi
XIncludeFile "DYMO.pbi" ; use DYMO include (with COMatePLUS)
;XIncludeFile "DYMO_DLL.pbi" ; use DYMO32.dll / DYMO64.dll
EnableExplicit
OpenConsole("DYMO Example")
; Show Objects in current loaded .label
Procedure ShowObjects(VariableOnly = #True)
Protected NrObjects, Object.s, i
NrObjects = DYMO_ExamineObjects(VariableOnly) ; #False = we want to list all object, not only those who can be changed
If NrObjects > 0
For i = 0 To NrObjects - 1
Object = DYMO_NextObject()
PrintN(#TAB$ + "Object: " + Object + " - Value: " + DYMO_GetText(Object))
Next
Else
PrintN("NO Objects found")
EndIf
EndProcedure
Define i
; first of all we have to initialize some things
If Not DYMO_Init()
MessageRequester("Error", "DYMO-Objects couldn't be created!")
End
EndIf
; search and list printer(s)
Define NrPrinters, PName.s
NrPrinters = DYMO_ExaminePrinters()
PrintN("DYMO-Printer found: " + Str(NrPrinters))
; list all printers
If NrPrinters > 0
For i = 0 To NrPrinters - 1
PName = DYMO_NextPrinter()
Print(#TAB$ + "'" + PName + "'")
If DYMO_IsTwinTurboPrinter(PName)
PrintN(" (TwinTurbo)")
Else
PrintN("")
EndIf
Next
Else
PrintN("NO Printers found")
EndIf
PrintN(#LF$)
; select a printer
;DYMO_SelectPrinter("MyDYMOprinter")
; show selected printer
PrintN("Current selected printer: " + DYMO_GetCurrentPrinterName())
Print(#TAB$ + "Selected tray: ")
Select DYMO_GetCurrentPaperTray()
Case #DYMO_Tray_Unknown
PrintN("Unknown")
Case #DYMO_Tray_Right
PrintN("Right")
Case #DYMO_Tray_Left
PrintN("Left")
Case #DYMO_Tray_Auto
PrintN("Auto")
EndSelect
PrintN(#LF$)
; Open label file
#LabelFile = #PB_Compiler_FilePath + "Sample_101x54.label"
If DYMO_OpenLabel(#LabelFile)
PrintN("File <" + #LabelFile + "> loaded")
Else
PrintN("Can't load file <" + #LabelFile + ">")
EndIf
; Open label file from URL
#LabelURL = "file://" + #PB_Compiler_FilePath + "Sample_101x54.label"
If DYMO_OpenLabel(#LabelFile)
PrintN("File from URL <" + #LabelURL + "> loaded")
Else
PrintN("Can't load file from URL <" + #LabelURL + ">")
EndIf
; Show Objects in current loaded .label
ShowObjects(#False) ; #False = we want to list all object, not only those who can be changed
PrintN(#LF$)
; open from memory
Define *Buf, BufSize
*Buf = ?Label_Sample_89x28_Start
BufSize = ?Label_Sample_89x28_End - ?Label_Sample_89x28_Start
If DYMO_OpenMemory(*Buf, BufSize)
PrintN("new label from buffer loaded")
Else
PrintN("Can't load label from buffer")
EndIf
; Show Objects in current loaded .label
ShowObjects()
PrintN(#LF$)
; let's set some new values
DYMO_SetField("CODE39", "NEW39")
DYMO_SetField("TXT", "newText")
DYMO_SetField("EAN8", "8888888")
DYMO_SetField("ADR2", "newAddress2")
DYMO_SetAddress("new Address")
DYMO_SetAddress("new new Address2", 2)
DYMO_SetImageFile("LOGO", "Sample_Logo.bmp")
PrintN("Modified objects")
ShowObjects() ; show new values
PrintN(#LF$)
; print some labels ... uncomment DYMO_PrintLabel() to send to printer
PrintN("Print one label")
;DYMO_PrintLabel()
PrintN("Print one label using right tray")
;DYMO_PrintLabel(1, #DYMO_Tray_Right)
; create more modifications and send all together to printer, as one job
DYMO_SetPrintMode(#False) ; print faster but in lower Quality (for labels with barcode or graphic)
DYMO_StartPrintJob()
For i = 1 To 5
PrintN("Create label nr. " + Str(i))
DYMO_SetField("CODE39", Str(i))
DYMO_SetField("TXT", "more Text")
DYMO_SetField("EAN8", Str(i * 8))
DYMO_SetField("ADR2", "more Address2" + #LF$ + "new line")
DYMO_SetAddress("more Address" + #LF$ + "new line")
DYMO_PrintLabel(1, #DYMO_Tray_Auto, #True) ; Auto switch tray and show print dialog
Next
PrintN("Send job to printer")
;DYMO_StopPrintJob() ; send job to printer, uncomment to send to printer
PrintN(#LF$)
PrintN("Any key to close ...")
Repeat
Until Inkey()
; CleanUp
DYMO_Release()
; Include sample label
DataSection
Label_Sample_89x28_Start:
IncludeBinary "Sample_89x28.label"
Label_Sample_89x28_End:
EndDataSection
; ExecutableFormat = Console
; CursorPosition = 1
; FirstLine = 1
; Folding = -
; CompileSourceDirectory
; EnableCompileCount = 0
; EnableBuildCount = 0
; EnableExeConstant
; EnableUnicode

41
LICENSE

@ -1,5 +1,44 @@
DYMO4PB
=======
MIT License
Copyright (c) <year> <copyright holders>
Copyright (c) <2019> <Imhotheb>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
COMatePLUS - Easy access to COM via (OLE) automation.
=====================================================
LICENSE
DAYLIKE
(Do As You LIKE with it!)
Nice and simple.
Needless to say though that I will accept no responsibility for any damage or injury (???) caused by the use (or misuse) of this software. I do not even assert that it is 'fit for purpose' in any way shape or form!
An acknowledgement within any application making use of this utility is always nice as would an acknowledgement to the original DispHelper software on which COMatePLUS is based (I do not know the name of the DispHelper author!)
Copyright © 2009
http://www.nxSoftware.com
With thanks to...
Thomas Schulz (ts-soft) http://www.realsource.de
Provided code for interfacing with ActiveX controls.
Tested early versions of COMate (which is now COMatePLUS).
Created some of the COMate demo programs.
Timo Harter (freak) http://freak.purearea.net/
Provided the know-how and code for connecting EventSinks with COM objects.
With thanks to Kiffi and mk-soft for their work on the PureDispHelper demo programs which have been translated for use with COMatePLUS.

44
README.md

@ -1,3 +1,45 @@
# DYMO4PB
-----
DYMO-Printer SDK Wrapper for PureBasic
## overview
Use DYMO Labelwriter with PureBasic. DYMO4PB provides simple access to the DYMO-SDK with COMatePlus:
* examine available DYMO printers
* open / save label from file
* open / save label from memory
* modify and print loaded labels
* change text / address / barcode / graphic
* smart paste from clipboard / file / string
* create printjobs for faster printing
* manage MRU-Labels (Most Recently Used)
* create DLL
-----
## what you need
* [DYMO Label Software](dymo.com) (DLS) have to be installed. This Include is created for DLS v.8+ (year 2015+). Maybe it works with lower version, but this is untested.
* COMatePlus - Version 1.2 included (2010-06-09) (different author & license, see COMatePLUS.chm).
-----
## example:
```
DYMO_Init() ; Use this BEFORE any use of DYMO_*() commands.
DYMO_OpenLabel("MyLabelFile.label")
DYMO_SetField("TextField", "My Text")
DYMO_SetImageFile("Logo", "MyLogo.bmp")
DYMO_PrintLabel()
DYMO_Release()
```
All functions are described in the include file "DYMO.pbi".
---
## create DLL
If you want to use the DLL, simple compile "DYMO_CreateDLL.pb" and include "DYMO_DLL.pbi"

204
Sample_101x54.label

@ -0,0 +1,204 @@
<?xml version="1.0" encoding="utf-8"?>
<DieCutLabel Version="8.0" Units="twips">
<PaperOrientation>Landscape</PaperOrientation>
<Id>Shipping</Id>
<IsOutlined>false</IsOutlined>
<PaperName>30323 Shipping</PaperName>
<DrawCommands>
<RoundRectangle X="0" Y="0" Width="3060" Height="5715" Rx="270" Ry="270" />
</DrawCommands>
<ObjectInfo>
<BarcodeObject>
<Name>CODE128</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<Text>128</Text>
<Type>Code128Auto</Type>
<Size>Medium</Size>
<TextPosition>Bottom</TextPosition>
<TextFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<CheckSumFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<TextEmbedding>None</TextEmbedding>
<ECLevel>0</ECLevel>
<HorizontalAlignment>Center</HorizontalAlignment>
<QuietZonesPadding Left="0" Top="0" Right="0" Bottom="0" />
</BarcodeObject>
<Bounds X="307" Y="2426.80550976142" Width="5323" Height="549.194490238585" />
</ObjectInfo>
<ObjectInfo>
<BarcodeObject>
<Name>CODE39</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<Text>39</Text>
<Type>Code39</Type>
<Size>Medium</Size>
<TextPosition>Bottom</TextPosition>
<TextFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<CheckSumFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<TextEmbedding>None</TextEmbedding>
<ECLevel>0</ECLevel>
<HorizontalAlignment>Center</HorizontalAlignment>
<QuietZonesPadding Left="0" Top="0" Right="0" Bottom="0" />
</BarcodeObject>
<Bounds X="307" Y="1700.86454291943" Width="5323" Height="567.495080570165" />
</ObjectInfo>
<ObjectInfo>
<AddressObject>
<Name>ADR</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<HorizontalAlignment>Left</HorizontalAlignment>
<VerticalAlignment>Top</VerticalAlignment>
<TextFitMode>ShrinkToFit</TextFitMode>
<UseFullFontHeight>True</UseFullFontHeight>
<Verticalized>False</Verticalized>
<StyledText>
<Element>
<String xml:space="preserve">Address</String>
<Attributes>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" HueScale="100" />
</Attributes>
</Element>
</StyledText>
<ShowBarcodeFor9DigitZipOnly>False</ShowBarcodeFor9DigitZipOnly>
<BarcodePosition>AboveAddress</BarcodePosition>
<LineFonts>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
</LineFonts>
</AddressObject>
<Bounds X="1407.95670901745" Y="57.9999999999999" Width="1312.2494282613" Height="1531.32617136672" />
</ObjectInfo>
<ObjectInfo>
<TextObject>
<Name>TXT</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<HorizontalAlignment>Left</HorizontalAlignment>
<VerticalAlignment>Top</VerticalAlignment>
<TextFitMode>ShrinkToFit</TextFitMode>
<UseFullFontHeight>True</UseFullFontHeight>
<Verticalized>False</Verticalized>
<StyledText>
<Element>
<String xml:space="preserve">TextField</String>
<Attributes>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" HueScale="100" />
</Attributes>
</Element>
</StyledText>
</TextObject>
<Bounds X="307" Y="57.9999999999999" Width="1043.84077006479" Height="1488.62479392637" />
</ObjectInfo>
<ObjectInfo>
<AddressObject>
<Name>ADR2</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<HorizontalAlignment>Left</HorizontalAlignment>
<VerticalAlignment>Top</VerticalAlignment>
<TextFitMode>ShrinkToFit</TextFitMode>
<UseFullFontHeight>True</UseFullFontHeight>
<Verticalized>False</Verticalized>
<StyledText>
<Element>
<String xml:space="preserve">Address2</String>
<Attributes>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" HueScale="100" />
</Attributes>
</Element>
</StyledText>
<ShowBarcodeFor9DigitZipOnly>False</ShowBarcodeFor9DigitZipOnly>
<BarcodePosition>AboveAddress</BarcodePosition>
<LineFonts>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
</LineFonts>
</AddressObject>
<Bounds X="2825" Y="57.9999999999999" Width="1121.34568949463" Height="640.697441896488" />
</ObjectInfo>
<ObjectInfo>
<BarcodeObject>
<Name>EAN13</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>False</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<Text>123456789012</Text>
<Type>Ean13</Type>
<Size>Medium</Size>
<TextPosition>Bottom</TextPosition>
<TextFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<CheckSumFont Family="Arial" Size="8" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<TextEmbedding>Full</TextEmbedding>
<ECLevel>0</ECLevel>
<HorizontalAlignment>Center</HorizontalAlignment>
<QuietZonesPadding Left="0" Top="0" Right="0" Bottom="0" />
</BarcodeObject>
<Bounds X="2884.20432909825" Y="822.436207003584" Width="2745.79567090175" Height="677.298622559646" />
</ObjectInfo>
<ObjectInfo>
<TextObject>
<Name>FIXEDTEXT</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>False</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<HorizontalAlignment>Left</HorizontalAlignment>
<VerticalAlignment>Top</VerticalAlignment>
<TextFitMode>ShrinkToFit</TextFitMode>
<UseFullFontHeight>True</UseFullFontHeight>
<Verticalized>False</Verticalized>
<StyledText>
<Element>
<String xml:space="preserve">FixedText</String>
<Attributes>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" HueScale="100" />
</Attributes>
</Element>
</StyledText>
</TextObject>
<Bounds X="4195.74663619483" Y="57.9999999999999" Width="1434.25336380517" Height="616.296654787712" />
</ObjectInfo>
</DieCutLabel>

200
Sample_89x28.label

@ -0,0 +1,200 @@
<?xml version="1.0" encoding="utf-8"?>
<DieCutLabel Version="8.0" Units="twips">
<PaperOrientation>Landscape</PaperOrientation>
<Id>Address</Id>
<IsOutlined>false</IsOutlined>
<PaperName>30252 Address</PaperName>
<DrawCommands>
<RoundRectangle X="0" Y="0" Width="1581" Height="5040" Rx="270" Ry="270" />
</DrawCommands>
<ObjectInfo>
<BarcodeObject>
<Name>CODE39</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<Text>39</Text>
<Type>Code39</Type>
<Size>Medium</Size>
<TextPosition>Bottom</TextPosition>
<TextFont Family="Arial" Size="7.3125" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<CheckSumFont Family="Arial" Size="7.3125" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<TextEmbedding>None</TextEmbedding>
<ECLevel>0</ECLevel>
<HorizontalAlignment>Center</HorizontalAlignment>
<QuietZonesPadding Left="0" Top="0" Right="0" Bottom="0" />
</BarcodeObject>
<Bounds X="2606.24878436869" Y="1182.31427637014" Width="2165.22387188131" Height="310.685723629865" />
</ObjectInfo>
<ObjectInfo>
<TextObject>
<Name>TXT</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<HorizontalAlignment>Center</HorizontalAlignment>
<VerticalAlignment>Top</VerticalAlignment>
<TextFitMode>ShrinkToFit</TextFitMode>
<UseFullFontHeight>True</UseFullFontHeight>
<Verticalized>False</Verticalized>
<StyledText>
<Element>
<String xml:space="preserve">TextField</String>
<Attributes>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" HueScale="100" />
</Attributes>
</Element>
</StyledText>
</TextObject>
<Bounds X="331" Y="57.9999999999999" Width="3347.71367989887" Height="276.559816924009" />
</ObjectInfo>
<ObjectInfo>
<BarcodeObject>
<Name>EAN8</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<Text>1234567</Text>
<Type>Ean8</Type>
<Size>Medium</Size>
<TextPosition>Bottom</TextPosition>
<TextFont Family="Arial" Size="7.3125" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<CheckSumFont Family="Arial" Size="7.3125" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<TextEmbedding>Full</TextEmbedding>
<ECLevel>0</ECLevel>
<HorizontalAlignment>Center</HorizontalAlignment>
<QuietZonesPadding Left="0" Top="0" Right="0" Bottom="0" />
</BarcodeObject>
<Bounds X="331" Y="1182.31427637014" Width="2042.43266764554" Height="310.685723629865" />
</ObjectInfo>
<ObjectInfo>
<TextObject>
<Name>FixedTXT</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>False</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<HorizontalAlignment>Center</HorizontalAlignment>
<VerticalAlignment>Top</VerticalAlignment>
<TextFitMode>ShrinkToFit</TextFitMode>
<UseFullFontHeight>True</UseFullFontHeight>
<Verticalized>False</Verticalized>
<StyledText>
<Element>
<String xml:space="preserve">FixedTextField</String>
<Attributes>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" HueScale="100" />
</Attributes>
</Element>
</StyledText>
</TextObject>
<Bounds X="3822.75100835887" Y="57.9999999999999" Width="1130.24899164113" Height="276.559816924009" />
</ObjectInfo>
<ObjectInfo>
<AddressObject>
<Name>ADR</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<HorizontalAlignment>Center</HorizontalAlignment>
<VerticalAlignment>Middle</VerticalAlignment>
<TextFitMode>ShrinkToFit</TextFitMode>
<UseFullFontHeight>True</UseFullFontHeight>
<Verticalized>False</Verticalized>
<StyledText>
<Element>
<String xml:space="preserve">Address</String>
<Attributes>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" HueScale="100" />
</Attributes>
</Element>
</StyledText>
<ShowBarcodeFor9DigitZipOnly>False</ShowBarcodeFor9DigitZipOnly>
<BarcodePosition>AboveAddress</BarcodePosition>
<LineFonts>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
</LineFonts>
</AddressObject>
<Bounds X="331" Y="321.179033192721" Width="1514.85072937878" Height="720" />
</ObjectInfo>
<ObjectInfo>
<AddressObject>
<Name>ADR2</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>True</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<HorizontalAlignment>Center</HorizontalAlignment>
<VerticalAlignment>Middle</VerticalAlignment>
<TextFitMode>ShrinkToFit</TextFitMode>
<UseFullFontHeight>True</UseFullFontHeight>
<Verticalized>False</Verticalized>
<StyledText>
<Element>
<String xml:space="preserve">Address2</String>
<Attributes>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" HueScale="100" />
</Attributes>
</Element>
</StyledText>
<ShowBarcodeFor9DigitZipOnly>False</ShowBarcodeFor9DigitZipOnly>
<BarcodePosition>AboveAddress</BarcodePosition>
<LineFonts>
<Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
</LineFonts>
</AddressObject>
<Bounds X="3066.16415190697" Y="360.063973123377" Width="1886.83584809303" Height="720" />
</ObjectInfo>
<ObjectInfo>
<ImageObject>
<Name>LOGO</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
<BackColor Alpha="0" Red="255" Green="255" Blue="255" />
<LinkedObjectName />
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>False</IsVariable>
<GroupID>-1</GroupID>
<IsOutlined>False</IsOutlined>
<Image>iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAMSURBVBhXY/j//z8ABf4C/qc1gYQAAAAASUVORK5CYIIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Image>
<ScaleMode>Uniform</ScaleMode>
<BorderWidth>0</BorderWidth>
<BorderColor Alpha="255" Red="0" Green="0" Blue="0" />
<HorizontalAlignment>Center</HorizontalAlignment>
<VerticalAlignment>Center</VerticalAlignment>
</ImageObject>
<Bounds X="2089.75167339498" Y="332.013551213524" Width="720" Height="720" />
</ObjectInfo>
</DieCutLabel>

BIN
Sample_Logo.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Loading…
Откажи
Сачувај

Impressum | Datenschutz