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

Beiträge von gmmg

  • iframes Webdriver

    • gmmg
    • 3. August 2023 um 13:04

    Hallo MojoeB,

    schau dir mal die wd_demo.au3 an, da gibt es den Anschnitt "Demo Frames"

    Wenn du diese startest, wird das Frames Demo von einer Website ausgeführt und du erhältst auch verschiedene Rückgabe Arrays (Array Display), wo auch der Name der Frames aufgelistet wird.

    pasted-from-clipboard.png

    Vielleicht hilft das schon weiter.

    Hier die URL vom Webdriver Abschnitt im engl Forum.

    WebDriver UDF - Help & Support (III)
    As the WebDriver UDF - Help & Support thread has grown too big, I started a new one. The prior thread can be found here.
    www.autoitscript.com

    Gruß Marcel

  • Zu einem bestimmten Tab in Chrome springen und dort in der eingabezeile etwas rein kopieren und aufrufen

    • gmmg
    • 25. Juli 2023 um 15:00

    Hier mal ein Chrome webdriver Beispiel für den Login auf der AutoIT Seite

    AutoIt
    #include "wd_helper.au3"
    #include "wd_core.au3"
    
    Local $file
    
    $GoogleChrome64bit = "C:\Program Files\Google\Chrome\Application\chrome.exe"
    $GoogleChrome32bit = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    
    If FileExists($GoogleChrome64bit) Then $file = $GoogleChrome64bit
    If FileExists($GoogleChrome32bit) Then $file = $GoogleChrome32bit
    
    If FileExists($file) Then
    
        $google_chrome_version = FileGetVersion($file)
        $google_chrome_version_array = StringSplit($google_chrome_version,".")
    
        $webdriver = "chromedriver_" & $google_chrome_version_array[1] & ".exe"
    
        If Not FileExists(@ScriptDir & '\data\'& $webdriver) Then
            MsgBox(0,"Info","Google Chromedriver nicht vorhanden." & @CRLF & $webdriver)
            Exit
        EndIf
    Else
        MsgBox(0,"Info","Google Chrome in folgenden Pfad nicht vorhanden." & @CRLF & @CRLF & $file)
        Exit
    EndIf
    
    $user = "user"
    $pass = "password"
    
    $_WD_DEBUG = $_WD_DEBUG_None  ;set to $_WD_DEBUG_None before compiling.
    
    ;Global $_WD_DRIVER
    Local $sDesiredCapabilities
    Local $iIndex
    
    $url = "https://autoit.de/wcf/login/?url=https%3A%2F%2Fautoit.de%2F"
    
    SetupChrome()
    
    _WD_Startup()
    $sSession = _WD_CreateSession($sDesiredCapabilities)
    _WD_Window($sSession, "Maximize", "{}")
    _WD_Navigate($sSession, $url)
    _WD_LoadWait($sSession, 1500)
    
    ;WinSetState ("","",@SW_MAXIMIZE)
    
    _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='username']")
    ;ConsoleWrite("+ @error = " & @error & @CRLF)
    $sElement_user = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='username']")
    
    _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='password']")
    ;ConsoleWrite("+ @error = " & @error & @CRLF)
    $sElement_pass = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='password']")
    
    If @error = $_WD_ERROR_Success Then
       _WD_ElementAction($sSession, $sElement_user, 'value',$user)
    EndIf
    If @error = $_WD_ERROR_Success Then
       _WD_ElementAction($sSession, $sElement_pass, 'value',$pass)
    EndIf
    
    Sleep(1000)
    ;Send("{ENTER}")
    
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div[1]/section/div/div/div[1]/form/section[1]/div/input[1]")
    ;_WD_HighlightElement($sSession, $sElement, 3)
    
    If @error = $_WD_ERROR_Success Then
        _WD_ElementAction($sSession, $sElement, 'click')
    Sleep(500)
    EndIf
    
    _WD_Shutdown()
    _WD_DeleteSession($sSession)
    
    Exit
    
    Func SetupChrome()
    
        ;_WD_Option('Driver', 'chromedriver.exe')
        _WD_Option('Driver', 'data\'& $webdriver)
        _WD_Option('Port', 9515)
        _WD_Option('DriverParams', '--log-path="' & @UserProfileDir & '\chrome.log"')
        _WD_Option('DriverParams')
    
        $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", ' & _
        '"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, ' & _
        '"prefs": {"credentials_enable_service": false},' & _
        '"args": ["--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\chromedriver\\AutoIT\\", "--profile-directory=Default"] }}}}'
    
    EndFunc
    Alles anzeigen

    Gruß gmmg

  • Schliessen geöffneter Datei

    • gmmg
    • 21. Juli 2023 um 09:55

    Hallo hipfzwirgel,

    wenn da auch anderen User in der DB Änderungen machen, ist das natürlich schwierig.

    Nutzt du eigentlich die Access.udf Link oder die per MS_AccessDB.au3?

    Alternativ nochmal ein Beispiel als eingebundene Funktionen:

    AutoIt
    $dbname = "d:\test.accdb"
    
    _access_write($dbname)
    
    Func _access_write($dbname)
    
        $adoCon = ObjCreate("ADODB.Connection")
        $adoCon.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & $dbname & ";")
        $adoRs = ObjCreate("ADODB.Recordset")
    
        ;$adocon = ObjCreate("ADODB.Connection")
        ;$adocon.open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $dbname)
        ;$adors = ObjCreate("ADODB.Recordset")
    
        Local $sQuery = "INSERT INTO TB1 (`Name`,`Vorname`) VALUES ('Nachname','Vorname')"
        ;Local $sQuery = 'UPDATE TB1 SET [01_MA].SID = "' & $sid  & '" WHERE [01_MA].PC = "' & $ssamaccountname & '"'
        $adoCon.Execute($sQuery)
        $adoCon.Close
    
    EndFunc
    
    ;$sQuery = "INSERT INTO tabelle_xyz (`Feld1`,`Feld2`,`Feld3`,`Feld4`) VALUES ('" & $s_wert[1] & "', '" & $s_wert[2] & "', '" & $s_wert[3] & "', '" & $s_wert[4] & "')"
    
    
    ;~ ;--------- Modify the variables below as desired or applicable -------
    ;~     $dbname = "d:\dbtest.accdb"
    
    ;~     $tblname = "Tabelle1"
    ;~     $fldname01 = "Feld1"
    ;~     $format = "Text(50)"
    ;~     $fldname02 = "Feld2"
    ;~     $format = "Text(50)"
    ;~     $fldname03 = "Feld3"
    ;~     $format = "Text(50)"
    ;~     $fldname04 = "Feld4"
    ;~     $format = "Text(50)"
    
    ;~     $query = "SELECT * FROM "& $tblname & " WHERE xyz = '1004'"
    ;~     $strData1 = _ReadOneFld($query, $dbname, $fldname02)
    ;~     $strData2 = _ReadOneFld($query, $dbname, $fldname03)
    ;~     $strData3 = _ReadOneFld($query, $dbname, $fldname04)
    
    ;~     ;ConsoleWrite( $query & @crlf & "Ergebnis: " & $strData2)
    ;~     MsgBox(0,"",$query & @crlf & "Ergebnis: " & $strData1 & @CRLF & $fldname03 & ": " & $strData2 & @CRLF & $fldname04 & ": " & $strData3)
    
    
    
    ;~ ;------access DB auslesen -------------
    ;~ Func _ReadOneFld($_sql, $_dbname, $_field)
    ;~     Dim $_output
    ;~     $adoCon = ObjCreate("ADODB.Connection")
    ;~     $adoCon.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & $dbname & ";")
    ;~     $adoRs = ObjCreate("ADODB.Recordset")
    ;~     $adoRs.CursorType = 1
    ;~     $adoRs.LockType = 3
    ;~     $adoRs.Open($_sql, $adoCon)
    
    ;~     With $adoRs
    ;~         If .RecordCount Then
    ;~             While Not .EOF
    ;~                 $_output = $_output & .Fields($_field).Value & @CRLF
    ;~                 .MoveNext
    ;~             WEnd
    ;~         EndIf
    ;~     EndWith
    ;~     $adoCon.Close
    ;~     Return $_output
    ;~ EndFunc   ;==>_ReadOneFld
    Alles anzeigen

    Gruß gmmg

  • Schliessen geöffneter Datei

    • gmmg
    • 19. Juli 2023 um 09:35

    @hipfzwirgel

    das Thema ist zwar schon 1 Monat alt., aber schau doch mal in der Access DB unter Datei -> Optionen -> Clienteinstellungen -> Erweitert bei dem Punkt Standartöffnungsmodus. Da nutzen wir immer den Punkt "Freigegeben".

    Theoretisch kann du auch eine Haupt DB anlegen und machst dann nach Änderungen immer eine Export (per Makro) der Haupt DB in eine zweite DB. Mit der zweiten können dann die User arbeiten.

    Änderungen sollten dann immer in der Haupt DB gemacht werden.

    Gruß gmmg

  • GUI Menü - klickbar machen?

    • gmmg
    • 30. Mai 2023 um 08:10

    Guten Morgen,

    Velted: Superso funktioniert das :)

    Gruß gmmg

  • GUI Menü - klickbar machen?

    • gmmg
    • 26. Mai 2023 um 22:09

    Moombas, BananaJoe, Alina

    Nein, es sollen keine Untermenü's sein.

    @Kanashius

    das ist genau das was ich suche, nur bissl viel code für die 2 Button :)

    Vielleicht macht es hier Sinn, einfach nur 2 Button zu nehmen.


    Danke für euren Input.

    Gruß gmmg

  • GUI Menü - klickbar machen?

    • gmmg
    • 26. Mai 2023 um 15:14

    Hallo Zusammen,

    per GUICtrlCreateMenu habe ich ein Menü (Menü1) und 2 MenüItems (Menü2 / Exit) erzeugt.

    Nun möchte ich, dass wenn Menü1 geklickt wird auch der entsprechende Case zweig reagiert.

    Die Menü-Item (Menü2 und Exit) Einträge funktionieren ohne Probleme.

    Gibt es da eine Lösung?


    pasted-from-clipboard.png


    AutoIt
    #include <GUIConstantsEx.au3>
    
    $hGUI = GUICreate("Test", 500, 500)
    
    $mM1 = GUICtrlCreateMenu("Menü1")
    
    $mM2 = GUICtrlCreateMenuItem("Menü2",-1)
    $mExit = GUICtrlCreateMenuItem("Exit",-1)
    
    GUISetState()
    
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $mExit
                Exit
            Case $mM1
                MsgBox(0, "1", "I can be actioned!")
            Case $mM2
                MsgBox(0, "2", "I can be actioned!")
        EndSwitch
    WEnd
    Alles anzeigen

    Hier hatte ich im englischen Forum ein Beispiel gefudnen, allerdings fehlt da die Unterscheidung der Button.

    AutoIt
    #include <GUIConstantsEx.au3>
    #include <array.au3>
    #include <winapi.au3>
    #include <WindowsConstants.au3>
    
    $GUI = Guicreate("blabla")
    $FileMenu = GUICtrlCreateMenu("&Options")
    
    GUIRegisterMsg($WM_INITMENU,"_menuclick")
    Guisetstate()
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case 3
          MsgBox (0,"1","" )
        EndSwitch
    WEnd
    
    Func _menuclick($hWndGUI, $MsgID, $WParam, $LParam)
        msgbox(0,"2","")
    EndFunc
    Alles anzeigen

    Danke und allen vorab ein schönes Pfingstwochenende :)

    Gruß gmmg

  • Basic Image Editor als Erweiterung für ein Screenshot Tool

    • gmmg
    • 24. Mai 2023 um 11:16

    kein Problem, hast mir ja schon geholfen :)

    Eventuell ist es ja trotzdem auch für andere interessant, da die Tools wie Greenshot usw, aktuell keine mir bekannte Möglichkeit haben, ein File zu übergeben, ohne das noch extra etwas gewählt werden muss.

    Zu den aktuellen Todo's im Image Editor:

    1. die Farbauswahl funktioniert nun -> erledigt

    Es hatte nur die folgende Zeile im Case $idColor_IE gefehlt.

    _GDIPlus_PenSetColor($hPen_IE, $IE_Pen_Col)

    2. Beim Text hinzufügen, wird in das Bild hinein gezoomt. Kann man das verhindern? -> erledigt

    Wenn man eine Text erstellt hat, diesen dann aber nicht nutzen möchte, also mit ESC abbricht, wird dennoch gezoomt.  -> offen  -> erledigt in V3.3

    Hier nochmal die aktuelle Version:

    Basic Image Editor_V3.3.au3


    Screenshot

    pasted-from-clipboard.png

    Gruß gmmg

  • Basic Image Editor als Erweiterung für ein Screenshot Tool

    • gmmg
    • 24. Mai 2023 um 10:32

    UEZ

    anbei der für meine Bedürfnisse angepasste Code.

    Leider lässt sich aktuell ein größerer Text nicht anfügen, hier kommt die Meldung "Deine Nachricht ist zu lang. Es stehen maximal 40.000 Zeichen zur Verfügung."

    Basic Image Editor.au3

    Die Farbauswahl funktioniert, wird aber nicht auf die Elemte übernommen.

    Was mir eben noch aufgefallen ist, wenn man eine Text hinzufügt, wird in das Bild leicht hinein gezoomt. Kann man das verhindern?

    Danke

    Gruß gmmg

  • Basic Image Editor als Erweiterung für ein Screenshot Tool

    • gmmg
    • 24. Mai 2023 um 09:10

    Hallo UEZ,

    Vielen Dank für deine Info.

    Die Basic Image Editor.au3 läuft ganz gut. hier sind aber einige ToDo's nötig:

    1. Save File funktioniert nicht, keine Funktion hinterlegt -> erledigt

    2. Bilddatei "BMP" Datei beim Start übergeben -> erledigt

    3. Farbeauswahl funktioniert nicht, wird nicht auf die Elemte übernommen.

    Vielleicht hat da jemand eien passende Lösung.

    Das Windows Screenshooter Tool v1.84 hab ich bis jetzt noch nicht ans laufen gebracht.

    Da kommt der folgende Fehler:

    AutoIt Windows Screenshooter v1.84 Build 2019-08-18\AutoIt Windows Screenshooter\_Source\Windows Screenshooter.au3"(122,107) : error: $GDIP_WrapModeTileFlipXY previously declared as a 'Const'.

    Global Enum $GDIP_WrapModeTile, $GDIP_WrapModeTileFlipX, $GDIP_WrapModeTileFlipY, $GDIP_WrapModeTileFlipXY,

    Gruß gmmg

  • Basic Image Editor als Erweiterung für ein Screenshot Tool

    • gmmg
    • 23. Mai 2023 um 15:36

    Hallo Zusammen,

    als Erweiterung des Screenshot Tools (Codeschnipsel von UEZ habe im englischen Forum habe ich folgendes Script von UEZ gefunden.

    Screenshot Tool

    AutoIt
    #include-once
    #include <Clipboard.au3>
    #include <GUIConstantsEx.au3>
    #include <WinAPIConstants.au3>
    #include <WinAPIGdi.au3>
    #include <WinAPISys.au3>
    #include <WindowsConstants.au3>
    
    Global $iX1, $iY1, $iX2, $iY2, $aPos, $sMsg
    Global $hHBitmap
    
    ;--- Create GUI ---
    $hMain_GUI = GUICreate("Screenshot-Tool", 250, 50, @DeskTopWidth -285 , @DeskTopHeight -150)
    $hRect_Button   = GUICtrlCreateButton("Screenshot erstellen",  35, 13, 180, 25)
    WinSetOnTop ( "Screenshot-Tool","", 1)
    
    GUISetState(@SW_SHOW)
    
    While 1
    
        $iMsg = GUIGetMsg()
        Switch $iMsg
    
            Case $GUI_EVENT_CLOSE
                 Exit
            Case $hRect_Button
    
                If FileExists(@ScriptDir & "\Captured.bmp") then FileDelete(@ScriptDir & "\Captured.bmp")
                GUISetState(@SW_HIDE, $hMain_GUI)
                $hHBitmap = _WinAPI_MarkScreenRegionAndCapture()
                _WinAPI_SaveHBITMAPToFile(@ScriptDir & "\Captured.bmp", $hHBitmap)
                _WinAPI_DeleteObject($hHBitmap)
                ;If FileExists(@ScriptDir & "\Captured.bmp") Then ShellExecute(@ScriptDir & "\Captured.bmp")
                If FileExists(@ScriptDir & "\Captured.bmp") Then Run("mspaint " & @ScriptDir & "\Captured.bmp")
                ;If FileExists(@ScriptDir & "\Captured.bmp") Then Run("C:\Program Files\Greenshot\Greenshot.exe " & @ScriptDir & "\Captured.bmp")
    
                GUISetState(@SW_SHOW, $hMain_GUI)
                ;Exit
    
        EndSwitch
    
    WEnd
    
    ; #FUNCTION# ====================================================================================================================
    ; Name ..........: _WinAPI_MarkScreenRegionAndCapture
    ; Description ...: Selected area on desktop will be captured and save to clipbord or GDI bitmap handle will be returned.
    ; Syntax ........: _WinAPI_MarkScreenRegionAndCapture([$iFillMode = 0[, $bClipboard = True]])
    ; Parameters ....: $iFillMode           - [optional] an integer value. Default is 0.
    ;                                           0: marked area filled with solid color
    ;                                           1: marked area filled with hatch pattern ($HS_DIAGCROSS)
    ;                                           2: marked area without any fill pattern / color - only red border
    ;                  $bClipboard          - [optional] a boolean value. Default is False. If True then no GDI bitmap handle will be returned.
    ;                                         If false then GDI bitmap handle will be returned.
    ;                  $bManual             - [optional] a boolean value. Default is False. If True manual capturing is activated.
    ;                  $iX1                 - [optional] an integer value. Default is 0. If $bManual is true enter the x1 screen pos.
    ;                  $iY1                 - [optional] an integer value. Default is 0. If $bManual is true enter the Y1 screen pos.
    ;                  $iX2                 - [optional] an integer value. Default is 0. If $bManual is true enter the x2 screen pos.
    ;                  $iY2                 - [optional] an integer value. Default is 0. If $bManual is true enter the y2 screen pos.
    ; Return values .: 0 / 1 / -1 / GDI bitmap handle
    ; Author ........: UEZ
    ; Version .......: 0.92 build 2017-01-22
    ; Modified ......:
    ; Remarks .......: Do not forget to dispose returned GDI bitmap handle for non clipboard mode using _WinAPI_DeleteObject!
    ; Related .......:
    ; Link ..........:
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func _WinAPI_MarkScreenRegionAndCapture($iFillMode = 0, $bClipboard = False, $bManual = False, $iX1 = 0, $iY1 = 0, $iX2 = 0, $iY2 = 0)
        If @OSBuild > 6299 Then ;https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx
            DllCall("Shcore.dll", "long", "PROCESS_DPI_AWARENESS", 1) ;PROCESS_SYSTEM_DPI_AWARE = 1 (https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx)
        Else
            DllCall("User32.dll", "bool", "SetProcessDPIAware")
        EndIf
        Local $iOld = AutoItSetOption("MouseCoordMode", 1)
        If Not $bManual Then
            Local Const $hDesktop = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]")
            Local Const $aFullScreen = WinGetPos($hDesktop) ;should work also on multi screens
            Local Const $iW = $aFullScreen[2], $iH = $aFullScreen[3]
            Local Const $hGUI_Screencapture = GUICreate("", $iW, $iH, $aFullScreen[0], $aFullScreen[1], $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED))
            GUISetState(@SW_SHOW, $hGUI_Screencapture)
            Local Const $hDC = _WinAPI_GetDC($hGUI_Screencapture)
            Local Const $hGfxDC = _WinAPI_CreateCompatibleDC($hDC)
            Local Const $hBitmapGDI = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
            Local $hObjOld = _WinAPI_SelectObject($hGfxDC, $hBitmapGDI)
            Local $tSize = DllStructCreate($tagSIZE)
            $tSize.x = $iW
            $tSize.y = $iH
            Local $tSource = DllStructCreate($tagPOINT)
            Local $tBlend = DllStructCreate($tagBLENDFUNCTION)
            $tBlend.Alpha = 0xFF
            $tBlend.Format = 1
            Local $tDest = DllStructCreate($tagPOINT)
            $tDest.x = $aFullScreen[0]
            $tDest.y = $aFullScreen[1]
    
            Local Const $hPen = _WinAPI_CreatePen($PS_SOLID, 1, 0x0000FF)
            Local Const $hPen_Orig = _WinAPI_SelectObject($hGfxDC, $hPen)
            Local $hBrush, $iAlpha2, $iFlag
            $iFillMode = $iFillMode > 2 ? 2 : $iFillMode < 0 ? 0 : $iFillMode
            Switch $iFillMode
                Case 0
                    $hBrush = _WinAPI_CreateBrushIndirect($BS_SOLID, 0x808080)
                    $iAlpha2 = 0xA0
                    $iFlag = $ULW_ALPHA
                Case 1
                    $hBrush = _WinAPI_CreateBrushIndirect($BS_HATCHED, 0x808000, $HS_DIAGCROSS)
                    $iAlpha2 = 0x30
                    $iFlag = $ULW_ALPHA
                Case 2
                    $hBrush = _WinAPI_CreateBrushIndirect($BS_HOLLOW, 0x000000)
                    $iAlpha2 = 0xFF ;not needed
                    $iFlag = $ULW_COLORKEY
            EndSwitch
    
            Local $hBrush_Orig = _WinAPI_SelectObject($hGfxDC, $hBrush)
        Else
            If Not BitOr($iX1, $iX2, $iY1, $iY2) Then Return SetError(4, 0, 0)
        EndIf
        Local $aMPos[5], $aMPos_old[4], $tRECT = _WinAPI_CreateRect(0, 0, 0, 0)
        Do
            If $bManual Then
                $aMPos[2] = 1
            Else
                GUISetCursor(16, 1, $hGUI_Screencapture)
                $aMPos = GUIGetCursorInfo($hGUI_Screencapture)
                $aMPos_old[0] = $aMPos[0]
                $aMPos_old[1] = $aMPos[1]
                $aMPos_old[2] = MouseGetPos(0)
                $aMPos_old[3] = MouseGetPos(1)
            EndIf
            Switch $aMPos[2]
                Case 0 ;display crosshair
                    _WinAPI_BitBlt($hGfxDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $CAPTUREBLT)
                    _WinAPI_DrawLine($hGfxDC, $tDest.x, $aMPos[1], $iW, $aMPos[1])
                    _WinAPI_DrawLine($hGfxDC, $aMPos[0], $tDest.y, $aMPos[0], $iH)
                    _WinAPI_UpdateLayeredWindow($hGUI_Screencapture, $hDC, $tDest, $tSize, $hGfxDC, $tSource, 0, $tBlend, $ULW_COLORKEY)
                Case 1 ;capture selected region
                    If Not $bManual Then
                        $tBlend.Alpha = $iAlpha2
                        While $aMPos[2] ;mark region
                            GUISetCursor(14, 1, $hGUI_Screencapture) ;WinGetHandle(AutoItWinGetTitle()))
                            $aMPos = GUIGetCursorInfo($hGUI_Screencapture)
                            _WinAPI_BitBlt($hGfxDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $CAPTUREBLT) ;clear bitmap
    
                            ;draw rectangle
                            $tRECT.Left = $aMPos_old[0]
                            $tRECT.Top = $aMPos_old[1]
                            $tRECT.Right = $aMPos[0]
                            $tRECT.Bottom = $aMPos[1]
                            _WinAPI_Rectangle($hGfxDC, $tRECT)
                            If $iFillMode <> 2 Then _WinAPI_InvertRect($hGfxDC, $tRECT)
                            _WinAPI_UpdateLayeredWindow($hGUI_Screencapture, $hDC, $tDest, $tSize, $hGfxDC, $tSource, 0, $tBlend, $iFlag)
                            Sleep(10)
                        WEnd
                        _WinAPI_SelectObject($hGfxDC, $hObjOld)
                        _WinAPI_ReleaseDC($hGUI_Screencapture, $hDC)
                        _WinAPI_DeleteDC($hGfxDC)
                        _WinAPI_DeleteObject($hBitmapGDI)
                        _WinAPI_SelectObject($hGfxDC, $hPen_Orig)
                        _WinAPI_DeleteObject($hPen)
                        _WinAPI_SelectObject($hGfxDC, $hBrush_Orig)
                        _WinAPI_DeleteObject($hBrush)
                        GUIDelete($hGUI_Screencapture)
                        ;capture region
                        $aMPos[0] = MouseGetPos(0)
                        $aMPos[1] = MouseGetPos(1)
                    Else
                        $aMPos_old[2] = $iX1
                        $aMPos_old[3] = $iY1
                        $aMPos[0] = $iX2
                        $aMPos[1] = $iY2
                    EndIf
    
                    Local Const $hDC_Region = _WinAPI_GetDC(0)
                    Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Region)
                    Local Const $iW_Region = Abs($aMPos[0] - $aMPos_old[2]) + 1, $iH_Region = Abs($aMPos[1] - $aMPos_old[3]) + 1
                    Local $hHBitmap_Captured = _WinAPI_CreateCompatibleBitmap($hDC_Region, $iW_Region, $iH_Region)
                    $hObjOld = _WinAPI_SelectObject($hMemDC, $hHBitmap_Captured)
                    _WinAPI_BitBlt($hMemDC, 0, 0, $iW_Region, $iH_Region, $hDC_Region, _
                            $aMPos[0] > $aMPos_old[2] ? $aMPos_old[2] : $aMPos[0], _
                            $aMPos[1] > $aMPos_old[3] ? $aMPos_old[3] : $aMPos[1], BitOR($SRCCOPY, $CAPTUREBLT))
                    Local $hHBitmap_Clipboard = _WinAPI_CopyImage($hHBitmap_Captured, 0, 0, 0, BitOR($LR_COPYDELETEORG, $LR_COPYRETURNORG))
                    _WinAPI_SelectObject($hHBitmap_Captured, $hObjOld)
                    _WinAPI_DeleteDC($hHBitmap_Captured)
                    _WinAPI_ReleaseDC(0, $hDC_Region)
    
                    AutoItSetOption("MouseCoordMode", $iOld)
                    If $bClipboard Then
                        ;put captured region to clipboard
                        If Not _ClipBoard_Open(0) Then
                            _WinAPI_DeleteObject($hHBitmap_Clipboard)
                            Return SetError(1, 0, 0)
                        EndIf
                        If Not _ClipBoard_Empty() Then
                            _WinAPI_DeleteObject($hHBitmap_Clipboard)
                            Return SetError(2, 0, 0)
                        EndIf
                        Local Const $hCP = _ClipBoard_SetDataEx($hHBitmap_Clipboard, $CF_BITMAP)
                        If Not $hCP Or @error Then
                            _WinAPI_DeleteObject($hHBitmap_Clipboard)
                            Return SetError(3, 0, 0)
                        EndIf
                        _ClipBoard_Close()
                        _WinAPI_DeleteObject($hHBitmap_Clipboard)
                        Return 1
                    Else
                        Return $hHBitmap_Clipboard
                    EndIf
            EndSwitch
    
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    _WinAPI_SelectObject($hGfxDC, $hObjOld)
                    _WinAPI_ReleaseDC($hGUI_Screencapture, $hDC)
                    _WinAPI_DeleteDC($hGfxDC)
                    _WinAPI_DeleteObject($hBitmapGDI)
                    _WinAPI_SelectObject($hGfxDC, $hPen_Orig)
                    _WinAPI_DeleteObject($hPen)
                    GUIDelete($hGUI_Screencapture)
                    AutoItSetOption("MouseCoordMode", $iOld)
                    Return -1
            EndSwitch
        Until False
    EndFunc   ;==>_WinAPI_MarkScreenRegionAndCapture
    Alles anzeigen


    Basic Image Editor

    URL = https://www.autoitscript.com/forum/topic/15…comment=1086282


    Beispiel vom Basic Image Editor

    Unbenannt3.PNG

    Für das Screenshot Tool wäre es schön, wenn die Pfeile, Text, Rechteck und markieren funktionieren würde. Leider stürzt das Tool beim Text aktuell ab.

    Gruß gmmg

  • Download der Avast-Free-Offline-Dateien klappt seit ein paar Tagen nicht mehr mit AutoIt ... ?

    • gmmg
    • 8. Mai 2023 um 10:48

    bei mir funktioniert der Download mit folgendem Script auch. Aber die heruntergladene Datei hat die Endung .tmp nicht .exe

    AutoIt
    #include <InetConstants.au3>
    #include <MsgBoxConstants.au3>
    #include <WinAPIFiles.au3>
    
    
    ; Save the downloaded file to the temporary folder.
    Local $sFilePath = _WinAPI_GetTempFileName(@ScriptDir)
    
    ; Download the file by waiting for it to complete. The option of 'get the file from the local cache' has been selected.
    Local $iBytesSize = InetGet("https://bits.avcdn.net/productfamily_ANTIVIRUS/insttype_FREE/platform_WIN/installertype_FULL/build_RELEASE/cookie_mmm_ava_998_999_000_m", $sFilePath, $INET_FORCERELOAD)
    
    ; Retrieve the filesize.
    Local $iFileSize = FileGetSize($sFilePath)
    
    ; Display details about the total number of bytes read and the filesize.
    MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _
            "The total filesize: " & $iFileSize)
    Alles anzeigen

    @MojoeB

    Ich nutze den Webdriver.exe mit Google Chrome und benenne die jeweilige Webdriver.exe entsprechend der Webdriver Version um "webdriver_113.exe" um.

    Im Script wird dann die Version vom Webdriver und Chrome abgefragt.

    AutoIt
    $file = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    
    If FileExists($file) Then
    
        $google_chrome_version = FileGetVersion($file)
        $google_chrome_version_array = StringSplit($google_chrome_version,".")
    
        $webdriver = "chromedriver_" & $google_chrome_version_array[1] & ".exe"
    
        If Not FileExists(@ScriptDir & '\data\'& $webdriver) Then
            MsgBox(0,"Info","Google Chromedriver nicht vorhanden." & @CRLF & $webdriver)
            Exit
        EndIf
    Else
        MsgBox(0,"Info","Google Chrome in folgenden Pfad nicht vorhanden." & @CRLF & @CRLF & $file)
        Exit
    EndIf
    Alles anzeigen

    Gruß gmmg

  • Programm mit Adminrechte (UAC) restarten

    • gmmg
    • 24. April 2023 um 10:12

    Racer: Prima das es läuft

    Gruß gmmg

  • Programm mit Adminrechte (UAC) restarten

    • gmmg
    • 21. April 2023 um 15:21

    Racer:

    im englischen Forum gefunden: https://www.autoitscript.com/forum/topic/19…t-requireadmin/

    AutoIt
    MsgBox(0, "Test", "User is " & (IsAdmin() ? "" : "not ") & "Admin.")
    
    If Not IsAdmin() Then
        _RerunAsAdmin()
    Else
        MsgBox(0, "Is Admin?", "Yes, Admin.") ;Example.
    EndIf
    
    
    Func _RerunAsAdmin()
        Local $sParameters = ""
        If Not @Compiled Then
            $sParameters = '"' & @ScriptFullPath & '"'
        EndIf
    
        ShellExecute(@AutoItExe, $sParameters, "", "runas")
        If @error Then Return MsgBox(16 + 262144, "ERROR!", "Unable to elevate to Admin due to UAC.")
    
    EndFunc
    Alles anzeigen

    Beispiel GUI

    AutoIt
    #include <GUIConstantsEx.au3>
    
    GUICreate("AutoIt IsAdminTest", 220, 200)
    $Button_admin = GUICtrlCreateButton("admin", 10, 70, 50, 20)
    GUISetState(@SW_SHOW)
    
    MsgBox(0, "Test", "User is " & (IsAdmin() ? "" : "not ") & "Admin.")
    
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_admin
    
                _RerunAsAdmin()
                Exit
    
        EndSelect
    WEnd
    
    MsgBox(0, "Test", "User is " & (IsAdmin() ? "" : "not ") & "Admin.")
    
    If Not IsAdmin() Then
        _RerunAsAdmin()
    
    Else
        MsgBox(0, "Is Admin?", "Yes, Admin.") ;Example.
    EndIf
    
    
    Func _RerunAsAdmin()
        Local $sParameters = ""
        If Not @Compiled Then
            $sParameters = '"' & @ScriptFullPath & '"'
        EndIf
    
        ShellExecute(@AutoItExe, $sParameters, "", "runas")
        If @error Then Return MsgBox(16 + 262144, "ERROR!", "Unable to elevate to Admin due to UAC.")
    
    EndFunc
    Alles anzeigen

    Gruß gmmg

  • Programm mit Adminrechte (UAC) restarten

    • gmmg
    • 21. April 2023 um 11:13

    Racer: schau doch mal nach #RequireAdmin

    Ich hatte mal folgendes Script im Einsatz, um eine msi zu installieren. vielleicht kannst du damit was anfangen.

    AutoIt
    ;msi installer
    
    #RequireAdmin
    
    If Not IsAdmin() Then
        RunAs("****", @LogonDomain, "**********", 0, @ScriptFullPath, @ScriptDir, @SW_HIDE)
        Exit
    EndIf
    
    
    If IsAdmin() Then
         MsgBox(0, "", "Admin-Rechte erkannt.",1)
    EndIf
    
    MsgBox(0,"","Install beginnt",2)
    ;RunWait ('msiexec /i "C:\scripte\7z465.msi" /quiet', "" , @SW_HIDE)
    
    MsgBox(0,"","Install fertig",2)
    Alles anzeigen

    Gruß gmmg

  • AutoIt3.exe - Version 3.3.16.1 - Digitale Signatur nicht vorhanden ?

    • gmmg
    • 18. April 2023 um 13:38

    Ich glaube ich habe den Fehler gefunden. Es liegt am Antivierenprogramm, der blockt mir die AutoIt3.exe. Was komisch ist nur diese Version 3.3.16.1. Die AutoIt3_x64 wir auch nicht geblockt.

    Ist also erledigt :)

  • AutoIt3.exe - Version 3.3.16.1 - Digitale Signatur nicht vorhanden ?

    • gmmg
    • 18. April 2023 um 12:54

    Hallo Zusammen,

    ich habe das Phänomen, dass bei mir in der Autoit Version 3.3.16.1 die AutoIt3.exe kein Digitale Signatur anzeigt.

    In der 3.3.16.0 ist diese aber vorhanden. Habe die Versionsnummern mal an den Dateinamen angehangen.

    Ist das bei auch so?


    pasted-from-clipboard.png

    pasted-from-clipboard.png

    Gruß gmmg

    Dateien

    pasted-from-clipboard.png 14,75 kB – 0 Downloads
  • _Metro_CreateButton - Text zur Laufzeit ändern?

    • gmmg
    • 18. April 2023 um 07:32

    AutoBert hat mir im engl. Forum den Hinweis gegegen.

    Den Button mit GUICtrlDelete($File_Button) löschen und mit anderem Text erstellen.

    Gruß gmmg

  • _Metro_CreateButton - Text zur Laufzeit ändern?

    • gmmg
    • 17. April 2023 um 12:52

    Hallo Zusammen,

    für ein Projekt benutze ich die MetroGUI UDF.

    Hier gibt es leider keine Funktion um den Text eines Buttons zur Laufzeit zu ändern. Das GUICtrlSetData($Button, "text") geht nicht, da der Metro Button per GDIPlus erzeugt wird.

    $File_Button = _Metro_CreateButton("Screenshot oder Datei anfügen", 286, 605, 220, 25)

    Hier mal das Demo File. Die UDF selbst ist als Attachment angehangen.

    AutoIt
    ; ===============================================================================================================================
    ; Name ..........: MetroGUI UDF Example
    ; Version .......: v5.1
    ; Author ........: BB_19
    ; ===============================================================================================================================
    
    ;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling):
    #AutoIt3Wrapper_Run_Au3Stripper=y
    #Au3Stripper_Parameters=/so /rm /pe
    
    ;YOU NEED TO EXCLUDE FOLLOWING FUNCTIONS FROM AU3STRIPPER, OTHERWISE IT WON'T WORK:
    #Au3Stripper_Ignore_Funcs=_iHoverOn,_iHoverOff,_iFullscreenToggleBtn,_cHvr_CSCP_X64,_cHvr_CSCP_X86,_iControlDelete
    ;Please not that Au3Stripper will show errors. You can ignore them as long as you use the above Au3Stripper_Ignore_Funcs parameters.
    
    ;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling())
    #AutoIt3Wrapper_Res_HiDpi=y
    ; ===============================================================================================================================
    
    #NoTrayIcon
    #include "MetroGUI-UDF\MetroGUI_UDF.au3"
    #include "MetroGUI-UDF\_GUIDisable.au3" ; For dim effects when msgbox is displayed
    #include <GUIConstants.au3>
    
    ;=======================================================================Creating the GUI===============================================================================
    ;Enable high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp.
    _Metro_EnableHighDPIScaling() ; Note: Requries "#AutoIt3Wrapper_Res_HiDpi=y" for compiling. To see visible changes without compiling, you have to disable dpi scaling in compatibility settings of Autoit3.exe
    
    ;Set Theme
    _SetTheme("LightGreen");DarkTeal") ;See MetroThemes.au3 for selectable themes or to add more
    
    ;Create resizable Metro GUI
    $Form1 = _Metro_CreateGUI("Example", 500, 300, -1, -1, True)
    
    ;Add/create control buttons to the GUI
    $Control_Buttons = _Metro_AddControlButtons(True, True, True, True, True) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True
    
    ;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected.)
    $GUI_CLOSE_BUTTON = $Control_Buttons[0]
    $GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
    $GUI_RESTORE_BUTTON = $Control_Buttons[2]
    $GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
    $GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
    $GUI_FSRestore_BUTTON = $Control_Buttons[5]
    $GUI_MENU_BUTTON = $Control_Buttons[6]
    ;======================================================================================================================================================================
    
    ;Create  Buttons
    $Button1 = _Metro_CreateButton("Button Style 1", 50, 245, 115, 40)
    $Button2 = _Metro_CreateButtonEx("Button Style 2", 195, 245, 115, 40)
    $Button3 = _Metro_CreateButtonEx2("Button Style 3", 340, 245, 115, 40)
    
    ;Create Checkboxes
    $Checkbox1 = _Metro_CreateCheckbox("Checkbox 1", 30, 70, 125, 30)
    $Checkbox2 = _Metro_CreateCheckboxEx("Checkbox 2", 30, 107, 125, 30)
    $Checkbox3 = _Metro_CreateCheckboxEx2("Checkbox 3", 29, 142, 125, 30)
    ;Set status to checked
    _Metro_CheckboxCheck($Checkbox1, True)
    _Metro_CheckboxCheck($Checkbox2, True)
    _Metro_CheckboxCheck($Checkbox3, True)
    
    ;Create 3 Radios that are assigned to Radio Group 1
    $Radio1 = _Metro_CreateRadio("1", "Radio 1", 180, 70, 100, 30)
    $Radio2 = _Metro_CreateRadio("1", "Radio 2", 180, 110, 100, 30)
    $Radio3 = _Metro_CreateRadioEx("1", "Radio 3", 180, 150, 100, 30) ;Style with colored checkmark
    _Metro_RadioCheck("1", $Radio1) ;check $Radio1 which is assigned to radio group "1" and uncheck any other radio in group "1"
    
    ;Create Toggles
    $Toggle1 = _Metro_CreateToggle("Toggle 1", 320, 70, 130, 30)
    $Toggle2 = _Metro_CreateToggleEx("Toggle 2", 322, 107, 128, 30)
    $Toggle3 = _Metro_CreateOnOffToggle("Enabled", "Disabled", 320, 144, 130, 30) ; Creates a toggle with different texts for on/off. Alternatively you can use _Metro_CreateOnOffToggleEx for the secondary toggle style.
    
    ;Create Progressbar
    $Progress1 = _Metro_CreateProgress(100, 195, 300, 26)
    
    ;Set resizing options for the controls so they don't change in size or position. This can be customized to match your gui perfectly for resizing. See AutoIt Help file.
    GUICtrlSetResizing($Button1, 768 + 8)
    GUICtrlSetResizing($Button2, 768 + 8)
    GUICtrlSetResizing($Button3, 768 + 8)
    GUICtrlSetResizing($Checkbox1, 768 + 2 + 32)
    GUICtrlSetResizing($Checkbox2, 768 + 2 + 32)
    GUICtrlSetResizing($Checkbox3, 768 + 2 + 32)
    GUICtrlSetResizing($Radio1, 768 + 2 + 32)
    GUICtrlSetResizing($Radio2, 768 + 2 + 32)
    GUICtrlSetResizing($Radio3, 768 + 2 + 32)
    GUICtrlSetResizing($Toggle1, 768 + 2 + 32)
    GUICtrlSetResizing($Toggle2, 768 + 2 + 32)
    GUICtrlSetResizing($Toggle3, 768 + 2 + 32)
    GUICtrlSetResizing($Progress1[0], 768 + 2 + 32)
    GUISetState(@SW_SHOW)
    
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
                _Metro_GUIDelete($Form1) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs!
                Exit
            Case $GUI_MAXIMIZE_BUTTON
                GUISetState(@SW_MAXIMIZE, $Form1)
            Case $GUI_MINIMIZE_BUTTON
                GUISetState(@SW_MINIMIZE, $Form1)
            Case $GUI_RESTORE_BUTTON
                GUISetState(@SW_RESTORE, $Form1)
            Case $GUI_FULLSCREEN_BUTTON, $GUI_FSRestore_BUTTON
                ConsoleWrite("Fullscreen toggled" & @CRLF) ;Fullscreen toggle is processed automatically when $ControlBtnsAutoMode is set to true, otherwise you need to use here _Metro_FullscreenToggle($Form1)
            Case $GUI_MENU_BUTTON
                ;Create an Array containing menu button names
                Local $MenuButtonsArray[5] = ["Themes Demo", "Settings", "About", "Contact", "Exit"]
                ; Open the metro Menu. See decleration of $MenuButtonsArray above.
                Local $MenuSelect = _Metro_MenuStart($Form1, 150, $MenuButtonsArray)
                Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array.
                    Case "0"
                        ConsoleWrite("Returned 0 = Starting themes demo. Please note that the window border colors are not updated during this demo." & @CRLF)
                        _ThemesDemo()
                    Case "1"
                        ConsoleWrite("Returned 1 = Settings button clicked." & @CRLF)
                    Case "2"
                        ConsoleWrite("Returned 2 = About button clicked." & @CRLF)
                    Case "3"
                        ConsoleWrite("Returned 3 = Contact button clicked." & @CRLF)
                    Case "4"
                        ConsoleWrite("Returned 4 = Exit button clicked." & @CRLF)
                        _Metro_GUIDelete($Form1)
                        Exit
                EndSwitch
            Case $Button3
                _GUIDisable($Form1, 0, 30) ;For better visibility of the MsgBox on top of the first GUI.
                _Metro_MsgBox(0, "Metro MsgBox Example", "Try a rightclick on this button for rightclick menu demo.", 400, 11, $Form1) ; with 3 secs timeout
                _GUIDisable($Form1)
            Case $GUI_EVENT_SECONDARYDOWN ;Demo for starting rightclick menu
                Local $aCInfo = GUIGetCursorInfo($Form1)
                If $aCInfo[4] = $Button3 Then
                    ;Create an Array containing menu button names
                    Local $MenuButtonsArray[4] = ["Button 1", "Button 2", "Button 3", "Button 4"]
                    ; Open the rightclick Menu. See decleration of $MenuButtonsArray above.
                    Local $MenuSelect = _Metro_RightClickMenu($Form1, 300, $MenuButtonsArray)
                    Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array.
                        Case "0"
                            ConsoleWrite("Returned 0 = Button 1 clicked." & @CRLF)
                        Case "1"
                            ConsoleWrite("Returned 1 = Button 2 clicked." & @CRLF)
                        Case "2"
                            ConsoleWrite("Returned 2 = Button 3 clicked." & @CRLF)
                        Case "3"
                            ConsoleWrite("Returned 3 = Button 4 clicked." & @CRLF)
                    EndSwitch
                EndIf
            Case $Button2
                _GUIDisable($Form1, 0, 30) ;For better visibility of the MsgBox on top of the first GUI.
                _Metro_MsgBox(0, "Metro MsgBox Example", "Button 2 clicked. (Button with 3 secs timeout)", 400, 11, $Form1, 3) ; with 3 secs timeout
                _GUIDisable($Form1)
            Case $Button1
                _GUIDisable($Form1, 0, 30)
                Local $mInput = _Metro_InputBox("Please enter your name.", 11, "", False, True)
                If Not @error Then _Metro_MsgBox(0, "Metro MsgBox Example", "Hello " & $mInput & ", Press ok to set the progressbar.", 350, 11, $Form1)
                _GUIDisable($Form1)
                For $i = 0 To 85 Step +2
                    Sleep(1)
                    _Metro_SetProgress($Progress1, $i)
                Next
                _GUIDisable($Form1, 0, 30)
                Local $Select_YesNo = _Metro_MsgBox(4, "Metro MsgBox Example", "Select yes to create a second GUI.", 350, 11, $Form1)
                If $Select_YesNo = "Yes" Then _SecondGUI()
                _GUIDisable($Form1)
            Case $Toggle1
                If _Metro_ToggleIsChecked($Toggle1) Then
                    _Metro_ToggleUnCheck($Toggle1)
                    ConsoleWrite("Toggle unchecked!" & @CRLF)
                Else
                    _Metro_ToggleCheck($Toggle1)
                    ConsoleWrite("Toggle checked!" & @CRLF)
                EndIf
            Case $Toggle2
                If _Metro_ToggleIsChecked($Toggle2) Then
                    _Metro_ToggleUnCheck($Toggle2)
                    ConsoleWrite("Toggle unchecked!" & @CRLF)
                Else
                    _Metro_ToggleCheck($Toggle2)
                    ConsoleWrite("Toggle checked!" & @CRLF)
                EndIf
            Case $Toggle3
                If _Metro_ToggleIsChecked($Toggle3) Then
                    _Metro_ToggleUnCheck($Toggle3)
                    ConsoleWrite("Disabled!" & @CRLF)
                Else
                    _Metro_ToggleCheck($Toggle3)
                    ConsoleWrite("Enabled!" & @CRLF)
                EndIf
            Case $Checkbox1
                If _Metro_CheckboxIsChecked($Checkbox1) Then
                    _Metro_CheckboxUnCheck($Checkbox1)
                    ConsoleWrite("Checkbox unchecked!" & @CRLF)
                Else
                    _Metro_CheckboxCheck($Checkbox1)
                    ConsoleWrite("Checkbox checked!" & @CRLF)
                EndIf
            Case $Checkbox2
                If _Metro_CheckboxIsChecked($Checkbox2) Then
                    _Metro_CheckboxUnCheck($Checkbox2)
                    ConsoleWrite("Checkbox unchecked!" & @CRLF)
                Else
                    _Metro_CheckboxCheck($Checkbox2)
                    ConsoleWrite("Checkbox checked!" & @CRLF)
                EndIf
            Case $Checkbox3
                If _Metro_CheckboxIsChecked($Checkbox3) Then
                    _Metro_CheckboxUnCheck($Checkbox3)
                    ConsoleWrite("Checkbox unchecked!" & @CRLF)
                Else
                    _Metro_CheckboxCheck($Checkbox3)
                    ConsoleWrite("Checkbox checked!" & @CRLF)
                EndIf
            Case $Radio1
                _Metro_RadioCheck(1, $Radio1)
                ConsoleWrite("Radio 1 selected!" & @CRLF)
            Case $Radio2
                _Metro_RadioCheck(1, $Radio2)
                ConsoleWrite("Radio 2 selected = " & _Metro_RadioIsChecked(1, $Radio2) & @CRLF)
            Case $Radio3
                _Metro_RadioCheck(1, $Radio3)
                ConsoleWrite("Radio 3 (ExStyle) selected!" & @CRLF)
        EndSwitch
    WEnd
    
    
    Func _SecondGUI()
        Local $Form2 = _Metro_CreateGUI("Example2", 600, 400, -1, -1, True)
    
        ;Add control buttons
        Local $Control_Buttons_2 = _Metro_AddControlButtons(True, True, True, True)
        Local $GUI_CLOSE_BUTTON = $Control_Buttons_2[0]
        Local $GUI_MAXIMIZE_BUTTON = $Control_Buttons_2[1]
        Local $GUI_RESTORE_BUTTON = $Control_Buttons_2[2]
        Local $GUI_MINIMIZE_BUTTON = $Control_Buttons_2[3]
    
        Local $Button1 = _Metro_CreateButton("Close", 250, 340, 100, 40)
        GUICtrlSetResizing($Button1, 768 + 8)
        GUISetState(@SW_SHOW)
    
        While 1
            $nMsg = GUIGetMsg()
            Switch $nMsg
                Case $GUI_EVENT_CLOSE, $Button1, $GUI_CLOSE_BUTTON
                    _Metro_GUIDelete($Form2) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs!
                    Return 0
                Case $GUI_MAXIMIZE_BUTTON
                    GUISetState(@SW_MAXIMIZE, $Form2)
                Case $GUI_MINIMIZE_BUTTON
                    GUISetState(@SW_MINIMIZE, $Form2)
                Case $GUI_RESTORE_BUTTON
                    GUISetState(@SW_RESTORE, $Form2)
            EndSwitch
        WEnd
    EndFunc   ;==>_SecondGUI
    
    
    Func _ThemesDemo() ;Loop through all themes by recreating all controls
        Local $ThemesArray[25] = ["DarkMidnightTeal", "DarkMidnightBlue", "DarkMidnightCyan", "DarkMidnight", "DarkTeal", "DarkBlueV2", "DarkBlue", "DarkCyan", "DarkRuby", "DarkGray", "DarkGreen", "DarkGreenV2", "DarkPurple", "DarkAmber", "DarkOrange", "LightTeal", "LightGray", "LightBlue", "LightCyan", "LightGreen", "LightRed", "LightOrange", "LightPurple", "LightPink", "DarkTealV2"]
        For $i = 0 To 24
            GUISetState($Form1, @SW_LOCK)
            ConsoleWrite($ThemesArray[$i] & @CRLF)
            _SetTheme($ThemesArray[$i]) ;See MetroThemes.au3 for selectable themes or to add more
            GUICtrlDelete($Button1)
            GUICtrlDelete($Button2)
            GUICtrlDelete($Button3)
            GUICtrlDelete($Checkbox1)
            GUICtrlDelete($Checkbox2)
            GUICtrlDelete($Checkbox3)
            GUICtrlDelete($Radio1)
            GUICtrlDelete($Radio2)
            GUICtrlDelete($Radio3)
            GUICtrlDelete($Toggle1)
            GUICtrlDelete($Toggle2)
            GUICtrlDelete($Toggle3)
            GUICtrlDelete($Progress1[0])
            GUICtrlDelete($GUI_CLOSE_BUTTON)
            GUICtrlDelete($GUI_MAXIMIZE_BUTTON)
            GUICtrlDelete($GUI_RESTORE_BUTTON)
            GUICtrlDelete($GUI_MINIMIZE_BUTTON)
            GUICtrlDelete($GUI_FULLSCREEN_BUTTON)
            GUICtrlDelete($GUI_FSRestore_BUTTON)
            GUICtrlDelete($GUI_MENU_BUTTON)
            GUISetBkColor($GUIThemeColor, $Form1)
            $Control_Buttons = _Metro_AddControlButtons(True, True, True, True, True)
            $GUI_CLOSE_BUTTON = $Control_Buttons[0]
            $GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
            $GUI_RESTORE_BUTTON = $Control_Buttons[2]
            $GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
            $GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
            $GUI_FSRestore_BUTTON = $Control_Buttons[5]
            $GUI_MENU_BUTTON = $Control_Buttons[6]
            $Button1 = _Metro_CreateButton("Button Style 1", 50, 245, 115, 40)
            $Button2 = _Metro_CreateButtonEx("Button Style 2", 195, 245, 115, 40)
            $Button3 = _Metro_CreateButtonEx2("Button Style 3", 340, 245, 115, 40)
            $Checkbox1 = _Metro_CreateCheckbox("Checkbox 1", 30, 70, 125, 30)
            $Checkbox2 = _Metro_CreateCheckboxEx("Checkbox 2", 30, 107, 125, 30)
            $Checkbox3 = _Metro_CreateCheckboxEx2("Checkbox 3", 29, 142, 125, 30)
            _Metro_CheckboxCheck($Checkbox1, True)
            _Metro_CheckboxCheck($Checkbox2, True)
            _Metro_CheckboxCheck($Checkbox3, True)
            $Radio1 = _Metro_CreateRadio("1", "Radio 1", 180, 70, 100, 30)
            $Radio2 = _Metro_CreateRadio("1", "Radio 2", 180, 110, 100, 30)
            $Radio3 = _Metro_CreateRadioEx("1", "Radio 3", 180, 150, 100, 30)
            _Metro_RadioCheck("1", $Radio1)
            $Toggle1 = _Metro_CreateToggle("Toggle 1", 320, 70, 130, 30)
            $Toggle2 = _Metro_CreateToggleEx("Toggle 2", 322, 107, 128, 30)
            $Toggle3 = _Metro_CreateOnOffToggle("Enabled", "Disabled", 320, 144, 130, 30)
            $Progress1 = _Metro_CreateProgress(100, 195, 300, 26)
            GUICtrlSetResizing($Button1, 768 + 8)
            GUICtrlSetResizing($Button2, 768 + 8)
            GUICtrlSetResizing($Button3, 768 + 8)
            GUICtrlSetResizing($Checkbox1, 768 + 2 + 32)
            GUICtrlSetResizing($Checkbox2, 768 + 2 + 32)
            GUICtrlSetResizing($Checkbox3, 768 + 2 + 32)
            GUICtrlSetResizing($Radio1, 768 + 2 + 32)
            GUICtrlSetResizing($Radio2, 768 + 2 + 32)
            GUICtrlSetResizing($Radio3, 768 + 2 + 32)
            GUICtrlSetResizing($Toggle1, 768 + 2 + 32)
            GUICtrlSetResizing($Toggle2, 768 + 2 + 32)
            GUICtrlSetResizing($Toggle3, 768 + 2 + 32)
            GUICtrlSetResizing($Progress1[0], 768 + 2 + 32)
            GUISetState($Form1, @SW_UNLOCK)
            Sleep(1500)
        Next
    EndFunc   ;==>_ThemesDemo
    Alles anzeigen

    Hat da einer von Euch eine Idee?

    Gruß gmmg

    Dateien

    MetroUDF-v5.1.zip 45,76 kB – 288 Downloads
  • MailBody in einer Schleife aus Array zusammenfügen

    • gmmg
    • 3. April 2023 um 15:14

    @Schnuffel: Danke funktioniert prima. Hab das nur noch etwas angepasst. Da das Array einen "0" Wert hat, wenn weniger als 4 Felder erzeugt werden, musste ich diese noch anfangen.

    AutoIt
            $date = _Now()
            $sp = "-----------------------------------------"
    
            $mbody = @CRLF & $sp & @CRLF & "gesendet am: " & $date & @CRLF & $sp & @CRLF & _
                    "von: " & $user & " " & $mail_txt & @CRLF & $sp & @CRLF & _
                    "Client: " & $computer & @CRLF & $sp & @CRLF & _
                    "System: " & $DataArray[0][0] & @CRLF & $sp & @CRLF & _
                    "Fehlerauswahl: " & $DataArray[1][0] & @CRLF ;& $sp & @CRLF
    
                For $i = 2 To UBound($DataArray) -1
                    ;$mbody &= $DataArray[$i][0] & ": " & $DataArray[$i][1] & @CRLF & $sp & @CRLF
    
                    If $DataArray[$i][0] = "0" Then
                        
                    Else
                        $mbody &= $sp & @CRLF & $DataArray[$i][0] & ": " & $DataArray[$i][1] & @CRLF
                    EndIf
    
                 Next
                $mbody &= $sp & @CRLF
    Alles anzeigen

    Gruß gmmg

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™