diff --git a/Installation.exe b/Installation.exe new file mode 100644 index 0000000..576419b Binary files /dev/null and b/Installation.exe differ diff --git a/Installation.ps1 b/Installation.ps1 new file mode 100644 index 0000000..09d29b6 --- /dev/null +++ b/Installation.ps1 @@ -0,0 +1,163 @@ +# Donwnload Image + +try{ + New-Item -Path C:\ -Name Scripts -ItemType directory + New-Item -Path C:\Scripts\ -Name Telefonie -ItemType directory + + $wc = New-Object System.Net.WebClient + $wc.DownloadFile("https://github.com/julianbruegger/3cx-Notes/blob/main/Telefon_Notizen.exe?raw=true", "C:\Scripts\Telefonie\Telefon_Notizen.exe") + New-Item -Path C:\Scripts\Telefonie\ -Name bin -ItemType directory + #Start-BitsTransfer -Source https://github.com/julianbruegger/3cx-Notes/blob/main/bin/3cx_notes.png?raw=true -Destination C:\Scripts\Telefonie\bin\3cx_notes.png + $wc.DownloadFile("https://github.com/julianbruegger/3cx-Notes/blob/main/bin/3cx_notes.png?raw=true", "C:\Scripts\Telefonie\bin\3cx_notes.png") + $wc.DownloadFile("https://github.com/julianbruegger/3cx-Notes/blob/main/bin/favicon.ico?raw=true", "C:\Scripts\Telefonie\bin\favicon.ico") + + Add-Type -AssemblyName System.Windows.Forms + Add-Type -AssemblyName System.Drawing + + $form = New-Object System.Windows.Forms.Form + $form.Text = 'Einrichtung 3cx-Notes' + $form.Size = New-Object System.Drawing.Size(300,200) + $form.StartPosition = 'CenterScreen' + + $okButton = New-Object System.Windows.Forms.Button + $okButton.Location = New-Object System.Drawing.Point(75,120) + $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,120) + $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 = 'Bitte gebe dein Vorname in das Feld ein:' + $form.Controls.Add($label) + + $textBox = New-Object System.Windows.Forms.TextBox + $textBox.Location = New-Object System.Drawing.Point(10,40) + $textBox.Size = New-Object System.Drawing.Size(260,20) + $form.Controls.Add($textBox) + + $form.Topmost = $true + + $form.Add_Shown({$textBox.Select()}) + $result = $form.ShowDialog() + + if ($result -eq [System.Windows.Forms.DialogResult]::OK) + { + $Vorname = $textBox.Text + } + Add-Type -AssemblyName System.Windows.Forms + Add-Type -AssemblyName System.Drawing + + $form = New-Object System.Windows.Forms.Form + $form.Text = 'Einrichtung 3cx-Notes' + $form.Size = New-Object System.Drawing.Size(300,200) + $form.StartPosition = 'CenterScreen' + + $okButton = New-Object System.Windows.Forms.Button + $okButton.Location = New-Object System.Drawing.Point(75,120) + $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,120) + $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 = 'Bitte gebe dein Nachname in das Feld ein:' + $form.Controls.Add($label) + + $textBox = New-Object System.Windows.Forms.TextBox + $textBox.Location = New-Object System.Drawing.Point(10,40) + $textBox.Size = New-Object System.Drawing.Size(260,20) + $form.Controls.Add($textBox) + + $form.Topmost = $true + + $form.Add_Shown({$textBox.Select()}) + $result = $form.ShowDialog() + + if ($result -eq [System.Windows.Forms.DialogResult]::OK) + { + $Nachname = $textBox.Text + } + + Add-Type -AssemblyName System.Windows.Forms + Add-Type -AssemblyName System.Drawing + + $form = New-Object System.Windows.Forms.Form + $form.Text = 'Einrichtung 3cx-Notes' + $form.Size = New-Object System.Drawing.Size(300,200) + $form.StartPosition = 'CenterScreen' + + $okButton = New-Object System.Windows.Forms.Button + $okButton.Location = New-Object System.Drawing.Point(75,120) + $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,120) + $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 = 'Bitte gebe deine E-Mail addresse in das Feld ein:' + $form.Controls.Add($label) + + $textBox = New-Object System.Windows.Forms.TextBox + $textBox.Location = New-Object System.Drawing.Point(10,40) + $textBox.Size = New-Object System.Drawing.Size(260,20) + $form.Controls.Add($textBox) + + $form.Topmost = $true + + $form.Add_Shown({$textBox.Select()}) + $result = $form.ShowDialog() + + if ($result -eq [System.Windows.Forms.DialogResult]::OK) + { + $Mail = $textBox.Text + $x = $Vorname + " " +$Nachname +" <" +$Mail +">" + } + + $check = 1 + + New-Item -Path C:\Scripts\Telefonie\ -Name config.txt -ItemType file -Value $x + } + +catch{ + +[System.Windows.Forms.MessageBox]::Show("Fehler $error","Error",0,16) + +$check = 2 +} + +if ($check -eq 1){ +[System.Windows.Forms.MessageBox]::Show("Installation erfolgreich","Erfolgreich",0,64) +} \ No newline at end of file diff --git a/README.md b/README.md index 858e9bd..4e3a2a6 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,18 @@ +![GitHub repo size](https://img.shields.io/github/repo-size/julianbruegger/3cx-Notes) ![Lines of code](https://img.shields.io/tokei/lines/github/julianbruegger/3cx-Notes) ![GitHub all releases](https://img.shields.io/github/downloads/julianbruegger/3cx-Notes/total) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/julianbruegger/3cx-Notes) [![GitHub stars](https://img.shields.io/github/stars/julianbruegger/3cx-Notes)](https://github.com/julianbruegger/3cx-Notes/stargazers) # 3cx-Notes Für die bei uns im Betrieb angewendete 3cx Telefonlösung habe ich eine Notizsoftware erstellt. Diese ist einfach aufgebaut und ist kinderleicht zu bedienen. Basierend ist diese auf Powershell. -## Setup +## Installation +Um das Tool zu Installieren sollte einfach die akutellste `Installler.EXE` heruntergeladen werden. + +[](https://github.com/julianbruegger/3cx-Notes/releases/latest) + + + +### Setup 3CX Im Hauptmenü werden die Einstellungen unten rechts geöffnet. diff --git a/Telefon_Notizen.exe b/Telefon_Notizen.exe index 43ea178..e725dd7 100644 Binary files a/Telefon_Notizen.exe and b/Telefon_Notizen.exe differ diff --git a/Telefon_Notizen.ps1 b/Telefon_Notizen.ps1 index 716c8a7..0d9833f 100644 --- a/Telefon_Notizen.ps1 +++ b/Telefon_Notizen.ps1 @@ -6,23 +6,26 @@ TelefonnotizTool ICT-BZ #> - param($number, $name, $else) +$rootpath = "C:\Scripts\Telefonie" + + + $name = $name+$else Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.Application]::EnableVisualStyles() $Form = New-Object system.Windows.Forms.Form -$Form.ClientSize = New-Object System.Drawing.Point(400,400) -$Form.minimumSize = New-Object System.Drawing.Size(450,450) -$Form.maximumSize = New-Object System.Drawing.Size(450,450) +$Form.ClientSize = New-Object System.Drawing.Point(600,400) +$Form.minimumSize = New-Object System.Drawing.Size(650,450) +$Form.maximumSize = New-Object System.Drawing.Size(650,450) $Form.text = "Telefon-Notiz Tool" $Form.TopMost = $false -$FormImage = [system.drawing.image]::FromFile("C:\temp\Telefonie\bin\3cx_notes.png") +$FormImage = [system.drawing.image]::FromFile($rootpath+"\bin\3cx_notes.png") $Form.BackgroundImage = $FormImage $Form.BackgroundImageLayout = "Zoom" -$Form.icon = "C:\temp\Telefonie\bin\favicon.ico" +$Form.icon = $rootpath+"\bin\favicon.ico" $numberbox = New-Object system.Windows.Forms.TextBox @@ -147,7 +150,25 @@ $coppybutton.height = 30 $coppybutton.location = New-Object System.Drawing.Point(248,355) $coppybutton.Font = New-Object System.Drawing.Font('Calibri',10) -$Form.controls.AddRange(@($numberbox,$Tel_Nr,$mailbox,$namebox,$TextBox1,$Label1,$Label2,$betrefflable,$infolable,$betreffbox,$moreinfobox,$company,$cancle,$coppybutton,$ComboBox1)) + +$ComboBox1 = New-Object system.Windows.Forms.ComboBox +$ComboBox1.text = "Empfänger" +$ComboBox1.width = 200 +$ComboBox1.height = 20 +@('david.tassi@ict-bz.ch','horst.lang@ict-bz.ch','julia.stadelmann@ict-bz.ch','urs.nussbaumer@ict-bz.ch','nino.antonucci@ict-bz.ch','roland.spengler@ict-bz.ch','kilian.buerli@ict-bz.ch','rainer.klatt@ict-bz.ch','julian.bruegger@ict-bz.ch','lucas.taham@ict-bz.ch','tamara.tita@ict-bz.ch') | Sort-Object | ForEach-Object {[void] $ComboBox1.Items.Add($_)} +$ComboBox1.location = New-Object System.Drawing.Point(410,118) +$ComboBox1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) + +$mailbtn = New-Object system.Windows.Forms.Button +$mailbtn.text = "Send Mail" +$mailbtn.width = 126 +$mailbtn.height = 30 +$mailbtn.location = New-Object System.Drawing.Point(414,355) +$mailbtn.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) +$mailbtn.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#3be413") + + +$Form.controls.AddRange(@($numberbox,$Tel_Nr,$mailbox,$namebox,$TextBox1,$Label1,$Label2,$betrefflable,$infolable,$betreffbox,$moreinfobox,$company,$cancle,$coppybutton,$ComboBox1,$ComboBox1,$mailbtn)) $cancle.Add_Click({$form.Close()}) @@ -156,10 +177,56 @@ $coppybutton.Add_Click( $text = "Telefon Nummer: "+$numberbox.Text +"`r`nE-Mail: "+$mailbox.Text+"`r`nName: "+$namebox.Text+"`r`nFirma: "+$TextBox1.Text+"`r`nBetreff: "+$betreffbox.Text+"`r`nWeitere Infos: "+$moreinfobox.Text Set-Clipboard $text - #$form.Close() + + + + + $form.Close() }) + + +$mailbtn.Add_Click( + +{ + $Configpath = "C:\Scripts\Telefonie\config.txt" + $Mail = Get-Content $Configpath + $From = $Mail + $To = $ComboBox1.Text + $Date = Get-Date + $text = "Telefon Nummer: "+$numberbox.Text +"`r`nE-Mail: "+$mailbox.Text+"`r`nName: "+$namebox.Text+"`r`nFirma: "+$TextBox1.Text+"`r`nBetreff: "+$betreffbox.Text+"`r`nWeitere Infos: "+$moreinfobox.Text + Write-Host $text + $Subject = "Telefonnotiz - "+$env:UserName +" - " +$Date + $SMTPServer = "aspmx2.googlemail.com" + + Write-Host $To + + if($To -eq "Empfänger"){ + [System.Windows.Forms.MessageBox]::Show("Keine Mail addresse","Error",0,16) +} +else{ + try{ + Send-MailMessage -From "$From" -to "$To" -Subject "$Subject" -Body "$text" -SmtpServer "$SMTPServer" -Encoding ([System.Text.Encoding]::UTF8) -DeliveryNotificationOption OnSuccess + Write-Host $Error + $check = 1 + $form.Close() + } + + catch{ + [System.Windows.Forms.MessageBox]::Show("Mail konnte nicht versandt werden","Error",0,16) + $check = 2 + } + if ($check -eq 1){ + [System.Windows.Forms.MessageBox]::Show("Mail wurde an "+$To +" versendet.","Erfolgreich versendet",0,64) + $form.Close() + } + +} + +} +) + [void]$Form.ShowDialog() diff --git a/bin/ICT-BZ_Logo_Druck_Elemente_CMYK.png b/bin/ICT-BZ_Logo_Druck_Elemente_CMYK.png deleted file mode 100644 index 9921ec3..0000000 Binary files a/bin/ICT-BZ_Logo_Druck_Elemente_CMYK.png and /dev/null differ diff --git a/bin/tool.png b/bin/tool.png index b12ca3a..dc02619 100644 Binary files a/bin/tool.png and b/bin/tool.png differ