Jump to content

Wolfernox

Members
  • Gesamte Inhalte

    11
  • Registriert seit

  • Letzter Besuch

Beiträge erstellt von Wolfernox

  1. vor 1 Minute schrieb daabm:

    Ist das der reale Code? Du fügst $data hinzu, lange bevor es gefüllt wird? Und ich würde der Listbox halt ein eindimensionales Array verfüttern, kein mehrdimensionales (wie es Import-CSV erzeugt). Select-Object dürfte Dir helfen nach dem Import-CSV :-)

    Danke bin noch ein Anfänger was powershell betrifft... könntest du mir sagen wo ich as genau reinschreiben muss?

  2. Hallo möchte den inhalt meiner csv-datei in eine listbox bekommen.

    Allerding soll in der listbox nur die erste spalte stehen. (also tisch, stuhl und maus. siehe bild)

     

    Mein jetziges script:

     

                 Add-Type -AssemblyName System.Windows.Forms
    [System.Windows.Forms.Application]::EnableVisualStyles()
    [void][System.Reflection.Assembly]::LoadWithPartialName( “System.Windows.Forms”)
    [void][System.Reflection.Assembly]::LoadWithPartialName( “Microsoft.VisualBasic”)
    
    $Form                            = New-Object system.Windows.Forms.Form
    $Form.ClientSize                 = '1250,500'
    $Form.text                       = "Ticket-Mail Generator"
    $Form.TopMost                    = $false
    
    #######################################################################
    # Labels
    #######################################################################
    
    $User_Lable                      = New-Object system.Windows.Forms.Label
    $User_Lable.text                 = "User:"
    $User_Lable.AutoSize             = $true
    $User_Lable.width                = 25
    $User_Lable.height               = 10
    $User_Lable.location             = New-Object System.Drawing.Point(13,26)
    $User_Lable.Font                 = 'Microsoft Sans Serif,10'
    
    $Betreff_Lable                   = New-Object system.Windows.Forms.Label
    $Betreff_Lable.text              = "Betreff:"
    $Betreff_Lable.AutoSize          = $true
    $Betreff_Lable.width             = 25
    $Betreff_Lable.height            = 10
    $Betreff_Lable.location          = New-Object System.Drawing.Point(13,52)
    $Betreff_Lable.Font              = 'Microsoft Sans Serif,10'
    
    $Geschaeftsservice_Lable               = New-Object system.Windows.Forms.Label
    $Geschaeftsservice_Lable.text          = "Listbox:"
    $Geschaeftsservice_Lable.AutoSize      = $true
    $Geschaeftsservice_Lable.width         = 25
    $Geschaeftsservice_Lable.height        = 10
    $Geschaeftsservice_Lable.location      = New-Object System.Drawing.Point(13,105)
    $Geschaeftsservice_Lable.Font          = 'Microsoft Sans Serif,10'
    
    $Inhalt_Lable                    = New-Object system.Windows.Forms.Label
    $Inhalt_Lable.text               = "Inhalt:"
    $Inhalt_Lable.AutoSize           = $true
    $Inhalt_Lable.width              = 25
    $Inhalt_Lable.height             = 10
    $Inhalt_Lable.location           = New-Object System.Drawing.Point(13,145)
    $Inhalt_Lable.Font               = 'Microsoft Sans Serif,10'
    
    
    #######################################################################
    # Eingabefelder
    #######################################################################
    
    $UserBox                         = New-Object system.Windows.Forms.TextBox
    $UserBox.width                   = 150
    $UserBox.height                  = 20
    $UserBox.location                = New-Object System.Drawing.Point(72,22)
    $UserBox.Font                    = 'Microsoft Sans Serif,10'
    
    $BetreffBox                      = New-Object system.Windows.Forms.TextBox
    $BetreffBox.width                = 350
    $BetreffBox.height               = 20
    $BetreffBox.location             = New-Object System.Drawing.Point(72,48)
    $BetreffBox.Font                 = 'Microsoft Sans Serif,10'
    
    
    
    
    $ListBox                         = New-Object system.Windows.Forms.ComboBox
    $ListBox.width                   = 1100
    $ListBox.height                  = 20
    $ListBox.location                = New-Object System.Drawing.Point(129,101)
    $ListBox.Font                    = 'Microsoft Sans Serif,10'
    $ListBox.Items.Add($data);  
    
    $Inhalt_txt                      = New-Object system.Windows.Forms.TextBox
    $Inhalt_txt.multiline            = $true
    $Inhalt_txt.width                = 950
    $Inhalt_txt.height               = 322
    $Inhalt_txt.location             = New-Object System.Drawing.Point(72,145)
    $Inhalt_txt.Font                 = 'Microsoft Sans Serif,10'
    
    
    #######################################################################
    # Standartwert der Eingabefelder
    #######################################################################
    
    $defaultValue = “”
    $UserBox.Text = $defaultValue
    $BetreffBox.Text = $defaultValue
    $ListBox.Text = $defaultValue
    $Inhalt_txt.Text = $defaultValue
    
    
    #######################################################################
    # CSV-Datei
    #######################################################################
    
    $data=Import-Csv -Path "C:\listbox.csv"
    
    
    
    #######################################################################
    # Skript-Start
    #######################################################################
    $Form.controls.AddRange(@($ListBox,$UserBox,$BetreffBox,$User_Lable,$Geschaeftsservice_Lable,$Betreff_Lable,$Inhalt_Lable,$Inhalt_txt,$Senden))
    
    
    
    
    [void]$Form.ShowDialog()

     

    grafik.png

    grafik.png

  3. vor 4 Minuten schrieb MurdocX:

    Ich verschicke meine Mails so (stark vereinfacht):

     

    
    # Abschnitte
    $Person = "Hr. Mücke"
    $MeinPersAnrede = "Sehr geehrter $Person"
    $Abschluss = "MFG"
    
    # Mail
    $MeinText = @"
    $MeinPersAnrede
    
    HIER könnte IHR Text stehen.
    
    $Abschluss
    "@
    
    # Abfeuern :)
    Send-MailMessage -Encoding UTF8 -Body $MeinText -From "Ich@Ich.de" -SmtpServer "Mailserver" -Subject "Mein Betreff" -To "Du@Du.de" -Credential (Get-Credential)

     

    okay das verstehe ich, aber da sagst du ja auch das immer "Hr. Mücke" $Person ist. ich möchte aber immer das was eine person in dieses Textfeld reingeschrieben hat. (also keine feste variable)

  4. Gerade eben schrieb Dukel:

    Dann darfst du dich mit dem Com Objectmodell von MS Office bzw. Outlook auseinander setzen.

    Das ganze direkt als Mail verschicken ohne Umweg über Outlook ist keine Alternative?

    ohne Outlook würde es auch gehen. hauptsache die mail wird am ende verschickt. und davor sollte man halt noch irgendwo sehen wie der text wirklich aussieht

  5. Hallo,

     

    ich habe ein Formular erstellt indem man Wörter in Textboxen schreiben kann und in einer Listbox einen buchstaben auswählen kann.

     

    Jetzt möchte ich mit diesen angaben eine Mail erstellen.

     

    Z.B.:

    Hallo,

     

    Das ist eine Testmail.

     

    User: <UserBox>

    Betreff: <BetreffBox>

    Listbox: <ListBox>

    Inhalt:<Inhalt_txt>

     

    | = Eingaben aus dem Formular

     

     

    Folgendes Script habe ich schon:


    Add-Type -AssemblyName System.Windows.Forms
    [

    Add-Type -AssemblyName System.Windows.Forms
    [System.Windows.Forms.Application]::EnableVisualStyles()
    
    $Form                            = New-Object system.Windows.Forms.Form
    $Form.ClientSize                 = '1250,500'
    $Form.text                       = "Ticket-Mail Generator"
    $Form.TopMost                    = $false
    
    $ListBox                         = New-Object system.Windows.Forms.ComboBox
    $ListBox.text                    = "Bitte Auswählen"
    $ListBox.width                   = 1100
    $ListBox.height                  = 20
    @('A',
    'B',
    'C',
    'D',
    'E',
    'F',
    'G',
    'H',
    'I',
    'J',
    'K',
    'L',
    'M',
    'N',
    'O',
    'P',
    'Q',
    'R',
    'S',
    'T') | ForEach-Object {[void] $ListBox.Items.Add($_)}
    $ListBox.location                = New-Object System.Drawing.Point(129,101)
    $ListBox.Font                    = 'Microsoft Sans Serif,10'
    
    $UserBox                         = New-Object system.Windows.Forms.TextBox
    $UserBox.multiline               = $false
    $UserBox.width                   = 150
    $UserBox.height                  = 20
    $UserBox.location                = New-Object System.Drawing.Point(72,22)
    $UserBox.Font                    = 'Microsoft Sans Serif,10'
    
    $BetreffBox                      = New-Object system.Windows.Forms.TextBox
    $BetreffBox.multiline            = $false
    $BetreffBox.width                = 350
    $BetreffBox.height               = 20
    $BetreffBox.location             = New-Object System.Drawing.Point(72,48)
    $BetreffBox.Font                 = 'Microsoft Sans Serif,10'
    
    $User                            = New-Object system.Windows.Forms.Label
    $User.text                       = "User:"
    $User.AutoSize                   = $true
    $User.width                      = 25
    $User.height                     = 10
    $User.location                   = New-Object System.Drawing.Point(13,26)
    $User.Font                       = 'Microsoft Sans Serif,10'
    
    $Listbox                         = New-Object system.Windows.Forms.Label
    $Listbox.text                    = "Listbox:"
    $Listbox.AutoSize                = $true
    $Listbox.width                   = 25
    $Listbox.height                  = 10
    $Listbox.location                = New-Object System.Drawing.Point(13,105)
    $Listbox.Font                    = 'Microsoft Sans Serif,10'
    
    $Betreff                         = New-Object system.Windows.Forms.Label
    $Betreff.text                    = "Betreff:"
    $Betreff.AutoSize                = $true
    $Betreff.width                   = 25
    $Betreff.height                  = 10
    $Betreff.location                = New-Object System.Drawing.Point(13,52)
    $Betreff.Font                    = 'Microsoft Sans Serif,10'
    
    $Inhalt                          = New-Object system.Windows.Forms.Label
    $Inhalt.text                     = "Inhalt:"
    $Inhalt.AutoSize                 = $true
    $Inhalt.width                    = 25
    $Inhalt.height                   = 10
    $Inhalt.location                 = New-Object System.Drawing.Point(13,145)
    $Inhalt.Font                     = 'Microsoft Sans Serif,10'
    
    $Inhalt_txt                       = New-Object system.Windows.Forms.TextBox
    $Inhalt_txt.multiline             = $true
    $Inhalt_txt.text                  = "Bitte den Inhalt hier rein schreiben."
    $Inhalt_txt.width                 = 950
    $Inhalt_txt.height                = 322
    $Inhalt_txt.location              = New-Object System.Drawing.Point(72,145)
    $Inhalt_txt.Font                  = 'Microsoft Sans Serif,10'
    
    $Senden                          = New-Object system.Windows.Forms.Button
    $Senden.text                     = "Senden"
    $Senden.width                    = 100
    $Senden.height                   = 40
    $Senden.location                 = New-Object System.Drawing.Point(1100,420)
    $Senden.Font                     = 'Microsoft Sans Serif,10,style=Bold'
    $Senden.BackColor = "White"
    $Senden.FlatStyle = "Flat"
    $Senden.FlatAppearance.BorderColor = "Gray"
    $Senden.FlatAppearance.MouseOverBackColor = "LightBlue"
    $Senden.Cursor=[System.Windows.Forms.Cursors]::Hand
    $Senden.Add_Click({$UserBox.clear()})
    
    $Form.controls.AddRange(@($ListBox,$UserBox,$BetreffBox,$User,$Geschaeftsservice,$Betreff,$Inhalt,$Inhalt_txt,$Senden))
    
    
    [void]$Form.ShowDialog()

    Wenn man auf "Senden" drückt soll sich das mail programm öffnen und die mail soll schon im mail programm stehen. (Mail-programm: Outlook 2013)

  6. vor 1 Minute schrieb BOfH_666:

    Für Copy-Jobs wird normalerweise robocopy empfohlen. Schau Dir das mal an, vielleicht brauchst Du ja kein Powershell.

     

    Falls das für Deine Zwecke nicht ausreicht, wirst Du Dir entweder was passendes im Internet suchen müssen, oder Dir selbst was bauen. Solltest Du schon Poweshell-Code haben, mit dem Du nur Probleme hast, kannst Du den hier posten und beschreiben, welche Probleme Du hast und wir werden versuchen, Dir zu helfen. Dann wären aber ein paar detailiertere Informationen hilfreich.

    Habe bis jetzt nur 

    "Get-Content" von meiner Textdatei inder die Phade stehen mehr leider noch nicht...

    vor 5 Minuten schrieb Dukel:

    Ich weiß ja wie man datein verschieben kann möchte aber diese 800 Pfade ungerne alle abtippen

  7. Hallo,

    ich habe in frage bezüglich Powershell.

     

    Ich habe ein textdokument, indem ca. 800 Pfade zu PDF-Datein untereinander aufgelistet sind.

    Z.B.:

    J:\USER\HJD\A\AC\AfwCE\test1.pdf
    J:\USER\HJD\B\AC\ACEwef\test2.pdf
    J:\USER\HJD\KJGD\AC\AwfeCE\test3.pdf
    J:\USER\HJD\A\AdsC\ACgrthE\test4.pdf
    J:\USER\HJD\A\A4321C\ACjztE\test5.pdf
    J:\USER\HJD\A\LLLO\AzjtCE\test6.pdf

     

    und ich möchte die ganzen PDF-Datein auf mein C-Laufwerk in ein verzeichnis verschieben.

     

     

    Hat dafür jemand eine Lösung?

×
×
  • Neu erstellen...