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

Beiträge von funkey

  • MsgBox hooken und Countdown hinzufügen

    • funkey
    • 28. April 2023 um 11:33

    Hab da wohl zu wenig getestet...

    Sollte jetzt funktionieren, hab's oben geändert.

    Und jetzt auch mit den Standard-Button-Texten, also ohne SetButtonNames().

  • MsgBox hooken und Countdown hinzufügen

    • funkey
    • 27. April 2023 um 13:23

    Hallo,

    hab das mal in meine HookDlgBox-UDF eingebaut.

    HookDlgBox.au3
    AutoIt
    #include-once
    #include <winapi.au3>
    #include <timers.au3>
    
    Global Const $tagCBT_CREATEWND = "ptr lpcs;HWND tagCBT_CREATEWND"
    Global Const $tagCREATESTRUCT = "ptr lpCreateParams;handle hInstance;HWND hMenu;HWND hwndParent;int cy;int cx;int y;int x;LONG style;ptr lpszName;ptr lpszClass;DWORD dwExStyle"
    
    Global $g__hProcDlgBox = DllCallbackRegister("__DlgBox_CbtHookProc", "LRESULT", "int;WPARAM;LPARAM")
    Global $g__TIdDlgBox = _WinAPI_GetCurrentThreadId()
    Global $g__hHookDlgBox = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($g__hProcDlgBox), 0, $g__TIdDlgBox)
    
    Global Const $g__MaxDlgBtns = 5 ; maximum of 5 buttons to rename text
    Global Const $g__MaxDlgItemId = 11 ; maximun ID of buttons to search is 11 as this is the maximun used in Messagebox
    
    Global $g__DlgBoxPosX, $g__DlgBoxPosY, $g__DlgBoxWidth, $g__DlgBoxHeight
    Global $g__aDlgBoxBtnText[$g__MaxDlgBtns]
    
    Global $g__DlgBtnCount = 0
    Global $g_DlgBoxTimeout = 0
    Global $g_DlgBoxTimeCtrlNum, $g_DlgBoxTimeCtrlId
    Global $g_DlgBoxTimerId
    
    _DlgBox_SetDefaults()
    
    OnAutoItExitRegister("__DlgBox_UnregisterHook")
    
    
    Func _DlgBox_SetButtonNames($TxtBtn1 = Default, $TxtBtn2 = Default, $TxtBtn3 = Default, $TxtBtn4 = Default, $TxtBtn5 = Default)
        $g__aDlgBoxBtnText[0] = $TxtBtn1
        $g__aDlgBoxBtnText[1] = $TxtBtn2
        $g__aDlgBoxBtnText[2] = $TxtBtn3
        $g__aDlgBoxBtnText[3] = $TxtBtn4
        $g__aDlgBoxBtnText[4] = $TxtBtn5
    
        $g__DlgBtnCount = @NumParams
    EndFunc   ;==>_DlgBox_SetButtonNames
    
    Func _DlgBox_SetPosition($x = Default, $y = Default) ;only for MsgBox, not working and not needed for InputBox
        $g__DlgBoxPosX = $x
        $g__DlgBoxPosY = $y
    EndFunc   ;==>_DlgBox_SetPosition
    
    Func _DlgBox_SetSize($w = Default, $h = Default)
        $g__DlgBoxWidth = $w
        $g__DlgBoxHeight = $h
    EndFunc   ;==>_DlgBox_SetSize
    
    Func _DlgBox_SetDefaults()
        $g__DlgBoxPosX = Default
        $g__DlgBoxPosY = Default
        $g__DlgBoxWidth = Default
        $g__DlgBoxHeight = Default
        For $i = 0 To UBound($g__aDlgBoxBtnText) - 1
            $g__aDlgBoxBtnText[$i] = Default
        Next
        $g_DlgBoxTimeout = 0
    EndFunc   ;==>_DlgBox_SetDefaults
    
    Func _DlgBox_SetTimeout($iTimeout = 0, $CtrlId = 1)
        $g_DlgBoxTimeout = $iTimeout
        $g_DlgBoxTimeCtrlNum = $CtrlId
    EndFunc   ;==>_DlgBox_SetTimeout
    
    Func __DlgBox_CbtHookProc($nCode, $wParam, $lParam)
        Local $tcw, $tcs
        Local $iSearch = 0
        Local $ahBtn[$g__DlgBtnCount]
        If $nCode < 0 Then
            Return _WinAPI_CallNextHookEx($g__hHookDlgBox, $nCode, $wParam, $lParam)
        EndIf
    
        Switch $nCode
            Case 3 ;5=HCBT_CREATEWND
                If _WinAPI_GetClassName(HWnd($wParam)) = "#32770" Then ;Dialog window class
                    $tcw = DllStructCreate($tagCBT_CREATEWND, $lParam)
                    $tcs = DllStructCreate($tagCREATESTRUCT, DllStructGetData($tcw, "lpcs"))
    
                    If $g__DlgBoxPosX <> Default Then DllStructSetData($tcs, "x", $g__DlgBoxPosX)
                    If $g__DlgBoxPosY <> Default Then DllStructSetData($tcs, "y", $g__DlgBoxPosY)
                    If $g__DlgBoxWidth <> Default Then DllStructSetData($tcs, "cx", $g__DlgBoxWidth)
                    If $g__DlgBoxHeight <> Default Then DllStructSetData($tcs, "cy", $g__DlgBoxHeight)
    
                    If $g_DlgBoxTimeout <> 0 Then
                        $g_DlgBoxTimerId = _Timer_SetTimer(HWnd($wParam), 1000, "_UpdateTime")
                    EndIf
                EndIf
            Case 5 ;5=HCBT_ACTIVATE
                If _WinAPI_GetClassName(HWnd($wParam)) = "#32770" Then ;Dialog window class
                    For $i = 1 To $g__MaxDlgItemId
    ;~                     ConsoleWrite($i & " - " & $iSearch & " - " & _WinAPI_GetDlgItemText($wParam, $i) & @CRLF)
                        If IsHWnd(_WinAPI_GetDlgItem($wParam, $i)) Then
                            If $g_DlgBoxTimeout > 0 Then
                                If $g__aDlgBoxBtnText[$iSearch] = Default Then $g__aDlgBoxBtnText[$iSearch] = _WinAPI_GetDlgItemText($wParam, $i)
                                If $iSearch == $g_DlgBoxTimeCtrlNum - 1 Then
                                    $g_DlgBoxTimeCtrlId = $i
                                    If $g__aDlgBoxBtnText[$iSearch] <> Default Then _WinAPI_SetDlgItemText($wParam, $i, $g__aDlgBoxBtnText[$iSearch] & " [" & $g_DlgBoxTimeout & "]")
                                Else
                                    If $g__aDlgBoxBtnText[$iSearch] <> Default Then _WinAPI_SetDlgItemText($wParam, $i, $g__aDlgBoxBtnText[$iSearch])
                                EndIf
                            Else
                                If $g__aDlgBoxBtnText[$iSearch] <> Default Then _WinAPI_SetDlgItemText($wParam, $i, $g__aDlgBoxBtnText[$iSearch])
                            EndIf
    
                            $iSearch += 1
                            ;Vorzeitiges Abbrechen der Schleife deaktiviert
    ;~                         If $iSearch >= UBound($ahBtn) Then ExitLoop
                        EndIf
                    Next
                EndIf
                ;Bugfix: OK-Button wechselt von ID1 nach ID2 wenn er alleine angezeigt wird!???
                If $iSearch = 1 And $g_DlgBoxTimeCtrlId = 1 Then $g_DlgBoxTimeCtrlId = 2
            Case 4 ;4=HCBT_DESTROYWND
                If _WinAPI_GetClassName(HWnd($wParam)) = "#32770" Then ;Dialog window class
                    _Timer_KillTimer(HWnd($wParam), $g_DlgBoxTimerId)
                    $g_DlgBoxTimeout = 0
                EndIf
        EndSwitch
        Return _WinAPI_CallNextHookEx($g__hHookDlgBox, $nCode, $wParam, $lParam)
    EndFunc   ;==>__DlgBox_CbtHookProc
    
    Func _UpdateTime($hWnd, $iMsg, $iIDTimer, $iTime)
        #forceref $hWnd, $iMsg, $iIDTimer, $iTime
        $g_DlgBoxTimeout -= 1
        _WinAPI_SetDlgItemText($hWnd, $g_DlgBoxTimeCtrlId, $g__aDlgBoxBtnText[$g_DlgBoxTimeCtrlNum - 1] & " [" & $g_DlgBoxTimeout & "]")
        If $g_DlgBoxTimeout <= 0 Then
            WinClose($hWnd)
        EndIf
    EndFunc   ;==>_UpdateTime
    
    Func __DlgBox_UnregisterHook()
        _WinAPI_UnhookWindowsHookEx($g__hHookDlgBox)
        DllCallbackFree($g__hProcDlgBox)
    EndFunc   ;==>__DlgBox_UnregisterHook
    
    Func _WinAPI_SetDlgItemText($hDlg, $nIDDlgItem, $lpString)
        Local $aRet = DllCall('user32.dll', "int", "SetDlgItemText", _
                "hwnd", $hDlg, _
                "int", $nIDDlgItem, _
                "str", $lpString)
        Return $aRet[0]
    EndFunc   ;==>_WinAPI_SetDlgItemText
    
    Func _WinAPI_GetDlgItemText($hDlg, $nIDDlgItem)
        Local $aRet = DllCall('user32.dll', "uint", "GetDlgItemTextW", _
                "hwnd", $hDlg, _
                "int", $nIDDlgItem, _
                "wstr", "", _
                "int", 1000)
        Return $aRet[3]
    EndFunc   ;==>_WinAPI_GetDlgItemText
    </timers.au3></winapi.au3>
    Alles anzeigen
    HookDlgBox Timeout Beispiel
    AutoIt
    #include "HookDlgBox.au3"
    
    Global $Timeout = 5
    
    _DlgBox_SetTimeOut($Timeout, 1)
    _DlgBox_SetButtonNames("one", "two", "three")
    
    Global $iRet1 = MsgBox(3, "Test 1", "Custom button texts", $Timeout)
    ConsoleWrite($iRet1 & @CRLF)
    
    
    Global $iRet2 = MsgBox(3, "Test 2", "Custom button texts", $Timeout)
    ConsoleWrite($iRet2 & @CRLF)
    
    _DlgBox_SetTimeOut($Timeout, 2)
    
    Global $iRet3 = MsgBox(3, "Test 3", "Custom button texts")
    ConsoleWrite($iRet3 & @CRLF)
    
    _DlgBox_SetTimeOut($Timeout, 3)
    
    Global $iRet4 = MsgBox(3, "Test 4", "Custom button texts")
    ConsoleWrite($iRet4 & @CRLF)
    Alles anzeigen
  • Buttonfarbe ändern ... und wieder zurück

    • funkey
    • 4. April 2023 um 07:01

    GUICtrlSetStyle(-1, $GUI_SS_DEFAULT_BUTTON)

  • nächste Quadratzahl

    • funkey
    • 22. März 2023 um 22:39

    Soll bei 81 (also genaue Quadratzahl) jetzt 9 oder 10 herauskommen?

  • ControlSend an Textfeld

    • funkey
    • 28. Dezember 2022 um 22:34

    WinWait oder WinWaitActive

    Edit: zu spät

  • ControlSend an Textfeld

    • funkey
    • 28. Dezember 2022 um 22:15
    Zitat von Schleifchen

    die Zeichen !x und # werden aus dem String entfernt, wo ist der Grund zu finden? Hat das was mit dem Zeichensatz zu tun?

    Schau dir mal den Parameter 'flag' von Send() an.

  • Controlsend in PuTTY für WOL

    • funkey
    • 23. Dezember 2022 um 13:21

    Es gibt doch auch einiges dazu im englischen Forum: z.B: Wake on LAN UDF - AutoIt Example Scripts - AutoIt Forums (autoitscript.com)

  • GUI mit festen Werten je nach Dateiname

    • funkey
    • 13. Juli 2022 um 13:41

    Ich würde mir eine (oder mehrere) Ini-Datei(en) erstellen mit den Größen/Positionen der Gui/Controls. Das Auslesen des Skriptnamens ist ja kein Problem und dann entweder die passende Sektion in der Ini-Datei laden oder die jeweilige Ini-Datei für die Größe.

  • Inputwert eingrenzen neg. & pos. Werte

    • funkey
    • 12. Juli 2022 um 08:28

    Hier noch sowas wie die Luxus-Variante mit Code-Teilen aus der RestrictControlRegExp-UDF von peethebee.

    AutoIt
    #include <GUIConstantsEx.au3>
    #include <GuiConstants.au3>
    
    Opt("GUIOnEventMode", 1)
    
    Global $iMin = -750, $iMax = 750
    Global $iBetweenMin = -250, $iBetweenMax = 250
    
    Global $hGui = GUICreate("", 121, 61)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_raus")
    Global $idInput = GUICtrlCreateInput("500", 72, 8, 41, 28)
    GUICtrlSetOnEvent(-1, "_InputPruefen") ; ruft bei Änderungen die angegebene Funktion auf
    GUIRegisterMsg($WM_COMMAND, "_CheckInput")
    GUICtrlCreateLabel("Input: ", 8, 8, 61, 32)
    GUISetState(@SW_SHOW)
    
    ; Endlosschleife um GUI am Leben zu erhalten
    While Sleep(100)
    WEnd
    
    Func _CheckInput($hWnd, $msg, $wParam, $lParam)
        Local Static $oldValue = 0
        Local $_re_rc_regex_res
        Local $nNotifyCode = _HiWord($wParam)
        Local $nID = _LoWord($wParam)
        Local $sText, $iText
        If $nID = $idInput And $nNotifyCode = $EN_CHANGE Then
            $sText = GUICtrlRead($nID)
            For $i = 0 To StringLen($iMin)
                $_re_rc_regex_res = 1
                If StringRegExp($sText & StringTrimLeft($iMin, $i), "^-{0,1}\d{1,3}$") Then ExitLoop    ;3 -stellige Zahlen mit Vorzeichen zulassen
                $_re_rc_regex_res = 0
            Next
            $iText = Number($sText)
            If $_re_rc_regex_res = 1 Then
                If $iText < $iMin Then
                    GUICtrlSetData($nID, $iMin)
                    $oldValue = $iMin
                    GUICtrlSetBkColor($nID, Default)
                ElseIf $iText > $iMax Then
                    GUICtrlSetData($nID, $iMax)
                    $oldValue = $iMax
                    GUICtrlSetBkColor($nID, Default)
                ElseIf $iText > $iBetweenMin And $iText < $iBetweenMax Then
                    GUICtrlSetBkColor($nID, 0xFF0000)
                    $oldValue = $iText
                Else
                    GUICtrlSetBkColor($nID, Default)
                    $oldValue = $iText
                EndIf
            Else
                GUICtrlSetData($nID, $oldValue)
            EndIf
        EndIf
    
    
    EndFunc
    
    Func _InputPruefen()
        Local $iVal = Int(GUICtrlRead(@GUI_CtrlId))    ; der aktuelle Wert des Input-Feldes
    
        If Abs($iVal) < $iBetweenMax Then
            MsgBox(48, "Falsche Eingabe", "Wert außerhalb des Wertebereiches")
        EndIf
    EndFunc
    
    Func _raus()
        Exit
    EndFunc
    
    ; helping function by gafrost
    Func _HiWord($x)
        Return BitShift($x, 16)
    EndFunc   ;==>_HiWord
    
    ; helping function by gafrost
    Func _LoWord($x)
        Return BitAND($x, 0xFFFF)
    EndFunc   ;==>_LoWord
    Alles anzeigen
  • Tab ohne Hintergrundfarbe

    • funkey
    • 11. Juli 2022 um 08:11

    Hallo,

    mit meiner OwnTab-UDF kann man das lösen, wenn man will. Mit dem Standard-Control wird es auch irgendwie gehen, aber sicherlich mit mehr Aufwand.

    Spoiler anzeigen
    AutoIt
    #Region    ;************ Includes ************
    #include <GuiConstantsEx.au3>
    #include "OwnTab.au3"
    #EndRegion ;************ Includes ************
    
    ; Tab colours
    Global $aTabColours[4] = [0xFFC0C0, 0xC0FFC0, 0xC0C0FF, 0xC0C0C0]
    Local $aTabText[4] = ["Settings", "Register", "Test", "Status"] ;Declare the regions for the OwnTab-control
    
    ; Create GUI
    Global $hGUI = GUICreate("Test", 400, 300)
    
    ; Create tab
    Global $hTab = _OwnTab_Create($hGui, $aTabText, 5, 5, 390, 260, 30, -1, -1, $aTabColours[0])
    
    For $i = 1 To UBound($aTabColours)
        _OwnTab_Add($hTab) ;Start controls tab1
        _OwnTab_SetAlarm($hTab, $i, $aTabColours[$i - 1])
        $aOwnTabAlarm[$i][2] = $aTabColours[$i - 1]
    Next
    
    _OwnTab_End($hTab)
    _OwnTab_AlarmBlink(0, 0, 0, 0)
    
    GUISetState()
    
    Global $msg
    
    While 1
        $msg = GUIGetMsg()
        For $a = 1 To UBound($hTab, 1) - 1
            If $msg = $hTab[$a][0] Then
                _OwnTab_Switch($hTab, $a)
                GUICtrlSetBkColor($hTab[UBound($aTabText)][6] + 4, $aTabColours[$a - 1])
            EndIf
        Next
        If $msg = $GUI_EVENT_CLOSE Then Exit
    WEnd
    Alles anzeigen

    Oder habe ich die Frage falsch verstanden?

    Dateien

    OwnTab.au3 19,5 kB – 408 Downloads
  • Email empfang

    • funkey
    • 5. Juli 2022 um 14:48

    FAQ: Was ist der Unterschied zwischen SMTP, IMAP und POP3? - EICK.IT GmbH (eickit.de)

  • Email empfang

    • funkey
    • 5. Juli 2022 um 14:25

    Welches Postfach?

    Such mal nach IMAP, vllt hilft das.

  • Variable nach einem String benennen $($string)

    • funkey
    • 22. Juni 2022 um 16:05
    C
    #include <GUIConstantsEx.au3>
    #include <StringConstants.au3>
    
    
    Global Enum $AA, $BB, $CC
    
    Global $funktioniert = "Es|hat|funktioniert"
    Global $arrfunktioniert = StringSplit($funktioniert, "|", $STR_NOCOUNT)
    Global $aBtn[UBound($arrfunktioniert)]
    
    Global $hGui = GUICreate("Test", 400, 400)
    
    For $i = 0 To UBound($arrfunktioniert) -1
        $aBtn[$i] = GUICtrlCreateButton($arrfunktioniert[$i], 10, 10 + $i * 35, 100, 30)
    Next
    
    GUISetState(@SW_SHOW)
    
    Global $iMsg
    
    
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $aBtn[$AA]
                MsgBox(16, "", "$AA pressed - " & $arrfunktioniert[$AA])
            Case $aBtn[$BB]
                MsgBox(16, "", "$BB pressed - " & $arrfunktioniert[$BB])
            Case $aBtn[$CC]
                MsgBox(16, "", "$CC pressed - " & $arrfunktioniert[$CC])
        EndSwitch
    WEnd
    Alles anzeigen

    Ist es so gemeint? Würde ich aber auch nicht machen.

  • ArrayPlus-UDF - weitere Helferlein für den täglichen Umgang mit Arrays

    • funkey
    • 22. Juni 2022 um 14:11

    Gefällt mir sehr gut, danke! Ist sicher einmal nützlich.

  • HotKeySet 5 Numlock off

    • funkey
    • 7. Juni 2022 um 22:54
    How Can I Set a HotKeySet for NumPad5, When NumLock is Not On?
    I hope anyone knows.. Thank you Zohar
    www.autoitscript.com
    Code
    #include <Hotkey.au3>
    
    Global Const $VK_CLEAR = 0x0C
    
    HotKeySet ( "{numpad5}" , "_num_5_" )
    _HotKey_Assign($VK_CLEAR, '_num_5_')
    
    While 1
        Sleep(20)
    WEnd
    
    Func _num_5_()
        ConsoleWrite("5" & @CRLF)
        Exit
    EndFunc
    Alles anzeigen
  • Login auf USV / Vorlage in anderer Sprache vorhanden

    • funkey
    • 28. April 2022 um 05:53

    Da musst du einfach probieren, wie es funktioniert.

    Hier eine Vorlage

    Code
    TCPStartup()
    
    Global $iSock = TCPConnect(TCPNameToIP ("192.168.x.x:"), 3052)
    
    Global $Packet = "GET /local/rest/v1/ups/status HTTP/1.1" & @CRLF & _
    "Authorization: <BEARER-TOKEN-COPIED-EARLIER>" & @CRLF & _
    "Accept: application/json" & @CRLF & @CRLF
    
    TCPSend($iSock, $Packet)
    Global $sRecv = TCPRecv($iSock, 1024)
    TCPCloseSocket($iSock)
    
    ConsoleWrite($sRecv & @CRLF)
    Alles anzeigen
  • WebP v0.5.0 build 2025-08-23 beta

    • funkey
    • 20. April 2022 um 13:18

    Hallo! Super!

    Mich hat das Thema gestern auch interessiert.

    Hab dazu folgendes Projekt gefunden: WebP-Wrapper

    Das ist ein C#-Projekt mit Wrapper auch x86 und x64 DLLs. Dafür hätte ich bei übriger Zeit eine UDF erstellt.

    Brauche ich wohl jetzt nicht mehr.

    Schöne Grüße

  • Wie ein Passwort aus Roboform bei einer rdp-Verbindung eingeben?

    • funkey
    • 15. April 2022 um 08:29

    Hallo,

    deine Anfrage wurde im englischen Forum bereits abgelehnt und der Thread geschlossen.

    How to click on a Roboform "button"
    Hi everyone! So, when I call an rdp file that starts my tool on the terminal server from AutoIt, the I need to enter the password, cause our IT guy apparently…
    www.autoitscript.com

    Meine IT-Abteilung würde auch nicht wollen, dass ich das Passwort irgendwo abspeichere um mich automatisch einzuloggen.

    Schöne Grüße.

  • Frage an die Netzwerker: Verbindung begrenzen auf ein anderes Gerät

    • funkey
    • 17. Dezember 2021 um 09:31

    Bin kein Netzwerker, aber mit den Firewall-Einstellungen sollte es möglich sein

    IP-Bereiche ausschliessen - so gehts! - pctipp.ch

  • Audio-Programmierung mit DirectX

    • funkey
    • 8. Dezember 2021 um 13:45

    Die BASS-UDF könnte weiterhelfen. Bass.dll UDF Version_10 Download


    Edit: Zu spät :(

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™