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. Concara

Beiträge von Concara

  • _EventLog__Open und Kerberos als Authentifizierung

    • Concara
    • 19. Dezember 2024 um 13:53

    Hallo!

    Hat jemand eventuell Erfahrung mit dem Include #include <EventLog.au3>
    _EventLog__Open ( $sServerName, $sSourceName )

    Wenn ich mich auf ein Remotesystem damit verbinden will, funktioniert das Einwandfrei wenn die NTLM Authentifizierung aktiv ist.
    Sobald man NTLM deaktiviert, funktioniert es nicht mehr.
    Da NTLM schon lange als unsicher bzw. von Microsoft als veraltet gilt, wollte ich jetzt mal meine Programme testen ob sie eben ohne NTLM funktionieren.

    Die Verwendete DLL in der Eventlog.au3 sollte zumindest nach meiner Meinung nach Kerberos verwenden können. (https://learn.microsoft.com/de-de/windows/…base-logonusera)

    Func _EventLog__Open($sServerName, $sSourceName)
        $__g_sSourceName_Event = $sSourceName
        Local $aCall = DllCall("advapi32.dll", "handle", "OpenEventLogW", "wstr", $sServerName, "wstr", $sSourceName)
        If @error Then Return SetError(@error, @extended, 0)
        Return $aCall[0]
    EndFunc   ;==>_EventLog__Open 


    Im code verwende ich folgenden Aufruf:
    _EventLog__Open("\\Computername.domäne.at", "System")

    _EventLog__Open

    Opens a handle to the event log

    #include <EventLog.au3>
    _EventLog__Open ( $sServerName, $sSourceName )

    Parameters

    $sServerNameThe UNC name of the server on where the event log will be opened. If blank, the operation is performed on the local computer.
    $sSourceNameThe name of the log


    Also weiß eventuell jemand wie ich die DLL zum Verwenden von Kerberos zwingen kann?

  • _SQLite_Exec - Limit für Befehlslänge?

    • Concara
    • 21. November 2023 um 10:40

    Hallo Bugfix!

    Ich kann dir nur empfehlen, dass du nach Hausnummer 200000 einen Insert machst.

    Ich importiere DNS Logfiles in eine SQLite Datenbank und dort bekomme ich einen Speicherfehler da der Insertstring zu groß wird.

    Um diesen zu umgehen habe ich dann eben nach 200K einen insert gemacht und die Insertstring Variable "gelöscht".

    Auf dein Beispiel angewendet. (Ist jetzt nicht wirklich getestet aber du verstehst sicher was ich damit meine)

    Begin Transaction;

    Insertstring

    Commit Transaction;

    Ist meiner Erfahrung nach die schnellste Methode eines Datenimports.

    AutoIt
    #include <SQLite.au3>
    #include <SQLite.dll.au3>
    #include <File.au3>
    
    Func _Insert($_kind, $_sCSV)
        Local $aLines = FileReadToArray($_sCSV)
        Local $aSplit
        Local $sQuery
        Local $iCount200K = 0 
        Local $sDatabaseFileName = "C:\Sqlite.db3"; Ich deklariere die meistens Global und dann natürlich nicht in der Funktion
        For $i = 1 To UBound($aLines) -1
            If $iCount200K = 200000 Then ;Nach 200000 inserts werden sie in die Datenbank geschrieben
                _sql_write($sDatabaseFileName, $sQuery)
                $sQuery = ""
                $iCount200K = 0
            EndIf
            If $_kind = 'Tab1' Then
                $aSplit = StringSplit($aLines[$i], ',', 2)
                $sQuery &= _
                StringFormat("INSERT INTO tab1 VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s');", $i, _
                             $aSplit[0], $aSplit[1], $aSplit[2], $aSplit[3], $aSplit[4], $aSplit[5])
                             $iCount200K += 1
            Else
                $aSplit = _SplitStreetLine($aLines[$i])
                $sQuery &= _
                StringFormat("INSERT INTO tab2 VALUES (%d, '%s', '%s', '%s', '%s');", $i, _
                             $aSplit[0], $aSplit[1], $aSplit[2], $aSplit[3])
                             $iCount200K += 1
            EndIf
        Next
        _sql_write($sDatabaseFileName, $sQuery)
    EndFunc
    
    
    Func _sql_write($sDatabaseFileName, $sInsert)
        _SQLite_Startup()
        Do
            Sleep(Random(20, 250, 1))
            _SQLite_Open($sDatabaseFileName)
        Until Not @error
        _SQLite_Exec(-1, "Begin Transaction;")
        If Not _SQLite_Exec(-1, $sInsert) = $SQLITE_OK Then
            ConsoleWrite("SQLite Error " & _SQLite_ErrMsg() & @CRLF)
            _FileWriteLog("Fehler.log", "SQLite Error " & _SQLite_ErrMsg())
            _SQLite_Close()
            _SQLite_Shutdown()
            Return 0
        EndIf
        _SQLite_Exec(-1, "Commit Transaction;")
        _SQLite_Close()
        _SQLite_Shutdown()
        Return 1
    EndFunc   ;==>_sql_write
    Alles anzeigen
  • AutoIt-SQLite to HTML

    • Concara
    • 16. November 2023 um 14:50

    Hallo!


    So zu was konstruktiven.

    Da du allen helfenden nicht gerade mit Informationen, bzw. mit Beispielen überhäufst, habe ich mal aus deinem Bild von deiner Homepage, die Datenbank nachgestellt (eine zum Testen erstellt).

    Damit das Beispiel funktioniert braucht man die sqlite3.exe im Scriptordner und ein paar MP3 files in einem Ordner. Als Alternative man kann auch den Filter anpassen von _FileListToArray.

    Den Ordner in Zeile 12 muss man ohnehin anpassen, damit es funktioniert.
    Wenn das Array leer ist wirds einen Fehler geben.

    In der _Create_Databasefile Funktion verwende ich oft den unique index um doppelte Einträge in die Datenbank zu verhindern.

    In diesem Beispiel habe ich ihn auf "MEDIENART" und "TITEL" gelegt. Das muss man sich halt überlegen.

    Wenn es vorkommt, dass man ein Video (MEDIENART) hat mit dem gleichen Namen (TITEL), dann könnte man diesen nicht mehr in der Datenbank speichern.

    Ist dies der Fall, dann würde ich den unique index um den Speicherort erweitern (auf dieses Beispiel bezogen).

    Code
    _Create_Databasefile($sDatabaseFileName, '"LFDNR" INT, "MEDIENART" TEXT, "TITEL" TEXT, "INHALT" TEXT, "LAUFZEIT_UMFANG" TEXT, "SPEICHERORDNER" TEXT', "", '"MEDIENART", "TITEL", "SPEICHERORDNER"')


    AutoIt
    #include <Debug.au3>
    #include <File.au3>
    #include <SQLite.au3>
    #include <SQLite.dll.au3>
    Global $sDatabaseFileName = StringTrimRight(@ScriptName, StringLen(@ScriptName) - StringInStr(@ScriptName, ".", 0, -1) + 1)
    
    ;Inhalt deiner Tabelle aus dem Foto entnommen + Speicherordner des jeweiligen Mediums (macht aus meiner Sicht Sinn diesen nicht anzuzeigen)
    If FileExists($sDatabaseFileName & ".db3") = 0 Then
        _Create_Databasefile($sDatabaseFileName, '"LFDNR" INT, "MEDIENART" TEXT, "TITEL" TEXT, "INHALT" TEXT, "LAUFZEIT_UMFANG" TEXT, "SPEICHERORDNER" TEXT', "", '"MEDIENART", "TITEL"')
    EndIf
    ; Zum Befüllen der Datenbank habe ich einen Ordner angegeben der MP3s enthält z.B: "C:\Users\Username\Music"
    Local $aMP3 = _FileListToArray("C:\Users\Username\Music", "*.mp3", 1, True)
    Local $aMP3_ex[UBound($aMP3)][6]
    Local $sSQLinsert
    Local $sString
    For $i = 1 To UBound($aMP3) - 1
        $aMP3_ex[$i][0] = $i
        $aMP3_ex[$i][1] = "Musik"
        $aMP3_ex[$i][2] = StringReplace(StringTrimLeft($aMP3[$i], StringInStr($aMP3[$i], "\", "", -1)), "'", "''")
        $aMP3_ex[$i][3] = StringReplace(FileGetShortName($aMP3[$i]), "'", "''")
        $aMP3_ex[$i][4] = FileGetSize($aMP3[$i])
        $aMP3_ex[$i][5] = StringReplace($aMP3[$i], "'", "''")
        $sString = $aMP3_ex[$i][0] & "','" & $aMP3_ex[$i][1] & "','" & $aMP3_ex[$i][2] & "','" & $aMP3_ex[$i][3] & "','" & $aMP3_ex[$i][4] & "','" & $aMP3_ex[$i][5]
        $sSQLinsert &= "INSERT OR IGNORE INTO " & $sDatabaseFileName & " VALUES (" & "'" & $sString & "'" & ');' & @CRLF
    Next
    _SQLite_Startup()
    Do
        Sleep(Random(20, 250, 1))
        _SQLite_Open(@ScriptDir & "\" & $sDatabaseFileName & ".db3")
    Until Not @error
    _SQLite_Exec(-1, "Begin Transaction;")
    _SQLite_Exec(-1, $sSQLinsert)         ; INSERT Data
    _SQLite_Exec(-1, "Commit Transaction;")
    _SQLite_Close()
    _SQLite_Shutdown()
    _DebugArrayDisplay($aMP3_ex)
    
    ; VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
    ; Hier der relevante Code um eine HTML Datei zu erstellen aus der vorhandenen Datenbank
    ; Das was dir Velted geschrieben hat in Autoit umgesetzt
    ;
    ;SQLite version 3.11.1 2016-03-03 16:17:53
    ;Enter ".help" for usage hints.
    ;Connected to a transient in-memory database.
    ;Use ".open FILENAME" to reopen on a persistent database.
    ;sqlite> .open NameDeinerDatenbankdatei
    ;sqlite> .headers on
    ;sqlite> .mode html
    ;sqlite> .output NameDeinerHTMLDatei
    ;sqlite> select * from NameDeinerDatenbanktabelle;
    ;sqlite> .exit
    
    Local $sIn, $sOut
    $sIn = ".headers on" & @CRLF
    $sIn &= ".mode html" & @CRLF
    $sIn &= ".output Mediathek.htm" & @CRLF
    $sIn &= "select MEDIENART, TITEL, INHALT, LAUFZEIT_UMFANG from Mediathek;" & @CRLF
    ;Hierfür wird die sqlite3.exe benötigt! Ich persönlich kopiere immer die sqlite.dll und wenn benötigt die sqlite3.exe in das Scriptverzeichnis
    _SQLite_SQLiteExe(@ScriptDir & "\" & $sDatabaseFileName & ".db3", $sIn, $sOut, @ScriptDir & "\sqlite3.exe", True)
    If @error = 2 Then
        ConsoleWrite("ERROR: Sqlite3.exe file not found" & @CRLF)
    Else
        ConsoleWrite("ERROR: @error=" & @error & " when calling _SQLite_SQLiteExe" & @CRLF)
    EndIf
    ConsoleWrite($sOut & @CRLF)
    
    ; Hier wird der Output von Sqlite erweitert, damit es eine "richtige" HTML Seite wird
    If FileExists(@ScriptDir & "\Mediathek.htm") Then
        $sHeader = '<!DOCTYPE html>' & @CRLF & _
                '<html lang="de">' & @CRLF & _
                '<head>' & @CRLF & _
                '<meta charset="utf-8">' & @CRLF & _
                '<meta name="viewport" content="width=device-width, initial-scale=1.0">' & @CRLF & _
                '<style>' & @CRLF & _
                'table, th, td { border: thin solid; }' & @CRLF & _
                '#coll { border-collapse: collapse; }' & @CRLF & _
                '#sepa { border-collapse: separate; margin-top: 2em; }' & @CRLF & _
                'caption { text-align: left; }' & @CRLF & _
                '</style>' & @CRLF & _
                '<title>Titel</title>' & @CRLF & _
                '</head>' & @CRLF & _
                '<body>' & @CRLF & _
                '' & @CRLF & _
                '<table>' & @CRLF
    
        $sFooter = @CRLF & '</table>' & @CRLF & _
                '</body>' & @CRLF & _
                '</html>' & @CRLF
    
        $sfile = FileRead(@ScriptDir & "\Mediathek.htm")
        FileWrite(@ScriptDir & "\Mediathek_formated.htm", $sHeader & $sfile & $sFooter)
    EndIf
    ;------------------------------------------------------------------------------------------------------------------
    
    
    Func _Create_Databasefile($sDatabaseFileName, $sCollums, $sTablename = $sDatabaseFileName, $sUniqueIndex = "")
        If $sTablename = "" Then $sTablename = $sDatabaseFileName
        _SQLite_Startup()
        _SQLite_Open(@ScriptDir & "\" & $sDatabaseFileName & ".db3")
        If Not _SQLite_Exec(-1, 'CREATE TABLE if not exists "' & $sTablename & '" (' & $sCollums & ');') = $SQLITE_OK Then _
                ConsoleWrite("SQLite Error " & _SQLite_ErrMsg() & @CRLF)
        If $sUniqueIndex <> "" Then
            If Not _SQLite_Exec(-1, 'create unique index if not exists "Unique' & $sTablename & '" on "' & $sTablename & '" (' & $sUniqueIndex & ');') = $SQLITE_OK Then _
                    ConsoleWrite("SQLite Error " & _SQLite_ErrMsg() & @CRLF)
        EndIf
        _SQLite_Close()
        _SQLite_Shutdown()
    EndFunc   ;==>_Create_Databasefile
    Alles anzeigen
  • Win XP - alle Netzwerkadapter und Adressen auslesen ohne WMI

    • Concara
    • 26. Mai 2023 um 11:16

    Hi

    Hier noch eine Variante per Registry.

    Werte sind hier allerdings nicht so leicht zu verändern, selbst als Administrator, geschweige denn diese dann auch im laufenden Betrieb zu übernehmen.

    Es ist für die Commandline.

    Wenn man es kompiliert hat ist der Aufruf:

    Network_Driver_Settings_read.exe PCNAME

    AutoIt
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Change2CUI=y
    #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
    #AutoIt3Wrapper_Res_Comment=Network_Driver_Settings_read
    #AutoIt3Wrapper_Res_Description=Network_Driver_Settings_read
    #AutoIt3Wrapper_Res_Fileversion=2023.5.26.10
    #AutoIt3Wrapper_Res_ProductVersion=2023.5.24.13
    #AutoIt3Wrapper_Res_CompanyName=Musterfirma
    #AutoIt3Wrapper_Res_LegalCopyright=© Musterfirma
    #AutoIt3Wrapper_Res_LegalTradeMarks=Musterfirma
    #AutoIt3Wrapper_Res_Language=3079
    #AutoIt3Wrapper_Res_Field=OriginalFilename|Network_Driver_Settings_read
    #AutoIt3Wrapper_Res_Field=ProductName|Network_Driver_Settings_read
    #AutoIt3Wrapper_Res_Field=MadeBy|Concara
    #AutoIt3Wrapper_Res_Field=HomePage|www.MaxMustermann.com
    #AutoIt3Wrapper_Run_After=C:\"Program Files"\"Microsoft SDKs"\Windows\v7.0\Bin\signtool.exe sign /sha1 abcdefghijklmnopqrstuvwabcdefghijklmnopq /t http://timestamp.sectigo.com "%scriptdir%\%scriptfile%.exe"
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    If $Cmdline[0] = 0 Then Exit
    Local $sSubKey = "", $sEnumKey = ""
    ; auskommentieren wenn man die Bezeichnungen nicht benötigt
    $sEnumKey = '"PCName";"DriverDate";"DriverDesc";"DriverVersion";"DefaultGateway";"IPAddress";"SubnetMask"' & @CRLF
    Local $i
    Local $PhysicalMediaType, $sDriverDesc, $sDriverVersion, $sDriverDate, $sComponentId, $sNetCfgInstanceId
    Local $sDefaultGateway, $sIPAddress, $sSubnetMask
    Local $sPCName = $Cmdline[1]
    If Not Ping($sPCName, 750) Then
        ConsoleWrite("PC: " & $sPCName & " konnte nicht erreicht werden." & @CRLF)
        Exit
    EndIf
    Do
        $i += 1
        $sSubKey = RegEnumKey("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}", $i)
        If @error Then ExitLoop
        $sComponentId = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & $sSubKey, "ComponentId")
        If StringLeft($sComponentId, 3) == "PCI" Then ;nur Hardware Netzerkkarten werden erfasst
            $PhysicalMediaType = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & $sSubKey, "*PhysicalMediaType")
            If $PhysicalMediaType = 14 Then ;Or $PhysicalMediaType = 9 Then ;auskommentieren damit auch WLAN Karten erfasst werden
                $sDriverDate = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & $sSubKey, "DriverDate")
                $sDriverDesc = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & $sSubKey, "DriverDesc")
                $sDriverVersion = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & $sSubKey, "DriverVersion")
                $sNetCfgInstanceId = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & $sSubKey, "NetCfgInstanceId")
                $sEnableDHCP = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $sNetCfgInstanceId, "EnableDHCP")
                If $sEnableDHCP == 1 Then
                    $sDefaultGateway = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $sNetCfgInstanceId, "DhcpDefaultGateway")
                    $sIPAddress = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $sNetCfgInstanceId, "DhcpIPAddress")
                    $sSubnetMask = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $sNetCfgInstanceId, "DhcpSubnetMask")
                Else
                    $sDefaultGateway = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $sNetCfgInstanceId, "DefaultGateway")
                    $sIPAddress = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $sNetCfgInstanceId, "IPAddress")
                    $sSubnetMask = RegRead("\\" & $sPCName & "\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $sNetCfgInstanceId, "SubnetMask")
                EndIf
                $sEnumKey &= '"' & $sPCName & '";"' & $sDriverDate & '";"' & $sDriverDesc & '";"' & $sDriverVersion & '";"' & $sDefaultGateway & '";"' & $sIPAddress & '";"' & $sSubnetMask & '"' & @CRLF
                $sDriverDate = ""
                $sDriverDesc = ""
                $sDriverVersion = ""
                $sNetCfgInstanceId = ""
                $sDefaultGateway = ""
                $sIPAddress = ""
                $sSubnetMask = ""
            EndIf
        EndIf
    Until $i > 100
    ConsoleWrite($sEnumKey)
    Alles anzeigen
  • Win XP - alle Netzwerkadapter und Adressen auslesen ohne WMI

    • Concara
    • 25. Mai 2023 um 09:17

    Bebbo
    Ich sehe auf den ersten Blick nicht was dein Code mit dem ursprünglichen Thema zu tun hat?

    Wenn wäre der Code interessanter den du dem AuStripper zur Verfügung stellst.

    Sprich den den du geschrieben hast.

    Echt WINDOWS XP ? Ich hoffe das ist kein öffentlich zugängliches Netzwerk!

    Moombas

    Zitat

    Ich hoffe die fehlende Formatierung /Einrückung ist beim copy/paste passiert? Der Code ist so nicht lesbar.

    Für diesen Fall eignet sich sehr gut "Tidy AutoIT Source" ;)

  • Eintragen von Radiobox Änderungen in INI Datei

    • Concara
    • 22. August 2022 um 11:12

    Hi!

    Ich habe dir das Beispielscript angepasst. Änderungen haben einen Kommentar ; <------------- NEU 20220822

    Ich hoffe das war das was du mit deiner Frage beantwortet haben wolltest!?

    AutoIt
    #include <Array.au3>
    #include <Constants.au3>
    #include <ScreenCapture.au3>
    #include <File.au3>
    #include <GuiButton.au3>
    #include <GUIConstantsEx.au3>
    #include <WinAPIError.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiEdit.au3>
    
    
    Opt("TrayMenuMode", 1) ; Hide default tray menu items
    Opt("TrayAutoPause", 0) ; This will allow you to click on the TrayIcon without pause the script
    TraySetIcon("Shell32.dll", -27)
    TraySetClick(8) ;only show the menu when right clicking
    #Tray Tip
    TraySetToolTip("TrayTool")
    
    Global $idButton_200, $Formatartset, $editradio
    Global $checkPathF = _PathFull("usf.ini", @ScriptDir)
    $autostartitem = TrayCreateItem("mit Windows starten")
    $Settings = TrayCreateItem("Einstellungen")
    $exititem = TrayCreateItem("Exit")
    
    
    Firststartcheck()
    startcheck()
    
    
    ;CHECKS------------------------------------------------------------------------------------------------------
    
    
    ;------------------------------------------------------------------------------------------------------------
    Func Firststartcheck()
        If FileExists($checkPathF) = 1 Then  ;Checkdatei auf Existenz prüfen
            ; Nichts tun
        Else
    
            _FileCreate($checkPathF) ;ini Datei erstellen
            ;Standard Settings setzen
            $Formatart = "1" ;1:Qickformat 0:Longformat
            $Formattyp = "FAT32"
            $ILWprev = "1"
    
            IniWrite("USF.ini", "settings", "Formatart", $Formatart) ; StandardSetting LangFormat
            IniWrite("USF.ini", "settings", "Formatyp", $Formattyp) ; StandardSetting LangFormat
            IniWrite("USF.ini", "settings", "Preview", $ILWprev) ; StandardSetting LangFormat
            ;IniWrite("USF.ini", "settings", "Name", "Ihr Name") ; Eventuell stellst du die Grundeinstellungen hier ein, derzeit werden die INI Werte erst geschrieben, wenn sie das erste Mal verändert werden NEU 20220822
            ;IniWrite("USF.ini", "settings", "Stickname", "StickName") ; <------------- NEU 20220822
            FileCreateShortcut(@ScriptFullPath, @StartupDir & "\USB-Formatter.lnk", @ScriptDir, "", "AutoIT Script Description")
    
            ;TrayItem Stati Grundeinstellung setzen
            TrayItemSetState($autostartitem, $TRAY_CHECKED)
            ; TrayItemSetState($ILWprevItem, $TRAY_CHECKED)
    
            SplashTextOn("Achtung", "Das Tool befindet sich im Traymenu ? ! ", 1000, 100, 900, 950, 1, "Verdana")
            Sleep(5000)
            SplashOff()
    
    
        EndIf
    EndFunc   ;==>Firststartcheck
    
    ;------------------------------------------------------------------------------------------------------------
    
    ;------------------------------------------------------------------------------------------------------------
    Func startcheck() ;Auslesen Ini Datei
        If FileExists(@StartupDir & "\USB-Formatter.lnk") Then
            TrayItemSetState($autostartitem, $TRAY_CHECKED)
        Else
            TrayItemSetState($autostartitem, $TRAY_UNCHECKED)
        EndIf
    
        ;Einlesen der Parameter aus IniDatei
        Global $Formatart = IniRead("USF.ini", "settings", "Formatart", "")
        Global $Formattyp = IniRead("USF.ini", "settings", "Formatyp", "")
        Global $ILWprev = IniRead("USF.ini", "settings", "Preview", "")
        Global $sInputName = IniRead("USF.ini", "settings", "Name", @UserName) ; <------------- NEU 20220822
        Global $sStickname = IniRead("USF.ini", "settings", "Stickname", "USB1") ; <------------- NEU 20220822
        ;TrayItemStati neu setzen
    
    EndFunc   ;==>startcheck
    ;------------------------------------------------------------------------------------------------------------
    
    
    ;MAIN LOOP---------------------------------------------------------------------------------------------------
    While 1
        Switch TrayGetMsg() ;switch seems nicer in this case
            Case 0
                ContinueLoop
            Case $TRAY_EVENT_PRIMARYDOWN ;reaction to left clicking
    
            Case $Settings
                TrayItemSetState($Settings, $TRAY_UNCHECKED) ;stop the automated (un)checking when clicked
                Settings()
    
            Case $autostartitem
                If BitAND(TrayItemGetState($autostartitem), $TRAY_CHECKED) Then
                    FileCreateShortcut(@ScriptFullPath, @StartupDir & "\USB-Formatter.lnk", @ScriptDir, "", "AutoIT Script Description")
                Else
                    FileDelete(@StartupDir & "\USB-Formatter.lnk")
                EndIf
    
            Case $exititem
    
                ExitLoop
        EndSwitch
    WEnd
    
    Exit
    ;------------------------------------------------------------------------------------------------------------
    
    
    
    Func Settings()
        ;Create a GUI with various controls.
        Local $hGUI = GUICreate("SETTINGS", 400, 200)
        Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25)
        Local $aWindow_Size = WinGetPos($hGUI)
        Local $aWindowClientArea_Size = WinGetClientSize($hGUI)
        ;AutoItSetOption("option")
    
        ; Display the GUI.
        GUISetState(@SW_SHOW, $hGUI)
    
        GUIStartGroup()
        $hRadio_1 = GUICtrlCreateRadio("FAT32", 20, 30, 60, 20)
        $hRadio_2 = GUICtrlCreateRadio("ExtFAT", 20, 50, 60, 20)
        $hRadio_3 = GUICtrlCreateRadio("NTFS", 20, 70, 60, 20)
    
        GUIStartGroup()
        $hRadio_4 = GUICtrlCreateRadio("Qick Format", 20, 130, 60, 20)
        $hRadio_5 = GUICtrlCreateRadio("Long Format", 20, 150, 60, 20)
    
        GUIStartGroup()
        $hGroup_1 = GUICtrlCreateGroup("Group 1", 10, 10, 120, 90)
        $hGroup_2 = GUICtrlCreateGroup("Group 2", 10, 110, 120, 70)
    
        Local $idInputName = GUICtrlCreateInput($sInputName, 170, 20, 150, 20) ; <------------- NEU 20220822
        Local $idInputStickName = GUICtrlCreateInput($sStickname, 170, 40, 150, 20) ; <------------- NEU 20220822
    
        ;Einlesen aus Ini
        If $Formattyp = "FAT32" Then
            GUICtrlSetState($hRadio_1, $GUI_CHECKED)
        EndIf
        If $Formattyp = "ExtFat" Then
            GUICtrlSetState($hRadio_2, $GUI_CHECKED)
        EndIf
        If $Formattyp = "NTFS" Then
            GUICtrlSetState($hRadio_3, $GUI_CHECKED)
        EndIf
        If $Formatart = "1" Then
            GUICtrlSetState($hRadio_4, $GUI_CHECKED)
        EndIf
        If $Formatart = "0" Then
            GUICtrlSetState($hRadio_5, $GUI_CHECKED)
        EndIf
    
        ; Loop until the user exits.
        While 1
            Switch GUIGetMsg($hGUI)
                Case $GUI_EVENT_CLOSE, $idOK
                    If $sInputName <> GUICtrlRead($idInputName) Then IniWrite("USF.ini", "settings", "Name", GUICtrlRead($idInputName)) ; <------------- NEU 20220822
                    If $sStickname <> GUICtrlRead($idInputStickName) Then IniWrite("USF.ini", "settings", "Stickname", GUICtrlRead($idInputStickName)) ; <------------- NEU 20220822
                    startcheck()
                    ExitLoop
    
                Case $hRadio_1
                    IniWrite("USF.ini", "settings", "Formatyp", GUICtrlRead($hRadio_1, 1))
                    MsgBox(4096, "$hRadio1", GUICtrlRead($hRadio_1, 1))
    
                Case $hRadio_2
                    IniWrite("USF.ini", "settings", "Formatyp", GUICtrlRead($hRadio_2, 1))
                    MsgBox(4096, "$hRadio2", GUICtrlRead($hRadio_2, 1))
    
                Case $hRadio_3
                    IniWrite("USF.ini", "settings", "Formatyp", GUICtrlRead($hRadio_3, 1))
                    MsgBox(4096, "$hRadio3", GUICtrlRead($hRadio_3, 1))
    
                Case $hRadio_4
                    IniWrite("USF.ini", "settings", "Formatart", 1)
                    MsgBox(4096, "$hRadio4", GUICtrlRead($hRadio_4, 1))
    
                Case $hRadio_5
                    IniWrite("USF.ini", "settings", "Formatart", 0)
                    MsgBox(4096, "$hRadio5", GUICtrlRead($hRadio_5, 1))
    
            EndSwitch
        WEnd
    
        GUIDelete($hGUI)
    EndFunc   ;==>Settings
    Alles anzeigen
  • Eintragen von Radiobox Änderungen in INI Datei

    • Concara
    • 18. August 2022 um 15:36

    Hi!

    Wenn es "nur" diese paar Einstellungen sind , dann würde ich es so machen:

    AutoIt
    #include <Array.au3>
    #include <Constants.au3>
    #include <ScreenCapture.au3>
    #include <File.au3>
    #include <GuiButton.au3>
    #include <GUIConstantsEx.au3>
    #include <WinAPIError.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiEdit.au3>
    
    
    Opt("TrayMenuMode", 1) ; Hide default tray menu items
    Opt("TrayAutoPause", 0) ; This will allow you to click on the TrayIcon without pause the script
    TraySetIcon("Shell32.dll", -27)
    TraySetClick(8) ;only show the menu when right clicking
    #Tray Tip
    TraySetToolTip("TrayTool")
    
    Global $idButton_200, $Formatartset, $editradio
    Global $checkPathF = _PathFull("usf.ini", @ScriptDir)
    $autostartitem = TrayCreateItem("mit Windows starten")
    $Settings = TrayCreateItem("Einstellungen")
    $exititem = TrayCreateItem("Exit")
    
    
    Firststartcheck()
    startcheck()
    
    
    ;CHECKS------------------------------------------------------------------------------------------------------
    
    
    ;------------------------------------------------------------------------------------------------------------
    Func Firststartcheck()
        If FileExists($checkPathF) = 1 Then  ;Checkdatei auf Existenz prüfen
            ; Nichts tun
        Else
    
            _FileCreate($checkPathF) ;ini Datei erstellen
            ;Standard Settings setzen
            $Formatart = "1" ;1:Qickformat 0:Longformat
            $Formattyp = "FAT32"
            $ILWprev = "1"
    
            IniWrite("USF.ini", "settings", "Formatart", $Formatart) ; StandardSetting LangFormat
            IniWrite("USF.ini", "settings", "Formatyp", $Formattyp) ; StandardSetting LangFormat
            IniWrite("USF.ini", "settings", "Preview", $ILWprev) ; StandardSetting LangFormat
    
            FileCreateShortcut(@ScriptFullPath, @StartupDir & "\USB-Formatter.lnk", @ScriptDir, "", "AutoIT Script Description")
    
            ;TrayItem Stati Grundeinstellung setzen
            TrayItemSetState($autostartitem, $TRAY_CHECKED)
            ; TrayItemSetState($ILWprevItem, $TRAY_CHECKED)
    
            SplashTextOn("Achtung", "Das Tool befindet sich im Traymenu ? ! ", 1000, 100, 900, 950, 1, "Verdana")
            Sleep(5000)
            SplashOff()
    
    
        EndIf
    EndFunc   ;==>Firststartcheck
    
    ;------------------------------------------------------------------------------------------------------------
    
    ;------------------------------------------------------------------------------------------------------------
    Func startcheck() ;Auslesen Ini Datei
        If FileExists(@StartupDir & "\USB-Formatter.lnk") Then
            TrayItemSetState($autostartitem, $TRAY_CHECKED)
        Else
            TrayItemSetState($autostartitem, $TRAY_UNCHECKED)
        EndIf
    
        ;Einlesen der Parameter aus IniDatei
        Global $Formatart = IniRead("USF.ini", "settings", "Formatart", "")
        Global $Formattyp = IniRead("USF.ini", "settings", "Formatyp", "")
        Global $ILWprev = IniRead("USF.ini", "settings", "Preview", "")
    
        ;TrayItemStati neu setzen
    
    EndFunc   ;==>startcheck
    ;------------------------------------------------------------------------------------------------------------
    
    
    ;MAIN LOOP---------------------------------------------------------------------------------------------------
    While 1
        Switch TrayGetMsg() ;switch seems nicer in this case
            Case 0
                ContinueLoop
            Case $TRAY_EVENT_PRIMARYDOWN ;reaction to left clicking
    
            Case $Settings
                TrayItemSetState($Settings, $TRAY_UNCHECKED) ;stop the automated (un)checking when clicked
                Settings()
    
            Case $autostartitem
                If BitAND(TrayItemGetState($autostartitem), $TRAY_CHECKED) Then
                    FileCreateShortcut(@ScriptFullPath, @StartupDir & "\USB-Formatter.lnk", @ScriptDir, "", "AutoIT Script Description")
                Else
                    FileDelete(@StartupDir & "\USB-Formatter.lnk")
                EndIf
    
            Case $exititem
    
                ExitLoop
        EndSwitch
    WEnd
    
    Exit
    ;------------------------------------------------------------------------------------------------------------
    
    
    
    Func Settings()
        ;Create a GUI with various controls.
        Local $hGUI = GUICreate("SETTINGS", 400, 200)
        Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25)
        Local $aWindow_Size = WinGetPos($hGUI)
        Local $aWindowClientArea_Size = WinGetClientSize($hGUI)
        ;AutoItSetOption("option")
    
        ; Display the GUI.
        GUISetState(@SW_SHOW, $hGUI)
    
        GUIStartGroup()
        $hRadio_1 = GUICtrlCreateRadio("FAT32", 20, 30, 60, 20)
        $hRadio_2 = GUICtrlCreateRadio("ExtFAT", 20, 50, 60, 20)
        $hRadio_3 = GUICtrlCreateRadio("NTFS", 20, 70, 60, 20)
    
        GUIStartGroup()
        $hRadio_4 = GUICtrlCreateRadio("Qick Format", 20, 130, 60, 20)
        $hRadio_5 = GUICtrlCreateRadio("Long Format", 20, 150, 60, 20)
    
        GUIStartGroup()
        $hGroup_1 = GUICtrlCreateGroup("Group 1", 10, 10, 120, 90)
        $hGroup_2 = GUICtrlCreateGroup("Group 2", 10, 110, 120, 70)
    
        Local $idInputName = GUICtrlCreateInput("Ihr Name", 170, 20, 150, 20)
        Local $idInputStickName = GUICtrlCreateInput("Stickname", 170, 40, 150, 20)
    
        ;Einlesen aus Ini
        If $Formattyp = "FAT32" Then
            GUICtrlSetState($hRadio_1, $GUI_CHECKED)
        EndIf
        If $Formattyp = "ExtFat" Then
            GUICtrlSetState($hRadio_2, $GUI_CHECKED)
        EndIf
        If $Formattyp = "NTFS" Then
            GUICtrlSetState($hRadio_3, $GUI_CHECKED)
        EndIf
        If $Formatart = "1" Then
            GUICtrlSetState($hRadio_4, $GUI_CHECKED)
        EndIf
        If $Formatart = "0" Then
            GUICtrlSetState($hRadio_5, $GUI_CHECKED)
        EndIf
    
        ; Loop until the user exits.
        While 1
            Switch GUIGetMsg($hGUI)
                Case $GUI_EVENT_CLOSE, $idOK
                    startcheck()
                    ExitLoop
    
                Case $hRadio_1
                    IniWrite("USF.ini", "settings", "Formatyp", GUICtrlRead($hRadio_1, 1))
                    MsgBox(4096, "$hRadio1", GUICtrlRead($hRadio_1, 1))
    
                Case $hRadio_2
                    IniWrite("USF.ini", "settings", "Formatyp", GUICtrlRead($hRadio_2, 1))
                    MsgBox(4096, "$hRadio2", GUICtrlRead($hRadio_2, 1))
    
                Case $hRadio_3
                    IniWrite("USF.ini", "settings", "Formatyp", GUICtrlRead($hRadio_3, 1))
                    MsgBox(4096, "$hRadio3", GUICtrlRead($hRadio_3, 1))
    
                Case $hRadio_4
                    IniWrite("USF.ini", "settings", "Formatart", 1)
                    MsgBox(4096, "$hRadio4", GUICtrlRead($hRadio_4, 1))
    
                Case $hRadio_5
                    IniWrite("USF.ini", "settings", "Formatart", 0)
                    MsgBox(4096, "$hRadio5", GUICtrlRead($hRadio_5, 1))
    
            EndSwitch
        WEnd
    
        GUIDelete($hGUI)
    EndFunc   ;==>Settings
    Alles anzeigen

    Sonst schau dir das an:

    Determine which radio button is pressed
    Hi The below script is the gui im having the issue with. At the moment my script will create a different radio button for whatever the value of $x is. This…
    www.autoitscript.com
  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 21. Juni 2022 um 09:23

    Das ist für mich auch schwierig zu beurteilen.

    Die Arbeit hast du und wie viel es bringt kann ich dir auch nicht sagen.

    Eventuell können andere dir da mehr Rückmeldung geben.

    Ob das allerdings wer liest hier ist auch fraglich.

  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 20. Juni 2022 um 17:18

    Ich halte davon viel.

    Und alle die deine UDF verwenden und aktuell halten, werden es dir danken, wenn sie nichts an ihren Programmen umändern müssen.

  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 20. Juni 2022 um 11:07

    OK ich habe es herausbekommen.

    Man muss natürlich die Attachments ansprechen.

    Hier also der funktionierende Code ohne extra die Eigenschaften der Attachments auszulesen.

    AutoIt
    #include <OutlookEx.au3>
    $oOutlook = _OL_Open()
    _OL_ErrorNotify(2)
    ; *****************************************************************************
    ; Example 4
    ; Create a html mail plus two attachments (plus one inline picture = attachment)
    ; but don't send it
    ; Inline picture using Content-ID
    ; http://stackoverflow.com/questions/9158706/how-to-embed-an-image-on-an-outlook-2007-vsto
    ; *****************************************************************************
    ; Create the item without setting the body. We first need to add the picture before we can refer to in by the HTML body.
    $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "*", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML)
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = " & @error & ", @extended = " & @extended)
    ; Add all attachments
    $oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, @ScriptDir & "\The_Outlook.jpg, 1, 0")
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error adding an attachment to a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = "  & @error & ", @extended = " & @extended)
    $oItem.Attachments(1).PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "The_Outlook.jpg")
    
    
    $oItem = _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, @ScriptDir & "\Outlook.png, 1, 0")
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error adding an attachment to a mail in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = "  & @error & ", @extended = " & @extended)
    $oItem.Attachments(2).PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "Outlook.png")
    
    
    ; Modify the item to add HTML  that refers to the picture
    $oItem = _OL_ItemModify($oOutlook, $oItem, Default, "HTMLBody=Bodytext in <b>bold</b><img src='cid:The_Outlook.jpg'>Embedded image.Bodytext in <b>bold</b><img src='cid:Outlook.png'>Embedded image.")
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error modifying the item in folder 'Outlook-UDF-Test\TargetFolder\Mail'. @error = "  & @error & ", @extended = " & @extended)
    _OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olBCC, "test.test@test.com")
    _OL_ItemSend($oOutlook, $oItem, Default)
    If @error <> 0 Then 
        Exit 
    Else 
        MsgBox(64, "OutlookEX UDF: _OL_ItemCreate Example Script", "Mail with inline picture created.")
    Endif
    Alles anzeigen
  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 20. Juni 2022 um 09:42

    Hier der Code der soweit das macht, was ich erreichen will.

    Die Bilder Outlook.png und The_Outlook.jpg müssen dazu im Scriptordner vorhanden sein.

    Beide sind in der OutlookUDF von Water enthalten.

    AutoIt
    #include <OutlookEX.au3>
    
    Global $oOutlook = _OL_Open()
    _OL_ErrorNotify(2)
    Global $iCount
    Global $ContentID = "@" & Hex(@YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC, 12)
    Global $oMail = _OL_ItemCreate($oOutlook, $olMailItem, "*", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, _
            'HTMLBody=This is a picture.<img src="cid:Outlook.png' & $ContentID & '">This is more text.<img src="cid:The_Outlook.jpg' & $ContentID & '">')
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail item. @error = " & @error & ", @extended = " & @extended)
    
    _AttachmentAdd(@ScriptDir & "\Outlook.png")
    _AttachmentAdd(@ScriptDir & "\The_Outlook.jpg")
    
    _OL_ItemRecipientAdd($oOutlook, $oMail, Default, $olBCC, "test.test@test.com")
    _OL_ItemSend($oOutlook, $oMail, Default)
    _OL_Close($oOutlook)
    
    
    Func _AttachmentAdd($sPicturePath)
        Local $PicName = StringTrimLeft($sPicturePath, StringInStr($sPicturePath, "\", 0 , -1)); & "@"
        $oItem = _OL_ItemAttachmentAdd($oOutlook, $oMail, Default, $sPicturePath & ", 1, 0")
        If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error adding an attachment to the mail item. @error = " & @error & ", @extended = " & @extended)
        $aOutlookinfo = _OL_ItemAttachmentGet($oOutlook, $oMail, Default)
        $iCount += 1
        $aOutlookinfo[$iCount][0].PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", $PicName & $ContentID)
    EndFunc   ;==>_AttachmentAdd
    Alles anzeigen
  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 20. Juni 2022 um 09:25

    Hallo Water!

    Mit deinem Code erhalte ich:

    Was ich auch nicht ganz verstehe ist warum deine Funktion _OL_ItemAttachmentAdd nicht das Attachmentobject zurück gibt?

    Laut dem Beschreibungstext der Funktion sollte das doch sein?

    Damit sollte man doch auch PropertyAccessor setzen können?

    Das Beispiel unten funktioniert aber nicht.

    Zitat

    ; #FUNCTION# ====================================================================================================================

    ; Name ..........: _OL_ItemAttachmentAdd

    ; Description ...: Adds one or more attachments to an item.

    ; Syntax.........: _OL_ItemAttachmentAdd($oOL, $vItem, $sStoreID, $vP1[, $vP2 = ""[, $vP3 = ""[, $vP4 = ""[, $vP5 = ""[, $vP6 = ""[, $vP7 = ""[, $vP8 = ""[, $vP9 = ""[, $vP10 = ""[, $sDelimiter = ","]]]]]]]]]])

    ; Parameters ....: $oOL - Outlook object returned by a preceding call to _OL_Open()

    ; $vItem - EntryID or object of the item

    ; $sStoreID - StoreID where the EntryID is stored. Use the keyword "Default" to use the users mailbox

    ; $vP1 - The source of the attachment. This can be a file (represented by the full file system path (drive letter or UNC path) with a file name) or an

    ; +Outlook item (EntryId or object) that constitutes the attachment

    ; +or a zero based one-dimensional array with unlimited number of attachments.

    ; |Every attachment parameter can consist of up to 4 sub-parameters separated by commas or parameter $sDelimiter:

    ; | 1 - Source: The source of the attachment as described above

    ; | 2 - (Optional) Type: The type of the attachment. Can be one of the OlAttachmentType constants (default = $olByValue)

    ; | 3 - (Optional) Position: For RTF format. Position where the attachment should be placed within the body text (default = Beginning of the item)

    ; | 4 - (Optional) DisplayName: For RTF format and Type = $olByValue. Name is displayed in an Inspector object or when viewing the properties of the attachment

    ; $vP2 - [optional] Same as $vP1 but no array is allowed

    ; $vP3 - [optional] Same as $vP2

    ; $vP4 - [optional] Same as $vP2

    ; $vP5 - [optional] Same as $vP2

    ; $vP6 - [optional] Same as $vP2

    ; $vP7 - [optional] Same as $vP2

    ; $vP8 - [optional] Same as $vP2

    ; $vP9 - [optional] Same as $vP2

    ; $vP10 - [optional] Same as $vP2

    ; $sDelimiter - [optional] Delimiter to separate the sub-parameters of the attachment parameters $vP1 - $vP10 (default = ",")

    ; Return values .: Success - Item object

    ; Failure - Returns 0 and sets @error:

    ; |1 - No Outlook item specified

    ; |2 - Item could not be found. EntryID might be wrong

    ; |3 - Error adding attachment to the item list. @extended = number of the invalid attachment (zero based)

    ; |4 - Attachment could not be found. @extended = number of the invalid attachment (zero based)

    ; Author ........: water, seadoggie01

    ; Modified.......:

    ; Remarks .......: $vP2 to $vP10 will be ignored if $vP1 is an array of attachments.

    ; For more details about sub-parameters 2-4 please check MSDN for the Attachments.Add method

    ; Related .......:

    ; Link ..........:

    ; Example .......: Yes

    ; ===============================================================================================================================

    Alles anzeigen

    Ca. so:

    AutoIt
    $oItem = _OL_ItemAttachmentAdd($oOutlook, $oMail, Default, $sPicturePath & ", 1, 0")
        If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error adding an attachment to the mail item. @error = " & @error & ", @extended = " & @extended)
    $oItem.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", $ContentID)
  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 17. Juni 2022 um 21:36

    Ich hab jetzt wieder die deine _OL_ItemAttachmentGet missbraucht.

    Kannst du mir da einen "sauberen" Weg zeigen, wie man "http://schemas.microsoft.com/mapi/proptag/0x3712001E" setzt

    Wenn man "http://schemas.microsoft.com/mapi/proptag/0x3712001E" setzt dann schaut das sehr gut aus mit Outlook Thunderbird und K-9

    AutoIt
    #include <OutlookEX.au3>
    #include <debug.au3>
    _OL_ErrorNotify(2)
    
    $oOutlook = _OL_Open()
    $oMail = _OL_ItemCreate($oOutlook, $olMailItem, "*", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, _
            'HTMLBody=This is a picture.<img src="cid:test">This is more text.')
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error creating a mail item. @error = " & @error & ", @extended = " & @extended)
    $oItem = _OL_ItemAttachmentAdd($oOutlook, $oMail, Default, @ScriptDir & "\The_Outlook.JPG, 1, 0")
    If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Example Script", "Error adding an attachment to the mail item. @error = " & @error & ", @extended = " & @extended)
    ;_OL_ItemModify($oOutlook, $oItem, Default, "http://schemas.microsoft.com/mapi/proptag/0x3712001E=test")
    $aOutlookinfo = _OL_ItemAttachmentGet2($oOutlook, $oMail, Default)
    _DebugArrayDisplay($aOutlookinfo, "Outlookinfo", "", 0, Default, "Object to the attachment|DisplayName|FileName|PathName|Position|Size|Type|Index|Class|BlockLevel|0x3712001E|0x3713001E|0x37050003|0x37140003")
    $asplit = StringSplit("Object to the attachment|DisplayName|FileName|PathName|Position|Size|Type|Index|Class|BlockLevel|0x3712001E|0x3713001E|0x37050003|0x37140003", "|")
    For $i = 1 To UBound($aOutlookinfo, 2) - 1
        ConsoleWrite($asplit[$i + 1] & @TAB & " --> " & @TAB & $aOutlookinfo[1][$i] & @CRLF)
    Next
    _OL_ItemRecipientAdd($oOutlook, $oMail, Default, $olBCC, "test@test.com")
    ;_OL_ItemSend($oOutlook, $oMail, Default)
    ;$oMail.Display
    _OL_Close($oOutlook)
    
    ; #FUNCTION# ====================================================================================================================
    ; Name ..........: _OL_ItemAttachmentGet
    ; Description ...: Returns a list of attachments of an item.
    ; Syntax.........: _OL_ItemAttachmentGet($oOL, $vItem[, $sStoreID = Default])
    ; Parameters ....: $oOL      - Outlook object returned by a preceding call to _OL_Open()
    ;                  $vItem    - EntryID or object of the item
    ;                  $sStoreID - [optional] StoreID where the EntryID is stored (default = users mailbox)
    ; Return values .: Success - two-dimensional one based array with the following information:
    ;                  |0 - Object to the attachment
    ;                  |1 - DisplayName: String representing the name, which does not need to be the actual file name, displayed below the icon representing the embedded attachment
    ;                  |2 - FileName: String representing the file name of the attachment
    ;                  |3 - PathName: String representing the full path to the linked attached file
    ;                  |4 - Position: Integer indicating the position of the attachment within the body of the item
    ;                  |5 - Size: Integer indicating the size (in bytes) of the attachment
    ;                  |6 - Type: OlAttachmentType constant indicating the type of the specified object
    ;                  Failure - Returns 0 and sets @error:
    ;                  |1 - No Outlook item specified
    ;                  |2 - Item could not be found. EntryID might be wrong
    ;                  |3 - Item has no attachments
    ; Author ........: water
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func _OL_ItemAttachmentGet2($oOL, $vItem, $sStoreID = Default)
        If Not IsObj($vItem) Then
            If StringStripWS($vItem, BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING)) = "" Then Return SetError(1, 0, 0)
            $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)
            If @error Then Return SetError(2, @error, 0)
        EndIf
        If $vItem.Attachments.Count = 0 Then Return SetError(3, 0, 0)
        Local $aAttachments[$vItem.Attachments.Count + 1][14] = [[$vItem.Attachments.Count, 14]]
        Local $iIndex = 1
        For $oAttachment In $vItem.Attachments
            $aAttachments[$iIndex][0] = $oAttachment
            $aAttachments[$iIndex][1] = $oAttachment.DisplayName
            $aAttachments[$iIndex][2] = $oAttachment.FileName
            $aAttachments[$iIndex][3] = $oAttachment.PathName
            $aAttachments[$iIndex][4] = $oAttachment.Position
            $aAttachments[$iIndex][5] = $oAttachment.Size
            $aAttachments[$iIndex][6] = $oAttachment.Type
            $aAttachments[$iIndex][7] = $oAttachment.Index
            $aAttachments[$iIndex][8] = $oAttachment.Class
            $aAttachments[$iIndex][9] = $oAttachment.BlockLevel
            $oAttachment.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "test")
            $aAttachments[$iIndex][10] = $oAttachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E")
            $aAttachments[$iIndex][11] = $oAttachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3713001E")
            $aAttachments[$iIndex][12] = $oAttachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x37050003")
            $aAttachments[$iIndex][13] = $oAttachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x37140003")
            $iIndex += 1
        Next
        Return $aAttachments
    EndFunc   ;==>_OL_ItemAttachmentGet2
    Alles anzeigen
  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 17. Juni 2022 um 20:41

    Hi!

    Gut dann war ich nicht ganz auf dem Holzweg.

    Also wenn man es auf das Outlook.jpg Beispiel anwendet, erhält man.

    Zitat

    Content ID :

    Content Location: The_Outlook.jpg

    Method : 1

    Flags : 0

    Danke für deine Bemühung

    Wie kann ich jetzt diese Eigenschaften ändern?

    Mit _OL_ItemModify? Und wenn ja wie

  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 17. Juni 2022 um 12:15

    Moombas

    Danke für deinen Beitrag. Das habe ich auch schon gemacht. An der HTML liegt es nicht.

    water

    Bei dir klinkt das immer so einfach :)

    Wie mach ich das?

    Ich habe versucht deine _OL_ItemAttachmentGet Funktion zu erweitern.

    Aber aus Mangel an Wissen funktioniert das nicht.

    Code
    ; #FUNCTION# ====================================================================================================================
    ; Name ..........: _OL_ItemAttachmentGet
    ; Description ...: Returns a list of attachments of an item.
    ; Syntax.........: _OL_ItemAttachmentGet($oOL, $vItem[, $sStoreID = Default])
    ; Parameters ....: $oOL      - Outlook object returned by a preceding call to _OL_Open()
    ;                  $vItem    - EntryID or object of the item
    ;                  $sStoreID - [optional] StoreID where the EntryID is stored (default = users mailbox)
    ; Return values .: Success - two-dimensional one based array with the following information:
    ;                  |0 - Object to the attachment
    ;                  |1 - DisplayName: String representing the name, which does not need to be the actual file name, displayed below the icon representing the embedded attachment
    ;                  |2 - FileName: String representing the file name of the attachment
    ;                  |3 - PathName: String representing the full path to the linked attached file
    ;                  |4 - Position: Integer indicating the position of the attachment within the body of the item
    ;                  |5 - Size: Integer indicating the size (in bytes) of the attachment
    ;                  |6 - Type: OlAttachmentType constant indicating the type of the specified object
    ;                  Failure - Returns 0 and sets @error:
    ;                  |1 - No Outlook item specified
    ;                  |2 - Item could not be found. EntryID might be wrong
    ;                  |3 - Item has no attachments
    ; Author ........: water
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func _OL_ItemAttachmentGet($oOL, $vItem, $sStoreID = Default)
        If Not IsObj($vItem) Then
            If StringStripWS($vItem, BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING)) = "" Then Return SetError(1, 0, 0)
            $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)
            If @error Then Return SetError(2, @error, 0)
        EndIf
        If $vItem.Attachments.Count = 0 Then Return SetError(3, 0, 0)
        Local $aAttachments[$vItem.Attachments.Count + 1][11] = [[$vItem.Attachments.Count, 11]]
        Local $iIndex = 1
        For $oAttachment In $vItem.Attachments
            $aAttachments[$iIndex][0] = $oAttachment
            $aAttachments[$iIndex][1] = $oAttachment.DisplayName
            $aAttachments[$iIndex][2] = $oAttachment.FileName
            $aAttachments[$iIndex][3] = $oAttachment.PathName
            $aAttachments[$iIndex][4] = $oAttachment.Position
            $aAttachments[$iIndex][5] = $oAttachment.Size
            $aAttachments[$iIndex][6] = $oAttachment.Type
            $aAttachments[$iIndex][7] = $oAttachment.Index
            $aAttachments[$iIndex][8] = $oAttachment.Class
            $aAttachments[$iIndex][9] = $oAttachment.BlockLevel
            $aAttachments[$iIndex][10] = $oAttachment.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E")
            $iIndex += 1
        Next
        Return $aAttachments
    EndFunc   ;==>_OL_ItemAttachmentGet
    Alles anzeigen
  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 17. Juni 2022 um 10:32

    @GM

    Ja das habe ich schon gemacht.

    Ich brauch so was denke ich nur habe ich keine Ahnung wie ich das umsetzt:

    Zitat von https://csharp.hotexamples.com/examples/-/_NameSpace/-/php-_namespace-class-examples.html
    Code
    //CONTENT-ID
                        const string schemaPrAttachContentId = @"http://schemas.microsoft.com/mapi/proptag/0x3712001E";
                        var contentId = Guid.NewGuid().ToString();
    
                        mail.Attachments.Add(imagePath, OlAttachmentType.olEmbeddeditem, mail.HTMLBody.Length, Type.Missing);
                        mail.Attachments[mail.Attachments.Count].PropertyAccessor.SetProperty(schemaPrAttachContentId,
                                                                                              contentId);
  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 17. Juni 2022 um 10:07

    water

    Macht bei mir genau gar keinen Unterschied.

    Hier das was ich erreichen will.

  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 17. Juni 2022 um 08:25

    Schnuffel #10

    Ja stimmt schon. Hierfür braucht man halt einen Webserver. Diesen zu betreiben ist mir der Aufwand nicht wert.

    water

    Mein Testcode ist so genau dein Beispielscript.

    Ich vermute, dass man dem Attachment einen Parameter mitgeben muss damit es nicht als normales Attachment wahrgenommen wird.

    Hättest du eine Ahnung wie ich das hier umsetzen kann mit deiner UDF

    PropertyAccessor.SetProperty method (Outlook)
    Office VBA reference topic
    docs.microsoft.com
    Zitat von https://stackoverflow.com/questions/11735352/send-email-with-embedded-image-without-using-wordeditor
    Code
    attachment.PropertyAccessor.SetProperty
        ( "http://schemas.microsoft.com/mapi/proptag/0x3712001E"
        , imageCid
        );
  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 15. Juni 2022 um 17:45

    Schnuffel Meinst du direkt in den HMTL Code? Wenn ja das habe ich auch schon probiert. Outlook stellt das auch "sauber" dar aber K-9 am Smartphone nicht.

  • Outlook Mail mit eingebetteten Bildern im Body Text als versteckte Anhänge

    • Concara
    • 15. Juni 2022 um 17:20

    water Meinst du https://web.archive.org/web/2012062817…ode/htmlimg.htm

    Leider komm ich damit auch nicht zurecht.

    To attach multiple embedded images to a message, set the value of the &H3712001E field

    Was ist das für ein Feld? wie könnte ich es befüllen?

    BugFix Nein der Mailclient stellt HTML schon dar

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™