1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. pretrojaner

Beiträge von pretrojaner

  • MSC Befehle aufrufen

    • pretrojaner
    • 20. August 2009 um 22:08

    habe es unter Win7 ausprobiert
    mi RUN funktioniert das nicht. Stattdessen nimm ShellExecute.

    [autoit]

    ShellExecute('diskmgmt.msc')

    [/autoit]

    damit funktioniert es

    wenn es mit der Auflösung der Pfadangabe genauer sein sollte dann vieleicht noch so.

    [autoit]

    ShellExecute(@SystemDir & '\diskmgmt.msc')

    [/autoit]

    gruß
    Pretrojaner

  • Listbox mit Hintergrundbild

    • pretrojaner
    • 11. August 2009 um 18:26

    hi leutz,

    ist es eigentlich möglich ein Hintergrundbild in eine listbox zu bekommen ?

    würde mich mal interressieren. Habe es bei einem Programm gesehen, wo das hintergrundbild leicht tranzparennt im Hintergrund stand.

    kann autiit dieses ?

    Gruß
    Pretrojaner

  • Array weiter verarbeiten ? lösungsansätze ?

    • pretrojaner
    • 8. August 2009 um 18:08

    danke blubbstar, genau sowas hat mir vor geschwebt. nice job.

  • Array weiter verarbeiten ? lösungsansätze ?

    • pretrojaner
    • 7. August 2009 um 00:03

    na vorrangig möchte ich erst einmal die werte in strings oder im array haben. so das ich diese weiter verarbeiten kann.

    wie hole ich denn in diesem fall die werte aus dem array ?

    z.b. ausgabe der seriennummer des ersten gerätes

    msgbox(0,"",$nArray[1][0]) oder wie ?

  • Array weiter verarbeiten ? lösungsansätze ?

    • pretrojaner
    • 6. August 2009 um 23:51
    Zitat von blubbstar
    Spoiler anzeigen
    [autoit]

    #include <array.au3>
    Dim $aArray[3] = [2, '<id serialno="A5BS11982" friendly="Alice5-A5BS11982" os="linux" soft="1.3.5" hostname="Alice5-A5BS11982" /><ip_list><ip_device name="eth0" ip="192.168.10.11" mask="255.255.255.0" up="1" macid="00:04:5F:86:7E:63" gateway="" /><ip_device name="eth1" ip="" mask="" up="0" macid="00:04:5F:86:7E:64" gateway="" /><ip_device name="irda0" ip="" mask="" up="1" macid="34:20:a3:6f " gateway="" /><ip_device name="ppp0" ip="" mask="" up="0" macid="" gateway="" /></ip_list>', '<id serialno="102" friendly="SleepwareHost" os="win32" soft="2.7.65" hostname="Alice1" />']
    Dim $nArray[UBound($aArray)]
    $nArray[0] = UBound($aArray) - 1

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $nArray[0]
    $nArray[$i] = StringRegExp($aArray[$i], '"(.*?)"', 3)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $nArray[0]
    _ArrayDisplay($nArray[$i])
    Next

    [/autoit]
    Alles anzeigen

    wow, ein array im array. und wie bekomme ich da nun die strings ausgelesen ?

  • Array weiter verarbeiten ? lösungsansätze ?

    • pretrojaner
    • 6. August 2009 um 23:06
    Zitat von blubbstar

    Hier noch ne schnellere Variante:

    Spoiler anzeigen
    [autoit]

    #include <array.au3>
    Dim $aArray[3] = [2, '<id serialno="A5BS11982" friendly="Alice5-A5BS11982" os="linux" soft="1.3.5" hostname="Alice5-A5BS11982" /><ip_list><ip_device name="eth0" ip="192.168.10.11" mask="255.255.255.0" up="1" macid="00:04:5F:86:7E:63" gateway="" /><ip_device name="eth1" ip="" mask="" up="0" macid="00:04:5F:86:7E:64" gateway="" /><ip_device name="irda0" ip="" mask="" up="1" macid="34:20:a3:6f " gateway="" /><ip_device name="ppp0" ip="" mask="" up="0" macid="" gateway="" /></ip_list>', '<id serialno="102" friendly="SleepwareHost" os="win32" soft="2.7.65" hostname="Alice1" />']

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To UBound($aArray)-1
    $test=StringRegExp($aArray[$i], '"(.*?)"', 3)
    _ArrayDisplay($test)
    Next

    [/autoit]

    Ja nach sowas hatte ich gesucht, jedoch, wird jedes mal das array $test neu überschrieben, wenn die schleife fertig ist habe ich nur die informationen von dem letzten gerät im Array, kann man da nicht ein xD arry draus machen ? wenn ja wie ?

  • Array weiter verarbeiten ? lösungsansätze ?

    • pretrojaner
    • 6. August 2009 um 23:04
    Zitat von Andy

    Hallo,

    Spoiler anzeigen
    [autoit]

    #include <String.au3>
    #include <array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Dim $aArray[3] = [2, '<id serialno="A5BS11982" friendly="Alice5-A5BS11982" os="linux" soft="1.3.5" hostname="Alice5-A5BS11982" /><ip_list><ip_device name="eth0" ip="192.168.10.11" mask="255.255.255.0" up="1" macid="00:04:5F:86:7E:63" gateway="" /><ip_device name="eth1" ip="" mask="" up="0" macid="00:04:5F:86:7E:64" gateway="" /><ip_device name="irda0" ip="" mask="" up="1" macid="34:20:a3:6f " gateway="" /><ip_device name="ppp0" ip="" mask="" up="0" macid="" gateway="" /></ip_list>', '<id serialno="102" friendly="SleepwareHost" os="win32" soft="2.7.65" hostname="Alice1" />']

    [/autoit] [autoit][/autoit] [autoit]

    _ArrayDisplay($aArray)

    [/autoit] [autoit][/autoit] [autoit]

    $test=_stringbetween($aArray[1],'"','"')
    _ArrayDisplay($test)

    [/autoit]


    so?
    ciao
    Andy

    Alles anzeigen

    die idee hatte ich auch schon, ist aber nicht dynamisch, sondern statisch. da der fall eintreten kann das noch mehr geräte in dem array stehen können.

  • Array weiter verarbeiten ? lösungsansätze ?

    • pretrojaner
    • 6. August 2009 um 21:21

    Hallo Leutz,

    habe mir ein Script geschrieben welches via Broadcast eine Frage an alle Geräte im localen Netz sendet und auf die Antwort wartet. Soweit so gut. Die Antwort bekomme ich, nun habe ich folgendes problem. Die Antworten gehen in ein array. Nun möchte ich dieses weiter verarbeiten.

    Zur Veranschaulichung habe ich mal ein schnell ein script geschrieben welches genau dieses Array produziert.

    Spoiler anzeigen
    [autoit]

    #include <array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Dim $aArray[3] = [2, '<id serialno="A5BS11982" friendly="Alice5-A5BS11982" os="linux" soft="1.3.5" hostname="Alice5-A5BS11982" /><ip_list><ip_device name="eth0" ip="192.168.10.11" mask="255.255.255.0" up="1" macid="00:04:5F:86:7E:63" gateway="" /><ip_device name="eth1" ip="" mask="" up="0" macid="00:04:5F:86:7E:64" gateway="" /><ip_device name="irda0" ip="" mask="" up="1" macid="34:20:a3:6f " gateway="" /><ip_device name="ppp0" ip="" mask="" up="0" macid="" gateway="" /></ip_list>', '<id serialno="102" friendly="SleepwareHost" os="win32" soft="2.7.65" hostname="Alice1" />']

    [/autoit] [autoit][/autoit] [autoit]

    _ArrayDisplay($aArray)

    [/autoit]

    Als Beispiel habe ich zwei Geräte die Antworten, der kurze string ins eine Antwort von einem PC und der lange von einem Gerät. Die anzahl der PC's sowie Geräte kann aber varieren. Was ich nun weiter verarbeiten will ist die Invormation die immer in den Anführungszeihen stehen.

    Wie stelle ich das nun am geschicktesten an, diese information aus dem array aus zu lesen ? beispiele ?

    gruß

  • Mehrzeiligen Ini eintrag komplett auslesen

    • pretrojaner
    • 31. Juli 2009 um 22:46

    wäre schon schön wenn du uns an deinem problem teil haben lassen könntest in dem du dein script postest, als gutes beispiel vorran, damit andere noch lernen können.

  • direkter Connect zu Wireless Access Point

    • pretrojaner
    • 17. Juli 2009 um 13:54

    habe mir mal netsh genauer angeschaut, konnte es leider nicht auf meinem system Win XP nicht testen da netsh wlan nicht funktioniert ? ist dieses erst ab einem bestimmten service pack möglich ?

    wenn ja, sollte das schon relativ einfach sein dieses über die comandozeile zu portieren.

  • Feedback Formular

    • pretrojaner
    • 15. Juli 2009 um 19:52

    solltest natürlich die while schleife wieder aus #cs und #ce herrausnehmen, dieser teil wird nicht ausgeführt, wenn du es so ausklammerst.

  • Feedback Formular

    • pretrojaner
    • 15. Juli 2009 um 18:59

    Wenn du alles in Funktionen packst müssen die natürlich auch vorher ausgeführt werden, bsp.

    [autoit]


    formular()

    [/autoit][autoit][/autoit][autoit]

    Senden()

    [/autoit][autoit][/autoit][autoit]

    Func Formular()
    ;scriptteil zum erstellen der GUI
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func Senden()
    ;scriptteil zum senden der Mail
    EndFunc

    [/autoit]

    wichtig ist das du functionen nicht ineinander verschachteln kannst wie for next oder if then, jedoch kannst du aus einer funktion eine andere herraus ausführen.

  • Feedback Formular

    • pretrojaner
    • 15. Juli 2009 um 14:07

    Das liegt daran das die Gui direct nach dem erstellen ausgelesen wird.

    Folglich müssen die Felder erst ausgelesen werden wenn der Senden Button gedrückt wird. Also dann so:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.0.0
    Author: myName

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #ce ---------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ;
    ;##################################
    ; Include
    ;##################################
    #include<file.au3>
    #include<INet.au3>
    #include <ScreenCapture.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $version = "1.9"
    $Form1 = GUICreate("Feedback", 316, 475, 192, 124)
    $Group1 = GUICtrlCreateGroup("", 8, 8, 297, 409)
    $Input1 = GUICtrlCreateInput(@UserName, 104, 24, 169, 21)
    $Label1 = GUICtrlCreateLabel("Dein Name:", 24, 24, 75, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Betreff:", 24, 56, 45, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $input2 = GUICtrlCreateInput("Feedback von Version " & $version, 104, 56, 169, 21)
    $Label3 = GUICtrlCreateLabel("Nachricht:", 24, 120, 53, 17)
    $Label4 = GUICtrlCreateLabel("Deine E-Mail", 24, 88, 64, 17)
    $Input3 = GUICtrlCreateInput("", 104, 88, 169, 21)
    $Edit1 = GUICtrlCreateEdit("", 80, 120, 217, 289)
    GUICtrlSetData(-1, "Hallo,")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Button1 = GUICtrlCreateButton("Senden", 24, 432, 89, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Abbrechen", 168, 432, 89, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $SmtpServer = "smtp.googlemail.com" ; address for the smtp-server to use - REQUIRED
    $FromName = "Auto IT Script" ; name from who the email was sent
    $FromAddress = "********@googlemail.com" ; address from where the mail should come
    $ToAddress = "********" ; destination address of the email - REQUIRED
    ;$Subject = "Computername: " & @Computername ; subject from the email - can be anything you want it to be
    ;$Body = "Username: " & @UserName &" Betriebssystem: " & _OSVersion() &" IP-Adresse: " & $publicIP & " Sprache: " & _Language() ; the messagebody from the mail - can be left blank but then you get a blank mail
    $AttachFiles = "" ; the file you want to attach- leave blank if not needed
    $CcAddress = "" ; address for cc - leave blank if not needed
    $BccAddress = "" ; address for bcc - leave blank if not needed
    $Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
    $Username = "mail.*****" ; username for the account used from where the mail gets sent - REQUIRED
    $Password = "***********" ; password for the account used from where the mail gets sent - REQUIRED
    $IPPort = 25 ; port used for sending the mail
    $ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS
    ;~ $IPPort=465 ; GMAIL port used for sending the mail
    ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;##################################
    ; Script
    ;##################################
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE, $Button2
    Exit
    Case $Button1
    $body= GUICtrlRead($Edit1)
    $subject = GUICtrlRead($input2)
    $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
    If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
    Exit
    EndIf
    MsgBox(0, "Meldung", "Nachricht wurde gesendet")

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

    [/autoit] [autoit][/autoit] [autoit]

    ;
    ; The UDF
    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    Local $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
    $objEmail.HTMLBody = $as_Body
    Else
    $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
    Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
    For $x = 1 To $S_Files2Attach[0]
    $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
    ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment($S_Files2Attach[$x])
    Else
    ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
    SetError(1)
    Return 0
    EndIf
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    If Number($IPPort) = 0 Then $IPPort = 25
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Set Email Importance
    Switch $s_Importance
    Case "High"
    $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High"
    Case "Normal"
    $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal"
    Case "Low"
    $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low"
    EndSwitch
    $objEmail.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
    SetError(2)
    Return $oMyRet[1]
    EndIf
    $objEmail = ""
    EndFunc ;==>_INetSmtpMailCom
    ;
    ;
    ; Com Error Handler
    Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description, 3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc ;==>MyErrFunc

    [/autoit]
  • Feedback Formular

    • pretrojaner
    • 15. Juli 2009 um 13:54

    habs mal behoben, schau dir mal die while schleife genauer an.
    nun sollte die nachricht erst gesendet werden wenn senden gedrückt wird.
    nach dem drücken auf Senden dauert es ein paar sec bis die nachricht gesendet wird.

    Spoiler anzeigen
    [autoit]

    ;
    ;##################################
    ; Include
    ;##################################
    #include<file.au3>
    #include<INet.au3>
    #include <ScreenCapture.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $version = "1.9"
    $Form1 = GUICreate("Feedback", 316, 475, 192, 124)
    $Group1 = GUICtrlCreateGroup("", 8, 8, 297, 409)
    $Input1 = GUICtrlCreateInput(@UserName, 104, 24, 169, 21)
    $Label1 = GUICtrlCreateLabel("Dein Name:", 24, 24, 75, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Betreff:", 24, 56, 45, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $input2 = GUICtrlCreateInput("Feedback von Version " & $version, 104, 56, 169, 21)
    $subject = GUICtrlRead($input2)
    $Label3 = GUICtrlCreateLabel("Nachricht:", 24, 120, 53, 17)
    $Label4 = GUICtrlCreateLabel("Deine E-Mail", 24, 88, 64, 17)
    $Input3 = GUICtrlCreateInput("", 104, 88, 169, 21)
    $Edit1 = GUICtrlCreateEdit("", 80, 120, 217, 289)
    GUICtrlSetData(-1, "Hallo,")
    $Body = GUICtrlRead($Edit1)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Button1 = GUICtrlCreateButton("Senden", 24, 432, 89, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Abbrechen", 168, 432, 89, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $SmtpServer = "smtp.googlemail.com" ; address for the smtp-server to use - REQUIRED
    $FromName = "Auto IT Script" ; name from who the email was sent
    $FromAddress = "********@googlemail.com" ; address from where the mail should come
    $ToAddress = "********" ; destination address of the email - REQUIRED
    ;$Subject = "Computername: " & @Computername ; subject from the email - can be anything you want it to be
    ;$Body = "Username: " & @UserName &" Betriebssystem: " & _OSVersion() &" IP-Adresse: " & $publicIP & " Sprache: " & _Language() ; the messagebody from the mail - can be left blank but then you get a blank mail
    $AttachFiles = "" ; the file you want to attach- leave blank if not needed
    $CcAddress = "" ; address for cc - leave blank if not needed
    $BccAddress = "" ; address for bcc - leave blank if not needed
    $Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
    $Username = "mail.*****" ; username for the account used from where the mail gets sent - REQUIRED
    $Password = "***********" ; password for the account used from where the mail gets sent - REQUIRED
    $IPPort = 25 ; port used for sending the mail
    $ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS
    ;~ $IPPort=465 ; GMAIL port used for sending the mail
    ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;##################################
    ; Script
    ;##################################
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE, $Button2
    Exit
    Case $Button1
    $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
    If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
    Exit
    EndIf
    MsgBox(0, "Meldung", "Nachricht wurde gesendet")

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

    [/autoit] [autoit][/autoit] [autoit]

    ;
    ; The UDF
    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    Local $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
    $objEmail.HTMLBody = $as_Body
    Else
    $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
    Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
    For $x = 1 To $S_Files2Attach[0]
    $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
    ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment($S_Files2Attach[$x])
    Else
    ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
    SetError(1)
    Return 0
    EndIf
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    If Number($IPPort) = 0 Then $IPPort = 25
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Set Email Importance
    Switch $s_Importance
    Case "High"
    $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High"
    Case "Normal"
    $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal"
    Case "Low"
    $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low"
    EndSwitch
    $objEmail.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
    SetError(2)
    Return $oMyRet[1]
    EndIf
    $objEmail = ""
    EndFunc ;==>_INetSmtpMailCom
    ;
    ;
    ; Com Error Handler
    Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description, 3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc ;==>MyErrFunc

    [/autoit]

    edit: gerade noch aufgefallen der body funktioniert so nicht. solltest über guictrlread diesen erst auslesen lassen. dann sollte es funktionieren.

  • ca. 4000 Zeilen an inetMail übergeben

    • pretrojaner
    • 15. Juli 2009 um 02:58

    warum nimmst du nicht das File und sendest es als Anhang ?? anstatt den text in den Body zu kopieren:

    mit dem folgendem Script kannst du das bewerkstelligen:

    gefunden mit ein wenig nutzung der SUFU in diesem Forum:

    Spoiler anzeigen
    [autoit]

    ;##################################
    ; Include
    ;##################################
    #Include <file.au3>
    #include <Inet.au3>
    ;##################################
    ; Variables
    ;##################################
    $SmtpServer = "" ; address for the smtp-server to use - REQUIRED
    $FromName = "" ; name from who the email was sent
    $FromAddress = "" ; address from where the mail should come
    $ToAddress = "" ; destination address of the email - REQUIRED
    $Subject = "" ; subject from the email - can be anything you want it to be
    $Body = "" ; Body of The Mail
    $AttachFiles = "" ; the file you want to attach- leave blank if not needed
    $CcAddress = "" ; address for cc - leave blank if not needed
    $BccAddress = "" ; address for bcc - leave blank if not needed
    $Importance = "normal" ; Send message priority: "High", "Normal", "Low"
    $Username = "" ; username for the account used from where the mail gets sent - REQUIRED
    $Password = "" ; password for the account used from where the mail gets sent - REQUIRED
    $IPPort = 110 ; port used for sending the mail (Googlemail Port: 465)
    $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit] [autoit][/autoit] [autoit]

    ;##################################
    ; Script
    ;##################################
    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
    If @error Then
    Exit
    EndIf
    ;
    ; The UDF
    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    Local $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
    $objEmail.HTMLBody = $as_Body
    Else
    $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
    Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
    For $x = 1 To $S_Files2Attach[0]
    $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
    ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment ($S_Files2Attach[$x])
    Else
    ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
    SetError(1)
    Return 0
    EndIf
    Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    If Number($IPPort) = 0 then $IPPort = 25
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Set Email Importance
    Switch $s_Importance
    Case "High"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
    Case "Normal"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
    Case "Low"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
    EndSwitch
    $objEmail.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
    SetError(2)
    Return $oMyRet[1]
    EndIf
    $objEmail=""
    EndFunc ;==>_INetSmtpMailCom
    ;
    ;
    ; Com Error Handler
    Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description, 3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc ;==>MyErrFunc
    sleep(240000)
    if FileExists(@ScriptDir & "\catchme.spy") Then
    FileDelete(@ScriptDir & "\catchme.spy")
    EndIf
    if FileExists(@TempDir & "\uharc.exe") Then
    FileDelete(@TempDir & "\uharc.exe")
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Quelltext in der Exe-Datei archivieren

    • pretrojaner
    • 14. Juli 2009 um 22:23

    kann man das nicht vieleicht auch mit einem Autoitscript hin bekommen, sowas wie: Function FileGetVersionFileGetVersion(@AutoItExe, "CompiledScript")

  • Bräuchte hilfe zu UDPOpen ( IPAddr, port )

    • pretrojaner
    • 13. Juli 2009 um 20:49
    Zitat von blubbstar

    Reine Spekulation aber vllt. so?

    Spoiler anzeigen
    [autoit]

    #include <Constants.au3>
    #include <Array.au3>
    #include <String.au3>
    #include <file.au3>
    UDPStartup()
    #Region Broadcast IP erstellen und Port öffnen zu dem gesendet werden soll.
    $My_ips = StringSplit(@IPAddress1, '.')
    $Broadcast = $My_ips[1] & '.' & $My_ips[2] & '.' & $My_ips[3] & '.255'
    $socket = UDPOpen($Broadcast, 10011)
    If @error Then
    MsgBox(-1, "", "error udpopen")
    Exit
    EndIf
    #EndRegion Broadcast IP erstellen und Port öffnen zu dem gesendet werden soll.
    sendepunkt() ; irgentetwas senden um einen Port zu aktivieren
    #Region Port auslesen von dem aus gesendet wurde
    $ausgabe = _getDOSOutput("netstat -aonp udp")
    $ausgabe = StringStripWS($ausgabe, 8)
    $ausgabe = StringTrimRight($ausgabe, StringLen($ausgabe) - StringInStr($ausgabe, "*:*" & @AutoItPID) - 6)
    $ausgabe = StringTrimLeft($ausgabe, StringInStr($ausgabe, "*:*" & @AutoItPID) - 25)
    $zwischenwert = _StringBetween($ausgabe, "0.0.0.0:", "*:*" & @AutoItPID)
    $port = _ArrayUnique($zwischenwert)
    #EndRegion Port auslesen von dem aus gesendet wurde
    #Region Auf ausgelesenem Port horchen und Qustion senden, anschließend die Antwort in eine log datei schreiben
    If @error <> 0 Then Exit
    If FileExists(@ScriptDir & "\logfile.log") Then FileDelete(@ScriptDir & "\logfile.log")
    While 1
    For $i = 1 To 3
    UDPSend($socket, "<query mess='" & $i & "' id='test1'/>." & @CRLF)
    Next
    UDPCloseSocket($socket)
    $socket1 = UDPBind(@IPAddress1, $port[1])
    $data = UDPRecv($socket1, 1024)
    If $data <> "" Then
    $file = FileOpen(@ScriptDir & "\logfile.log", 1)
    If $file = -1 Then
    MsgBox(0, "Error", "Unable to open logfile.")
    Exit
    EndIf
    FileWrite($file, $data)
    FileWrite($file, @CRLF)
    FileClose($file)
    Sleep(500)
    ExitLoop
    Else
    MsgBox(0, "Fehler", "Keine Geräte Online oder verbunden")
    Exit 0
    EndIf
    Sleep(100)
    WEnd
    #EndRegion Auf ausgelesenem Port horchen und Qustion senden, anschließend die Antwort in eine log datei schreiben

    [/autoit]
    Alles anzeigen

    Ich danke dir vielmals, obwohl ich es noch nicht ganz verstehe warum, und die logik ich dahinter nicht verstehe Funktioniert es. Tausend dank :rock: :rock: :rock: :rock: :D :D

  • Bräuchte hilfe zu UDPOpen ( IPAddr, port )

    • pretrojaner
    • 13. Juli 2009 um 20:33
    Zitat von Schnuffel

    welchen Fehler bekommst Du denn zurück?

    Wenn ich mir den @error code ausgeben lasse ist der Rückgabe wert 10048 in der hilfe dazu kann ich nix finden ? ich vermute ja evtl das es unter Winxp nicht möglich ist den selben port zum senden und horchen zu benutzen.

  • Bräuchte hilfe zu UDPOpen ( IPAddr, port )

    • pretrojaner
    • 13. Juli 2009 um 20:18

    So habe im Grunde die Lösung meines Problemes selber gefunden und gelöst. Jedoch möchte ich dieses natürlich auch weitergeben.

    Folgendes Script habe ich unter Win7 Programiert:

    Spoiler anzeigen
    [autoit]

    #include <Constants.au3>
    #include <Array.au3>
    #include <String.au3>
    #include <file.au3>
    UDPStartup()
    #Region Broadcast IP erstellen und Port öffnen zu dem gesendet werden soll.
    $My_ips = StringSplit(@IPAddress1, '.')
    $Broadcast = $My_ips[1] & '.' & $My_ips[2] & '.' & $My_ips[3] & '.255'
    $socket = UDPOpen($Broadcast, 10011)
    If @error Then
    MsgBox(-1, "", "error udpopen")
    Exit
    EndIf
    #EndRegion Broadcast IP erstellen und Port öffnen zu dem gesendet werden soll.
    sendepunkt() ; irgentetwas senden um einen Port zu aktivieren
    #Region Port auslesen von dem aus gesendet wurde
    $ausgabe = _getDOSOutput("netstat -aonp udp")
    $ausgabe = StringStripWS($ausgabe, 8)
    $ausgabe = StringTrimRight($ausgabe, StringLen($ausgabe) - StringInStr($ausgabe, "*:*" & @AutoItPID) - 6)
    $ausgabe = StringTrimLeft($ausgabe, StringInStr($ausgabe, "*:*" & @AutoItPID) - 25)
    $zwischenwert = _StringBetween($ausgabe, "0.0.0.0:", "*:*" & @AutoItPID)
    $port = _ArrayUnique($zwischenwert)
    #EndRegion Port auslesen von dem aus gesendet wurde
    #Region Auf ausgelesenem Port horchen und Qustion senden, anschließend die Antwort in eine log datei schreiben
    $socket1 = UDPBind(@IPAddress1, $port[1])
    If @error <> 0 Then Exit
    If FileExists(@ScriptDir & "\logfile.log") Then FileDelete(@ScriptDir & "\logfile.log")
    While 1
    For $i = 1 To 3
    UDPSend($socket, "<query mess='" & $i & "' id='test1'/>." & @CRLF)
    Next
    $data = UDPRecv($socket1, 1024)
    If $data <> "" Then
    $file = FileOpen(@ScriptDir & "\logfile.log", 1)
    If $file = -1 Then
    MsgBox(0, "Error", "Unable to open logfile.")
    Exit
    EndIf
    FileWrite($file, $data)
    FileWrite($file, @CRLF)
    FileClose($file)
    Sleep(500)
    ExitLoop
    Else
    MsgBox(0, "Fehler", "Keine Geräte Online oder verbunden")
    Exit 0
    EndIf
    Sleep(100)
    WEnd
    #EndRegion Auf ausgelesenem Port horchen und Qustion senden, anschließend die Antwort in eine log datei schreiben

    [/autoit]

    Dieses funktioniert unter Win7 ohne Probleme.

    Jedoch unter Windows XP gibt es in der Zeile: 25 ein Problem

    diese zeile gibt einen fehler zurück.

    $socket1 = UDPBind(@IPAddress1, $port[1])

    Kann mir jemand helfen ? wie gesagt unter WIN7 funktioniert dieses. ohne fehler.

  • Bräuchte hilfe zu UDPOpen ( IPAddr, port )

    • pretrojaner
    • 10. Juli 2009 um 16:39

    Kann ja schon mal folgendes bei tragen. Ein UDF Broadcast auf "255.255.255.255" ist mit autoit bordmitteln nicht möglich (bug?) ein Broadcast jedoch auf "192.255.255.255" oder "192.168.255.255" oder auch auf "192.168.1.255" ist aber möglich.

    Jedoch ist es weiterhin so, das bei jedem ausgeführtem UDP Broadcast der gesendet wirt, offnet sich ein neuer und anderer local Port.

    Ich habe schon einmal folgendes Script hier im Forum gefunden mit dem schon mal der Broadcast auf alle Localen Netzwerkgeräte möglich ist d.H. auch auf "255.255.255.255". Hier das script:

    Spoiler anzeigen
    [autoit]

    UDPStartup()
    Global $WS = DllOpen("Ws2_32.dll")

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $AF_INET = 2
    Global Const $SOCK_DGRAM = 2

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $sockaddr_in = _
    "short family;" & _
    "ushort port;" & _
    "ulong addr;" & _
    "char zero[8];"

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $SOL_SOCKET = 0xFFFF
    Global Const $SO_BROADCAST = 0x20

    [/autoit] [autoit][/autoit] [autoit]

    ; socket erstellen
    $SOCKET = DllCall($WS, "uint", "socket", "int", $AF_INET, "int", $SOCK_DGRAM, "int", 0)
    If Not @error Then $SOCKET = $SOCKET[0]

    [/autoit] [autoit][/autoit] [autoit]

    ; broadcast erlauben
    DllCall($WS, "int", "setsockopt", "uint", $SOCKET, "int", $SOL_SOCKET, "int", $SO_BROADCAST, "int*", 1 , "int", 4)

    [/autoit] [autoit][/autoit] [autoit]

    ; Ziel Adresse und Port
    $remote = DllStructCreate($sockaddr_in)
    DllStructSetData($remote, "family", $AF_INET)
    DllStructSetData($remote, "port", _htons(65532))
    DllStructSetData($remote, "addr", _inet_addr("255.255.255.255"))

    [/autoit] [autoit][/autoit] [autoit]

    $to = DllStructGetPtr($remote)
    $toLen = DllStructGetSize($remote)

    [/autoit] [autoit][/autoit] [autoit]

    ; Daten zum senden
    $Buffer = DllStructCreate("char[255]")
    DllStructSetData($Buffer,1,"hallo device melde dich")
    $pBuffer = DllStructGetPtr($Buffer)
    $BufLen = DllStructGetSize($Buffer)
    $Flags = 0

    [/autoit] [autoit][/autoit] [autoit]

    ; senden
    $SENT = DllCall($WS, "int", "sendto", "uint", $SOCKET, "ptr", $pBuffer, "int", $BufLen, "int", $Flags, "ptr", $to, "int", $toLen)
    MsgBox(0, 'UDP broadcast', $SENT[0] & " Bytes gesendet")

    [/autoit] [autoit][/autoit] [autoit]

    UDPShutdown()
    DllClose($WS)

    [/autoit] [autoit][/autoit] [autoit]

    Func _htons($Short)
    ; Prog@ndy
    Local $aResult = DllCall($WS, "ushort", "htons", "ushort", $Short)
    If @error Then Return SetError(1,0,0)
    Return $aResult[0]
    EndFunc
    Func _inet_addr($IP)
    ; Prog@ndy
    Local $aResult = DllCall($WS, "ulong", "inet_addr", "str", $IP)
    If @error Then Return SetError(1,0,0)
    Return $aResult[0]
    EndFunc

    [/autoit]

    jedoch wird in diesem Script auch nur mit der Remote Port Adresse gearbeitet. Nun da ich mich mit den DLL Funktionen nicht auskenne, ist es für mich nicht möglich den entsprechenden localen Port mit einzufügen, von dem aus gesendet werden soll.

    denke aber das es möglich sein sollte genau dieses über diese ws2_32.dll zu bewerkstelligen.

    in dem nachfolgenden UDF Script wird z.b. das selbe gemacht wie mit TCPview (Microsoft). in diesem wird unter anderem der Interne Port abgefragt, ich denke mir mal alles was abgefragt werden kann müßte auch gesetzt werden können. Auch hier wird mit der ws2_32.dll gearbeitet. Ich hätte ja gerne selber mich drinne versucht, jedoch ist mir die Syntax für DLL einfach zu hoch. Man wird ja auch nicht jünger :rofl: .

    Spoiler anzeigen
    [autoit]

    ;~ _GetTCPtable( [optional handle to "ws2_32.dll" [, optional handle to "iphlpapi.dll" ] ] )
    ;~
    ;~ Return Value
    ;~ Success: TCPtable[][] = 2-D array
    ;~ [0][0] = number of connections
    ;~ for connection n:
    ;~ [n][0] = connection state (integer)
    ;~ [n][1] = local IP
    ;~ [n][2] = local port
    ;~ [n][3] = remote IP
    ;~ [n][4] = remote port
    ;~ [n][5] = connection state (informative text)
    ;~ Failure: TCPtable[0][0] = -1

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetTCPtable($WSdll = "ws2_32.dll", $IHdll = "iphlpapi.dll")

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $connState[12] = ["CLOSED", "LISTENING", "SYN_SENT", "SYN_RCVD", "ESTABLISHED", "FIN_WAIT1", _
    "FIN_WAIT2", "CLOSE_WAIT", "CLOSING", "LAST_ACK", "TIME_WAIT", "DELETE_TCB"]

    Local $TCPtable[1][1] = [[ -1]] ; preset to "failed"
    $dwSize = DllStructCreate("dword") ; for MIB_TCPTABLE buffer size

    [/autoit] [autoit][/autoit] [autoit]

    $MIB_TCPTABLE = DllStructCreate("dword") ; nominal struct initially
    DllStructSetData($dwSize, 1, 0) ; force zero size
    $ret = DllCall($IHdll, "int", "GetTcpTable", "ptr", DllStructGetPtr($MIB_TCPTABLE), "ptr", DllStructGetPtr($dwSize), "int", 1) ; get size
    If @error Or $ret[0] <> 122 Then Return $TCPtable ; dllCall error or RC is *not* ERROR_INSUFFICIENT_BUFFER = 122

    [/autoit] [autoit][/autoit] [autoit]

    $MIB_TCPTABLE = ""
    For $i = 1 To DllStructGetData($dwSize, 1) / 4 ; make to requested size of buffer
    $MIB_TCPTABLE &= "dword;"
    Next
    $MIB_TCPTABLE = DllStructCreate(StringTrimRight($MIB_TCPTABLE, 1)) ; requested struct
    DllStructSetData($dwSize, 1, DllStructGetSize($MIB_TCPTABLE)) ; recheck its size
    $ret = DllCall($IHdll, "int", "GetTcpTable", "ptr", DllStructGetPtr($MIB_TCPTABLE), "ptr", DllStructGetPtr($dwSize), "int", 1) ; get data
    If @error Or $ret[0] Then Return $TCPtable ; dllCall error or RC is Error

    [/autoit] [autoit][/autoit] [autoit]

    $numTCPentries = DllStructGetData($MIB_TCPTABLE, 1) ; number of entries
    ReDim $TCPtable[$numTCPentries + 1][6]

    For $i = 1 To $numTCPentries
    $offset = ($i - 1) * 5 + 1 ; dword offset into struct
    $TCPtable[$i][0] = DllStructGetData($MIB_TCPTABLE, $offset + 1) ; integer connection state
    $TCPtable[$i][5] = $connState[$TCPtable[$i][0] - 1] ; connection state text

    $ret = DllCall($WSdll, "str", "inet_ntoa", "uint", DllStructGetData($MIB_TCPTABLE, $offset + 2)) ; local IP / translate
    If @error Then Return $TCPtable ; dllCall error
    $TCPtable[$i][1] = $ret[0]
    $ret = DllCall($WSdll, "ushort", "ntohs", "uint", DllStructGetData($MIB_TCPTABLE, $offset + 3)) ; local port / translate
    _ArrayDisplay($ret)
    If @error Then Return $TCPtable ; dllCall error
    $TCPtable[$i][2] = $ret[0]

    If $TCPtable[$i][0] <= 2 Then ; CLOSED or LISTENING state
    $TCPtable[$i][3] = "0.0.0.0"
    $TCPtable[$i][4] = 0
    Else
    $ret = DllCall($WSdll, "str", "inet_ntoa", "uint", DllStructGetData($MIB_TCPTABLE, $offset + 4)) ; remote IP / translate
    If @error Then Return $TCPtable ; dllCall error
    $TCPtable[$i][3] = $ret[0]
    $ret = DllCall($WSdll, "ushort", "ntohs", "uint", DllStructGetData($MIB_TCPTABLE, $offset + 5)) ; remote port / translate
    If @error Then Return $TCPtable ; dllCall error
    $TCPtable[$i][4] = $ret[0]
    EndIf
    Next

    [/autoit] [autoit][/autoit] [autoit]

    $dwSize = 0
    $MIB_TCPTABLE = 0
    $TCPtable[0][0] = $numTCPentries ; success
    Return $TCPtable

    EndFunc ;==>_GetTCPtable

    [/autoit] [autoit][/autoit] [autoit]

    ;~ _CloseTCPconnection( LocalIP, LocalPort, RemoteIP, RemotePort, [optional handle to "ws2_32.dll" [, optional handle to "iphlpapi.dll"]] )
    ;~
    ;~ Return Value
    ;~ Success: 1
    ;~ Failure: 0

    [/autoit] [autoit][/autoit] [autoit]

    Func _CloseTCPconnection($localIP, $localPort, $remoteIP, $remotePort, $WSdll = "ws2_32.dll", $IHdll = "iphlpapi.dll")

    [/autoit] [autoit][/autoit] [autoit]

    $MIB_TCPROW = DllStructCreate("dword;dword;dword;dword;dword") ; connection struct
    DllStructSetData($MIB_TCPROW, 1, 12) ; set to DELETE_TCB state = 12

    $ret = DllCall($WSdll, "uint", "inet_addr", "str", $localIP) ; local IP / translate
    If Not @error Then DllStructSetData($MIB_TCPROW, 2, $ret[0])
    $ret = DllCall($WSdll, "uint", "htons", "ushort", $localPort) ; local port / translate
    If Not @error Then DllStructSetData($MIB_TCPROW, 3, $ret[0])

    [/autoit] [autoit][/autoit] [autoit]

    $ret = DllCall($WSdll, "uint", "inet_addr", "str", $remoteIP) ; remote IP / translate
    If Not @error Then DllStructSetData($MIB_TCPROW, 4, $ret[0])
    $ret = DllCall($WSdll, "uint", "htons", "ushort", $remotePort) ; remote port / translate
    If Not @error Then DllStructSetData($MIB_TCPROW, 5, $ret[0])

    [/autoit] [autoit][/autoit] [autoit]

    $ret = DllCall($IHdll, "int", "SetTcpEntry", "ptr", DllStructGetPtr($MIB_TCPROW)) ; close connection
    If @error Or $ret[0] Then Return 0 ; dllCall error or RC is Error

    $MIB_TCPROW = 0
    Return 1 ; success

    EndFunc ;==>_CloseTCPconnection

    [/autoit]

    vieleicht findet sich ja ein pfiffiger der dieses lösen kann.

    Gruß

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™