Skip to content

Instantly share code, notes, and snippets.

@rosshiga
Created August 4, 2021 23:58
Show Gist options
  • Save rosshiga/12eb31ea6ee52b51af6751b9a93705a2 to your computer and use it in GitHub Desktop.
Save rosshiga/12eb31ea6ee52b51af6751b9a93705a2 to your computer and use it in GitHub Desktop.
Bartender Speed Label Program Replacement
<#
.Description
A program to interface Br Data with Bartender manually
#>
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$form = New-Object System.Windows.Forms.Form
$form.Text = 'Select a Computer'
$form.Size = New-Object System.Drawing.Size(300,600)
$form.StartPosition = 'CenterScreen'
$okButton = New-Object System.Windows.Forms.Button
$okButton.Location = New-Object System.Drawing.Point(75,500)
$okButton.Size = New-Object System.Drawing.Size(75,23)
$okButton.Text = 'OK'
$okButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
$form.AcceptButton = $okButton
$form.Controls.Add($okButton)
$cancelButton = New-Object System.Windows.Forms.Button
$cancelButton.Location = New-Object System.Drawing.Point(150,500)
$cancelButton.Size = New-Object System.Drawing.Size(75,23)
$cancelButton.Text = 'Cancel'
$cancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
$form.CancelButton = $cancelButton
$form.Controls.Add($cancelButton)
$label = New-Object System.Windows.Forms.Label
$label.Location = New-Object System.Drawing.Point(10,20)
$label.Size = New-Object System.Drawing.Size(280,20)
$label.Text = 'Please select a label template:'
$form.Controls.Add($label)
$listBox = New-Object System.Windows.Forms.ListBox
$listBox.Location = New-Object System.Drawing.Point(10,40)
$listBox.Size = New-Object System.Drawing.Size(260,20)
$listBox.Height = 450
Get-ChildItem "G:\Labels" -Filter *.btw |
Foreach-Object {
[void] $listBox.Items.Add($_.Name)
}
$form.Controls.Add($listBox)
$form.Topmost = $true
$result = $form.ShowDialog()
if ($result -eq [System.Windows.Forms.DialogResult]::OK)
{
$template = $listBox.SelectedItem
$listBox.Items.Clear()
$label.Text = 'Please select user label file'
Get-ChildItem "G:\" -Filter lbl*.txt |
Foreach-Object {
[void] $listBox.Items.Add($_.Name)
}
$result = $form.ShowDialog()
if ($result -eq [System.Windows.Forms.DialogResult]::OK)
{
$lblFile = $listBox.SelectedItem
echo "C:\Program Files\Seagull\BarTender 2019\bartend.exe" /F="G:\LABELS\$template" /PD /X /D="G:\$lblFile"
& "C:\Program Files\Seagull\BarTender 2019\bartend.exe" /F="G:\LABELS\$template" /PD /X /D="G:\$lblFile"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment