Powershell制作Dymo LabelWriter 450标签

时间:2019-11-13 21:53:49

标签: powershell label dymo

我做了一个标签,然后在记事本中打开它,并得到了以下内容。

<?xml version="1.0" encoding="utf-8"?>
<DieCutLabel Version="8.0" Units="twips" MediaType="Default">
<PaperOrientation>Landscape</PaperOrientation>
<Id>Small30336</Id>
<IsOutlined>false</IsOutlined>
<PaperName>30336 1 in x 2-1/8 in</PaperName>
<DrawCommands>
    <RoundRectangle X="0" Y="0" Width="1440" Height="3060" Rx="180" Ry="180" />
</DrawCommands>
<ObjectInfo>
    <TextObject>
        <Name>TEXT</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">Hello
World</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="130" Y="147" Width="2798" Height="1188" />
</ObjectInfo>

所以我想做的是使用powershell制作相同的标签,并根据下面的内容自动打印

$Word = "Hello"
$Word1 = "World"

@"
<?xml version="1.0" encoding="utf-8"?>
<DieCutLabel Version="8.0" Units="twips" MediaType="Default">
<PaperOrientation>Landscape</PaperOrientation>
<Id>Small30336</Id>
<IsOutlined>false</IsOutlined>
<PaperName>30336 1 in x 2-1/8 in</PaperName>
<DrawCommands>
    <RoundRectangle X="0" Y="0" Width="1440" Height="3060" Rx="180" Ry="180" />
</DrawCommands>
<ObjectInfo>
    <TextObject>
        <Name>TEXT</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">$Word
$Word1 </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="130" Y="147" Width="2798" Height="1188" />
    </ObjectInfo>
</DieCutLabel>
"@>Save.label
& ".\PrintLabel.exe" Save.label

有没有办法使这项工作可行或有更好的办法做到这一点?

它将打印出示例中的默认标签,而不是我想打个招呼的标签(在两行中)

我试图为每个链接添加完整的链接,但是这样做的确相同。

0 个答案:

没有答案