From a46d9cff2329d0dc22368f2ee9c7f2ea50510b60 Mon Sep 17 00:00:00 2001 From: ms Date: Tue, 18 Mar 2025 13:43:25 +0100 Subject: [PATCH] MSG2Server verbessert --- Dokumentation/Classes/cExtProgramme.vb | 23 +++++++++++++++++++ Dokumentation/Dokumentation.vbproj | 3 +++ .../My Project/Resources.Designer.vb | 2 +- Dokumentation/My Project/Resources.resx | 2 +- Dokumentation/msgsend.bat | 18 +++++++++++++++ Dokumentation/uscntr_SendMSG.vb | 11 +++++++-- 6 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 Dokumentation/msgsend.bat diff --git a/Dokumentation/Classes/cExtProgramme.vb b/Dokumentation/Classes/cExtProgramme.vb index 9754051..538a76f 100644 --- a/Dokumentation/Classes/cExtProgramme.vb +++ b/Dokumentation/Classes/cExtProgramme.vb @@ -5,6 +5,7 @@ Imports System.Security Imports System.Diagnostics Imports System.Text Imports System.Web +Imports iTextSharp.text.pdf.codec Public Class cExtProgramme @@ -123,6 +124,28 @@ Public Class cExtProgramme End Try End Function + Public Shared Function msg2server(nachricht As String, server As String) + Dim batfile As String = "msgsend.bat" + Dim args As String = """" & nachricht & """" & " " & server + ' MsgBox(args) + + Dim psi As New ProcessStartInfo() + psi.FileName = "cmd.exe" + psi.Arguments = "/c """ & batFile & " " & args & """" + psi.RedirectStandardOutput = True + psi.UseShellExecute = False + psi.CreateNoWindow = True + + Try + Dim process As Process = Process.Start(psi) + Dim output As String = process.StandardOutput.ReadToEnd() + process.WaitForExit() + Console.WriteLine(output) + Catch ex As Exception + Console.WriteLine("Fehler beim Starten der Batch-Datei: " & ex.Message) + End Try + End Function + Public Shared Function StartTeamviewer(ID As String, Optional Passwort As String = "BmWr501956") Dim p As String = "" If Passwort.Length < 1 Then diff --git a/Dokumentation/Dokumentation.vbproj b/Dokumentation/Dokumentation.vbproj index 86a29a2..bd5f88c 100644 --- a/Dokumentation/Dokumentation.vbproj +++ b/Dokumentation/Dokumentation.vbproj @@ -683,6 +683,9 @@ DokuDataSet.xsd + + PreserveNewest + MyApplicationCodeGenerator diff --git a/Dokumentation/My Project/Resources.Designer.vb b/Dokumentation/My Project/Resources.Designer.vb index 21c7b38..79e80e9 100644 --- a/Dokumentation/My Project/Resources.Designer.vb +++ b/Dokumentation/My Project/Resources.Designer.vb @@ -319,7 +319,7 @@ Namespace My.Resources End Property ''' - ''' Sucht eine lokalisierte Zeichenfolge, die 0.0.2.02 ähnelt. + ''' Sucht eine lokalisierte Zeichenfolge, die 0.0.2.04 ähnelt. ''' Friend ReadOnly Property Version() As String Get diff --git a/Dokumentation/My Project/Resources.resx b/Dokumentation/My Project/Resources.resx index a5a8f5e..a262309 100644 --- a/Dokumentation/My Project/Resources.resx +++ b/Dokumentation/My Project/Resources.resx @@ -137,7 +137,7 @@ ..\Resources\mail20.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - 0.0.2.02 + 0.0.2.04 ..\Resources\Link.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/Dokumentation/msgsend.bat b/Dokumentation/msgsend.bat new file mode 100644 index 0000000..4fcd16b --- /dev/null +++ b/Dokumentation/msgsend.bat @@ -0,0 +1,18 @@ +@echo off +if "%~2"=="" ( + echo Nutzung: %~nx0 "Nachricht" Computer1 Computer2 Computer3 ... + exit /b 1 +) + +set "Nachricht=%~1" +shift + +:loop +if "%~1"=="" goto :end + echo Sende Nachricht an %~1... + msg * /server:%~1 %Nachricht% + shift + goto loop + +:end +echo Nachricht wurde gesendet. diff --git a/Dokumentation/uscntr_SendMSG.vb b/Dokumentation/uscntr_SendMSG.vb index 7759795..a97f953 100644 --- a/Dokumentation/uscntr_SendMSG.vb +++ b/Dokumentation/uscntr_SendMSG.vb @@ -144,10 +144,17 @@ Public Class uscntr_SendMSG If SingleUserRec = True Then cExtProgramme.msgsend(msgfin) Else + Dim serverlist As String = "" For Each srv As String In recserver - cExtProgramme.msgsend(String.Format(msg, "*", srv, TextBox1.Text)) - Threading.Thread.Sleep(3000) + serverlist &= srv & " " + ' cExtProgramme.msgsend(String.Format(msg, "*", srv, TextBox1.Text)) + 'Threading.Thread.Sleep(3000) Next + serverlist = serverlist.Substring(0, serverlist.Length - 1) + 'MsgBox(serverlist) + + cExtProgramme.msg2server(TextBox1.Text, serverlist) + End If End Function