我在Visual Basic中有这个脚本:
<SCRIPT LANGUAGE=VBScript>
Sub DrukujKodKreskowy()
Dim DymoAddIn, DymoLabel, pole, kod
Set DymoAddIn = CreateObject("DYMO.DymoAddIn")
Set DymoLabel = CreateObject("DYMO.DymoLabels")
DymoAddIn.Open "c:\Ceramika_11352.LWL"
kod=document.forms("form1").item("txtBarkod").value
pole="KOD"
DymoLabel.SetField pole,kod
DymoAddIn.Print 1, TRUE
DymoAddIn.Quit
End Sub
</SCRIPT>
我想在JavaScript中编写相同的脚本,因为我希望能够在Chrome中打开它。我试过了,但它不起作用。
这是脚本:
<script src="http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest"
if (label.getAddressObjectCount() == 0)
{
alert("Selected label does not have an address object on it. Select another label");
}
var printer = dymo.label.framework.getPrinters();
var label = dymo.label.framework.openFile('C:\Ceramika_11352.LWL');
label.print(printer.value);
<script>