lamancha
Goto Top

Regeln in Outlook 2013 verwalten: Suchliste sortieren?

Für diverse Regeln sind Suchlisten möglich. Dort hinein können Wörter hinzugefügt werden, und aus der Liste können Wörter entfernt werden:

40d3738ee5bfee4e3e8cba81c92d232e

Wie aber kann ich bitte die Wörter in der Suchliste sortieren lassen, oder wenigstens die Reihenfolge durch Verschieben verändern? Gibt es irgendwo eine (.txt-) Datei, in der die Wörter abgelegt sind, und die man editieren kann?

Content-Key: 236855

Url: https://administrator.de/contentid/236855

Printed on: April 25, 2024 at 11:04 o'clock

Member: colinardo
colinardo Apr 30, 2014 updated at 13:07:36 (UTC)
Goto Top
Hallo LaMancha,
die Regeln werden binär im MAPI-Store abgelegt und sind daher wohl eher nicht in deiner gewünschten Art und Weise bearbeitbar. Es gibt aber ein Outlook-AddIn mit dem du die Einträge in einer Textbox umsortieren kannst:
http://www.sperrysoftware.com/outlook/power-rules-manager.asp

7162690e0af6e38d6a66a9147c6f5b76

Grüße Uwe
Member: LaMancha
LaMancha Apr 30, 2014 at 13:30:10 (UTC)
Goto Top
Hallo Uwe,

Danke für den Hinweis, mit diesem Outlook-AddIn könnte ich wohl meine Vorstellungen irgendwie realisieren. Aber der Preis von $39.95 nur dafür ist mir dann angesichts meines "Budgets" doch deutlich zu hoch. Ob es noch eine Alternative gibt?

Grüße - LaMancha
Member: colinardo
colinardo Apr 30, 2014 updated at 19:08:56 (UTC)
Goto Top
Zitat von @LaMancha:
Danke für den Hinweis, mit diesem Outlook-AddIn könnte ich wohl meine Vorstellungen irgendwie realisieren. Aber der
Preis von $39.95 nur dafür ist mir dann angesichts meines "Budgets" doch deutlich zu hoch. Ob es noch eine Alternative gibt?
Wie oft musst du die den umsortieren ?? Software als Trial gezogen umsortiert, feddich face-smile
Alternative: Selber mit VBA die Regeln bearbeiten. Werde mir das mal ansehen (geht ja ab OL2007)

Grüße Uwe
Member: LaMancha
LaMancha May 02, 2014 at 08:20:01 (UTC)
Goto Top
Zitat von @colinardo:
Wie oft musst du die den umsortieren?
Hallo Uwe,

etwa 2 bis 3 mal pro Woche bekomme ich Emails mit Zeichenfolgen im Nachrichtenkopf, die ich in die "Sofort endgültig löschen"-Liste einfügen möchte.

Weil die vorhandenen ca. 300 Einträge nicht sortiert und auch nicht durchsuchbar sind, kann ich nicht einfach feststellen, ob eine ähnliche Zeichenfolge schon eingetragen ist und nur noch etwas geändert werden muss.

Wenn ich dann einen Eintrag hinzufüge, wird er am Ende der Liste angefügt, und die Sortierung, wenn es denn eine gäbe, wäre wieder kaputt und müsste entsprechend wiederholt werden. Also würde mir eine einmalige Sortierung mit einer Trial-Software nicht wirklich helfen.

Grüße - LaMancha
Member: colinardo
colinardo May 02, 2014 at 08:24:40 (UTC)
Goto Top
OK, habe bereits eine Lösung mit Powershell und GUI programmiert, sobald ich die Sortierung mit eingebaut habe (im Moment nur hoch und runterschieben), werde ich dir den Code hier reinstellen...

Grüße Uwe
Member: LaMancha
LaMancha May 02, 2014 at 11:46:30 (UTC)
Goto Top
Hallo Uwe,

das hört sich sehr gut an. Über den Code werde ich mich sehr freuen - und wahrscheinlich noch manch andere(r) auch.

Grüße - LaMancha
Member: colinardo
Solution colinardo May 03, 2014 updated at 11:27:52 (UTC)
Goto Top
So hier mal die Powershell-Lösung.

Wichtige Hinweise: Es sind im Moment nur Bedingungen bearbeitbar welche eine Liste von Strings akzeptieren. Da hier etliche unterschiedliche Dialoge zu implementieren wären um den kompletten Dialog nach zu bauen, habe ich es erst mal dabei gelassen; ist ja auch eigentlich Quatsch da es den Regel-Dialog ja schon in Outlook gibt. Die Ausnahmen und Aktionen sind auch noch nicht implementiert. Als direktes Outlook-Plugin wäre es ja auch besser implementiert, aber das kriegt Ihr von mir nicht kostenlos face-wink

Das ganze sieht dann so aus:

3263a089e23398b953dcbfab2c046bc7

Man führt das Powershell-Script aus (Outlook am besten vorher schon gestartet haben), wählt mit dem Button den gewünschten Outlook-Store (ob ein Ordner im Dialog gewählt wird ist egal), dann wählt man die gewünschte Regel, es erscheinen dann rechts die aktivierten Bedingungen (im Moment kann nur die welchen mehrere Strings zugewiesen werden können). Um die Einträge der Bedingung zu bearbeiten Doppelklick auf den Eintrag, feddich.

Viel Spaß

Grüße Uwe
#region Import the Assemblies
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null  
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null  
# [reflection.assembly]::loadwithpartialname("Microsoft.Office.Interop.Outlook") | Out-Null  
#endregion

# Main Form
function FormMain {

#region Generated Form Objects
$formMain = New-Object System.Windows.Forms.Form
$label5 = New-Object System.Windows.Forms.Label
$label4 = New-Object System.Windows.Forms.Label
$label3 = New-Object System.Windows.Forms.Label
$label2 = New-Object System.Windows.Forms.Label
$label1 = New-Object System.Windows.Forms.Label
$lbActions = New-Object System.Windows.Forms.ListBox
$lbExceptions = New-Object System.Windows.Forms.ListBox
$lbConditions = New-Object System.Windows.Forms.ListBox
$lbRules = New-Object System.Windows.Forms.ListBox
$btnChooseStore = New-Object System.Windows.Forms.Button
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects

# $objOL = new-Object Microsoft.Office.Interop.Outlook.ApplicationClass
$objOL = New-Object -ComObject Outlook.Application

$Script:store = $null
$Script:rules = $null

$handler_btnChooseStore_Click= 
{
    $Script:store = $objOL.Session.PickFolder().Store
    if ($Script:store -ne $null){
        $Script:rules = $Script:store.GetRules()
        if ($Script:rules){
            $lbRules.Items.Clear()
            foreach($rule in $Script:rules){
                $lbRules.Items.Add($rule.Name)
            }
        }else{
            [System.Windows.Forms.MessageBox]::Show("Der gewählte Store beinhaltet keine Regeln, bitte wählen Sie einen anderen Store.",[System.Windows.Forms.MessageBoxIcon]::Exclamation)  
            $Script:rules = $null
        }
    }
}

$handler_lbRules_SelectedIndexChanged= 
{
    $lbConditions.Items.Clear()
    $Script:activeRule = $Script:rules.item($lbRules.SelectedIndex + 1)
    $Script:conditionArray = @()
    foreach($condition in $Script:activeRule.Conditions){
        if($condition.Enabled){
            $con = new-object PSObject -Property @{"Type"="";"Text"="";"Content"="";"class"=""}  
            switch($condition.ConditionType){
                2 {
                    $con.Type = $condition.ConditionType
                    $con.Text = "Wörter im Betreff"  
                    $con.Content = $Script:activeRule.Conditions.Subject.Text
                    }
                13 {
                    $con.Type = $condition.ConditionType
                    $con.Text = "Wörter im Body"  
                    $con.Content = $Script:activeRule.Conditions.Body.Text
                    }
                14 {
                    $con.Type = $condition.ConditionType
                    $con.Text = "Wörter im Betreff oder Body"  
                    $con.Content = $Script:activeRule.Conditions.BodyOrSubject.Text
                    }
                15 {
                    $con.Type = $condition.ConditionType
                    $con.Text = "Wörter in der Nachrichtenkopfzeile"  
                    $con.Content = $Script:activeRule.Conditions.MessageHeader.Text
                    }
                16 {
                    $con.Type = $condition.ConditionType
                    $con.Text = "Wörter in der Empfängeradresse"  
                    $con.Content = $Script:activeRule.Conditions.RecipientAddress.Address
                    }
                17 {
                    $con.Type = $condition.ConditionType
                    $con.Text = "Wörter in der Absenderadresse"  
                    $con.Content = $Script:activeRule.Conditions.SenderAddress.Address
                    }

                default {
                    $con.Type = -100
                    $con.Text = "xxx Noch nicht implementiert"  
                    }
            }
            $Script:conditionArray += $con
            $lbConditions.Items.Add($con.Text)
    
        }
    }

}

$handler_lbConditions_DoubleClick= 
{
    if ($lbConditions.SelectedIndex -gt -1){
        $cond = $Script:conditionArray[$lbConditions.SelectedIndex]
        switch($cond.Type){
            
            # String Arrays bearbeiten
            2 {
                $result = FormEntryEditor -items $cond.Content
                if ($result -ne $False){
                    $Script:activeRule.Conditions.Subject.Text = $result
                    $Script:rules.Save()
                }
            }
            13 {
                $result = FormEntryEditor -items $cond.Content
                if ($result -ne $False){
                    $Script:activeRule.Conditions.Body.Text = $result
                    $Script:rules.Save()
                }
            }
            14 {
                $result = FormEntryEditor -items $cond.Content
                if ($result -ne $False){
                    $Script:activeRule.Conditions.BodyOrSubject.Text = $result
                    $Script:rules.Save()
                }
            }
            15 {
                $result = FormEntryEditor -items $cond.Content
                if ($result -ne $False){
                    $Script:activeRule.Conditions.MessageHeader.Text = $result
                    $Script:rules.Save()
                }
            }
            16 {
                $result = FormEntryEditor -items $cond.Content
                if ($result -ne $False){
                    $Script:activeRule.Conditions.RecipientAddress.Address = $result
                    $Script:rules.Save()
                }
            }
            17 {
                $result = FormEntryEditor -items $cond.Content
                if ($result -ne $False){
                    $Script:activeRule.Conditions.SenderAddress.Address = $result
                    $Script:rules.Save()
                }
            }
            -100 {
                [System.Windows.MessageBox]::Show("Diese Bedingung wurde noch nicht implementiert!")  
            }
        } # End Switch
        
    }

}

$handler_lbExceptions_DoubleClick= 
{

}

$handler_lbActions_DoubleClick= 
{

}

$OnLoadForm_StateCorrection=
{#Correct the initial state of the form to prevent the .Net maximized form issue
	$formMain.WindowState = $InitialFormWindowState
}

#----------------------------------------------
#region Generated Form Code
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 253
$System_Drawing_Size.Width = 723
$formMain.ClientSize = $System_Drawing_Size
$formMain.DataBindings.DefaultDataSourceUpdateMode = 0
$formMain.FormBorderStyle = 3
$formMain.MaximizeBox = $False
$formMain.Name = "formMain"  
$formMain.Text = "Regel Editor"  

$label5.DataBindings.DefaultDataSourceUpdateMode = 0
$label5.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,0,3,0)  
$label5.ForeColor = [System.Drawing.Color]::FromArgb(255,128,128,128)

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 486
$System_Drawing_Point.Y = 9
$label5.Location = $System_Drawing_Point
$label5.Name = "label5"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 15
$System_Drawing_Size.Width = 224
$label5.Size = $System_Drawing_Size
$label5.TabIndex = 9
$label5.Text = "Doppelklicken um Einträge zu bearbeiten"  
$label5.TextAlign = 4

$formMain.Controls.Add($label5)

$label4.DataBindings.DefaultDataSourceUpdateMode = 0
$label4.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,1,3,0)  

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 540
$System_Drawing_Point.Y = 41
$label4.Location = $System_Drawing_Point
$label4.Name = "label4"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 170
$label4.Size = $System_Drawing_Size
$label4.TabIndex = 8
$label4.Text = "Aktionen"  
$label4.TextAlign = 32

$formMain.Controls.Add($label4)

$label3.DataBindings.DefaultDataSourceUpdateMode = 0
$label3.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,1,3,0)  

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 364
$System_Drawing_Point.Y = 41
$label3.Location = $System_Drawing_Point
$label3.Name = "label3"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 170
$label3.Size = $System_Drawing_Size
$label3.TabIndex = 7
$label3.Text = "Ausnahmen"  
$label3.TextAlign = 32

$formMain.Controls.Add($label3)

$label2.DataBindings.DefaultDataSourceUpdateMode = 0
$label2.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,1,3,0)  

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 188
$System_Drawing_Point.Y = 41
$label2.Location = $System_Drawing_Point
$label2.Name = "label2"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 170
$label2.Size = $System_Drawing_Size
$label2.TabIndex = 6
$label2.Text = "Bedingungen"  
$label2.TextAlign = 32

$formMain.Controls.Add($label2)

$label1.DataBindings.DefaultDataSourceUpdateMode = 0
$label1.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,1,3,0)  

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 41
$label1.Location = $System_Drawing_Point
$label1.Name = "label1"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 170
$label1.Size = $System_Drawing_Size
$label1.TabIndex = 5
$label1.Text = "Regeln"  
$label1.TextAlign = 32

$formMain.Controls.Add($label1)

$lbActions.DataBindings.DefaultDataSourceUpdateMode = 0
$lbActions.FormattingEnabled = $True
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 540
$System_Drawing_Point.Y = 67
$lbActions.Location = $System_Drawing_Point
$lbActions.Name = "lbActions"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 173
$System_Drawing_Size.Width = 170
$lbActions.Size = $System_Drawing_Size
$lbActions.TabIndex = 4
$lbActions.add_DoubleClick($handler_lbActions_DoubleClick)

$formMain.Controls.Add($lbActions)

$lbExceptions.DataBindings.DefaultDataSourceUpdateMode = 0
$lbExceptions.FormattingEnabled = $True
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 364
$System_Drawing_Point.Y = 67
$lbExceptions.Location = $System_Drawing_Point
$lbExceptions.Name = "lbExceptions"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 173
$System_Drawing_Size.Width = 170
$lbExceptions.Size = $System_Drawing_Size
$lbExceptions.TabIndex = 3
$lbExceptions.add_DoubleClick($handler_lbExceptions_DoubleClick)

$formMain.Controls.Add($lbExceptions)

$lbConditions.DataBindings.DefaultDataSourceUpdateMode = 0
$lbConditions.FormattingEnabled = $True
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 188
$System_Drawing_Point.Y = 67
$lbConditions.Location = $System_Drawing_Point
$lbConditions.Name = "lbConditions"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 173
$System_Drawing_Size.Width = 170
$lbConditions.Size = $System_Drawing_Size
$lbConditions.TabIndex = 2
$lbConditions.add_DoubleClick($handler_lbConditions_DoubleClick)

$formMain.Controls.Add($lbConditions)

$lbRules.DataBindings.DefaultDataSourceUpdateMode = 0
$lbRules.FormattingEnabled = $True
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 67
$lbRules.Location = $System_Drawing_Point
$lbRules.Name = "lbRules"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 173
$System_Drawing_Size.Width = 170
$lbRules.Size = $System_Drawing_Size
$lbRules.TabIndex = 1
$lbRules.add_SelectedIndexChanged($handler_lbRules_SelectedIndexChanged)

$formMain.Controls.Add($lbRules)


$btnChooseStore.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 12
$btnChooseStore.Location = $System_Drawing_Point
$btnChooseStore.Name = "btnChooseStore"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 107
$btnChooseStore.Size = $System_Drawing_Size
$btnChooseStore.TabIndex = 0
$btnChooseStore.Text = "Store wählen"  
$btnChooseStore.UseVisualStyleBackColor = $True
$btnChooseStore.add_Click($handler_btnChooseStore_Click)

$formMain.Controls.Add($btnChooseStore)

#endregion Generated Form Code

#Save the initial state of the form
$InitialFormWindowState = $formMain.WindowState
#Init the OnLoad event to correct the initial state of the form
$formMain.add_Load($OnLoadForm_StateCorrection)
#Show the Form
$formMain.ShowDialog()| Out-Null

# Garbage collection
$objOL = $null
}


# -- Editor für String Arrays ----
function FormEntryEditor {
param(
    [string[]]$items
)
#region Generated Form Objects
$formEntryEditor = New-Object System.Windows.Forms.Form
$btnSort = New-Object System.Windows.Forms.Button
$btnToBottom = New-Object System.Windows.Forms.Button
$btnToTop = New-Object System.Windows.Forms.Button
$btnRemove = New-Object System.Windows.Forms.Button
$btnAdd = New-Object System.Windows.Forms.Button
$txtAdd = New-Object System.Windows.Forms.TextBox
$btnCancel = New-Object System.Windows.Forms.Button
$btnSave = New-Object System.Windows.Forms.Button
$btnDown = New-Object System.Windows.Forms.Button
$btnUp = New-Object System.Windows.Forms.Button
$lbItems = New-Object System.Windows.Forms.ListBox
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects

$handler_btnCancel_Click= 
{
    $Global:result = $false
}

$handler_btnDown_Click= 
{
    $lbItems.Sorted = $false
    $intSelIndex = $lbItems.SelectedIndex
    if ($intSelIndex -lt $lbItems.Items.Count -1 -and $intSelIndex -ne -1){
        $val = $lbItems.SelectedItem
        $lbItems.Items.RemoveAt($intSelIndex)
        $lbItems.Items.Insert($intSelIndex +1,$val)
        $lbItems.SelectedIndex = $intSelIndex +1
    }
}

$handler_btnUp_Click= 
{
    $lbItems.Sorted = $false
    $intSelIndex = $lbItems.SelectedIndex
    if ($intSelIndex -gt 0){
        $val = $lbItems.SelectedItem
        $lbItems.Items.RemoveAt($intSelIndex)
        $lbItems.Items.Insert($intSelIndex -1,$val)
        $lbItems.SelectedIndex = $intSelIndex -1
    }

}

$handler_formEntryEditor_Load= 
{
    $lbItems.Items.AddRange($items)
}

$handler_btnRemove_Click= 
{
    . $removeListBoxEntry
}

$handler_btnAdd_Click= 
{
    if ($txtAdd.Text -ne ""){  
        $lbItems.Sorted = $false
        $intSelIndex = $lbItems.SelectedIndex
        if ($intSelIndex -eq -1){
            $lbItems.Items.Add($txtAdd.Text)
        }else{
            $lbItems.Items.Insert($intSelIndex,$txtAdd.Text)
        }
        $txtAdd.Text = ""  
    }
}

$handler_formEntryEditor_FormClosed= 
{

}

$handler_btnSave_Click= 
{
    $arrNewOrder = [string[]]$lbItems.Items
    $Script:result = $arrNewOrder
}


$btnToBottom_OnClick= 
{
    $lbItems.Sorted = $false
    $intSelIndex = $lbItems.SelectedIndex
    if ($intSelIndex -ne -1){
        $val = $lbItems.SelectedItem
        $lbItems.Items.RemoveAt($intSelIndex)
        $lbItems.Items.Insert($lbItems.Items.Count,$val)
        $lbItems.SelectedIndex = $lbItems.Items.Count - 1
    }

}

$btnToTop_OnClick= 
{
    $lbItems.Sorted = $false
    $intSelIndex = $lbItems.SelectedIndex
    if ($intSelIndex -ne -1){
        $val = $lbItems.SelectedItem
        $lbItems.Items.RemoveAt($intSelIndex)
        $lbItems.Items.Insert(0,$val)
        $lbItems.SelectedIndex = 0
    }
}

$handler_lbItems_SelectedIndexChanged= 
{

}

$handler_btnSort_Click= 
{
    $lbItems.Sorted = $true
}

$handler_lbItems_KeyUp= 
{
    switch ($_.KeyCode){
        "Delete" {  
            . $removeListBoxEntry
        }
    }
}

$handler_txtAdd_KeyDown = {
    if ($_.KeyCode -eq "Enter"){. $handler_btnAdd_Click}  
}
$OnLoadForm_StateCorrection=
{#Correct the initial state of the form to prevent the .Net maximized form issue
	$formEntryEditor.WindowState = $InitialFormWindowState
}

$removeListBoxEntry = {
    if ($lbItems.SelectedIndex -ne -1){
        $oldIndex = $lbItems.SelectedIndex
        $lbItems.Items.RemoveAt($lbItems.SelectedIndex)
        if ($lbItems.Items.Count -gt $oldIndex){$lbItems.SelectedIndex = $oldIndex}
    }

}

#----------------------------------------------
#region Generated Form Code
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 300
$System_Drawing_Size.Width = 337
$formEntryEditor.ClientSize = $System_Drawing_Size
$formEntryEditor.DataBindings.DefaultDataSourceUpdateMode = 0
$formEntryEditor.FormBorderStyle = 6
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 326
$System_Drawing_Size.Width = 345
$formEntryEditor.MinimumSize = $System_Drawing_Size
$formEntryEditor.Name = "formEntryEditor"  
$formEntryEditor.StartPosition = 4
$formEntryEditor.ShowInTaskbar = $False
$formEntryEditor.Text = "Einträge bearbeiten"  
$formEntryEditor.add_Load($handler_formEntryEditor_Load)
$formEntryEditor.add_FormClosed($handler_formEntryEditor_FormClosed)

$btnSort.Anchor = 9

$btnSort.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 244
$System_Drawing_Point.Y = 227
$btnSort.Location = $System_Drawing_Point
$btnSort.Name = "btnSort"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$btnSort.Size = $System_Drawing_Size
$btnSort.TabIndex = 11
$btnSort.Text = "A-Z"  
$btnSort.UseVisualStyleBackColor = $True
$btnSort.add_Click($handler_btnSort_Click)

$formEntryEditor.Controls.Add($btnSort)

$btnToBottom.Anchor = 9

$btnToBottom.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 244
$System_Drawing_Point.Y = 175
$btnToBottom.Location = $System_Drawing_Point
$btnToBottom.Name = "btnToBottom"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$btnToBottom.Size = $System_Drawing_Size
$btnToBottom.TabIndex = 10
$btnToBottom.Text = "Nach unten"  
$btnToBottom.UseVisualStyleBackColor = $True
$btnToBottom.add_Click($btnToBottom_OnClick)

$formEntryEditor.Controls.Add($btnToBottom)

$btnToTop.Anchor = 9

$btnToTop.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 244
$System_Drawing_Point.Y = 88
$btnToTop.Location = $System_Drawing_Point
$btnToTop.Name = "btnToTop"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$btnToTop.Size = $System_Drawing_Size
$btnToTop.TabIndex = 9
$btnToTop.Text = "Nach oben"  
$btnToTop.UseVisualStyleBackColor = $True
$btnToTop.add_Click($btnToTop_OnClick)

$formEntryEditor.Controls.Add($btnToTop)

$btnRemove.Anchor = 9

$btnRemove.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 244
$System_Drawing_Point.Y = 39
$btnRemove.Location = $System_Drawing_Point
$btnRemove.Name = "btnRemove"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$btnRemove.Size = $System_Drawing_Size
$btnRemove.TabIndex = 8
$btnRemove.Text = "Entfernen"  
$btnRemove.UseVisualStyleBackColor = $True
$btnRemove.add_Click($handler_btnRemove_Click)

$formEntryEditor.Controls.Add($btnRemove)

$btnAdd.Anchor = 9

$btnAdd.DataBindings.DefaultDataSourceUpdateMode = 0

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 244
$System_Drawing_Point.Y = 10
$btnAdd.Location = $System_Drawing_Point
$btnAdd.Name = "btnAdd"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$btnAdd.Size = $System_Drawing_Size
$btnAdd.TabIndex = 7
$btnAdd.Text = "Hinzufügen"  
$btnAdd.UseVisualStyleBackColor = $True
$btnAdd.add_Click($handler_btnAdd_Click)

$formEntryEditor.Controls.Add($btnAdd)

$txtAdd.Anchor = 13
$txtAdd.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 12
$txtAdd.Location = $System_Drawing_Point
$txtAdd.Name = "txtAdd"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 20
$System_Drawing_Size.Width = 226
$txtAdd.Size = $System_Drawing_Size
$txtAdd.TabIndex = 6
$txtAdd.add_KeyDown($handler_txtAdd_KeyDown)

$formEntryEditor.Controls.Add($txtAdd)

$btnCancel.Anchor = 10

$btnCancel.DataBindings.DefaultDataSourceUpdateMode = 0
$btnCancel.DialogResult = 2

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 210
$System_Drawing_Point.Y = 265
$btnCancel.Location = $System_Drawing_Point
$btnCancel.Name = "btnCancel"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 109
$btnCancel.Size = $System_Drawing_Size
$btnCancel.TabIndex = 4
$btnCancel.Text = "Abbrechen"  
$btnCancel.UseVisualStyleBackColor = $True
$btnCancel.add_Click($handler_btnCancel_Click)

$formEntryEditor.Controls.Add($btnCancel)

$btnSave.Anchor = 10

$btnSave.DataBindings.DefaultDataSourceUpdateMode = 0
$btnSave.DialogResult = 1

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 88
$System_Drawing_Point.Y = 265
$btnSave.Location = $System_Drawing_Point
$btnSave.Name = "btnSave"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 116
$btnSave.Size = $System_Drawing_Size
$btnSave.TabIndex = 3
$btnSave.Text = "Speichern"  
$btnSave.UseVisualStyleBackColor = $True
$btnSave.add_Click($handler_btnSave_Click)

$formEntryEditor.Controls.Add($btnSave)

$btnDown.Anchor = 9

$btnDown.DataBindings.DefaultDataSourceUpdateMode = 0
$btnDown.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,0,3,1)  

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 244
$System_Drawing_Point.Y = 146
$btnDown.Location = $System_Drawing_Point
$btnDown.Name = "btnDown"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$btnDown.Size = $System_Drawing_Size
$btnDown.TabIndex = 2
$btnDown.Text = "˅"  
$btnDown.UseVisualStyleBackColor = $True
$btnDown.add_Click($handler_btnDown_Click)

$formEntryEditor.Controls.Add($btnDown)

$btnUp.Anchor = 9

$btnUp.DataBindings.DefaultDataSourceUpdateMode = 0
$btnUp.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,0,3,1)  

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 244
$System_Drawing_Point.Y = 117
$btnUp.Location = $System_Drawing_Point
$btnUp.Name = "btnUp"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$btnUp.Size = $System_Drawing_Size
$btnUp.TabIndex = 1
$btnUp.Text = "˄"  
$btnUp.UseVisualStyleBackColor = $True
$btnUp.add_Click($handler_btnUp_Click)

$formEntryEditor.Controls.Add($btnUp)

$lbItems.Anchor = 15
$lbItems.DataBindings.DefaultDataSourceUpdateMode = 0
$lbItems.FormattingEnabled = $True
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 12
$System_Drawing_Point.Y = 38
$lbItems.Location = $System_Drawing_Point
$lbItems.Name = "lbItems"  
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 212
$System_Drawing_Size.Width = 226
$lbItems.Size = $System_Drawing_Size
$lbItems.TabIndex = 0
$lbItems.add_SelectedIndexChanged($handler_lbItems_SelectedIndexChanged)
$lbItems.add_KeyUp($handler_lbItems_KeyUp)

$formEntryEditor.Controls.Add($lbItems)

#endregion Generated Form Code

#Save the initial state of the form
$InitialFormWindowState = $formEntryEditor.WindowState
#Init the OnLoad event to correct the initial state of the form
$formEntryEditor.add_Load($OnLoadForm_StateCorrection)
#Show the Form
$formEntryEditor.ShowDialog()| Out-Null
return $Script:result
}

# Hauptfenster öffnen
FormMain
Member: LaMancha
LaMancha May 03, 2014 at 11:27:10 (UTC)
Goto Top
Hallo Uwe,

ein Super-Anfang! Für meine Zwecke reicht das erstmal völlig. Verschieben und Sortieren sind eine große Hilfe. Herzlichen Dank.

Für den Fall, dass die Grundidee ausgebaut werden sollte, möchte ich schon einmal weitere Ideen für solche Funktionen erwähnen:

- Es wäre schön, die vorhandenen Einträge einzeln bearbeiten zu können (im Standard wird die Zeichenfolge beim Anklicken in das Hinzufügen-Feld kopiert und kann dann -nach einer Änderung- der Suchliste hinzugefügt werden, aber das Löschen des alten Eintrages verbleibt beim Anwender).

- Es wäre schön, wenn man alle Einträge der Suchliste markieren und a) in die Zwischenablage kopieren oder b) löschen könnte. Entsprechend müsste es möglich sein, mehrere Einträge aus der Zwischenablage hinzuzufügen.

- Es wäre schön, wenn man mehrere Zeilen markieren und dann alle markierten Zeilen "Nach oben" oder "Nach unten" verschieben könnte. Beispielsweise alle .com mit Strg+C per Hand markieren und dann als Block an den Anfang der Suchliste verschieben.

Grüße - LaMancha
Member: colinardo
colinardo May 03, 2014 updated at 12:24:18 (UTC)
Goto Top
klar, das kann man bis zum Exzess treiben, aber dann kann man ja auch gleich eine Textbox anstatt einer Listbox einbauen in welcher man nach Lust und Laune hantieren kann...

Da war mir meine freie Zeit dann doch zu Schade, dass
mit der Listbox so weit zu treiben... den Quellcode hast du ja jetzt, kannst also auch mal selber damit hantieren face-wink

Grüße Uwe