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

Beiträge von Velted

  • sortieren nach IP

    • Velted
    • 12. Juli 2024 um 12:52
    Zitat von BugFix

    Das ist mir jetzt unklar. Was meinst du mit Speicherort?

    Die sogenannte 'Control-ID' (ListView-Einträge sind nunmal keine Controls) wird im Feld lParam der LVITEM Struktur abgelegt, die dem Eintrag zugeordnet ist. Dieses Feld kann aus Sicht des ListView-Controls mit beliebigen Informationen belegt sein. In AutoIt sollte man sich aber hüten, den Inhalt zu verändern. Die interne Verbindung von ListViewItem und ListView ginge dann wohl verloren.

    casi4712, ich möchte mich auch für die Offtopic-Nutzung Deines Beitrags entschuldigen. Das sollte sich jetzt auch erledigt haben.

  • sortieren nach IP

    • Velted
    • 12. Juli 2024 um 11:42
    Zitat von BugFix

    Wer hat dir denn diesen Bären aufgebunden?

    Moin,

    das war ich selbst. Ich vergesse immer wieder, dass AutoIt die ListView-Einträge wie eigenständige Controls behandelt. Danke für den Hinweis.

    Der Klick auf eine Zeile wird also tatsächlich signalisiert. Im OnEvent-Mode muss man aber jedem betroffenen 'Listvieweintragscontrol' eine eine Eventfunktion zugewiesen haben. Geliefert wird dann die Control-ID des Eintrags in @GUI_CtrlId. Die kann man in GUICtrlRead() benutzen, um den Inhalt der Zeile auszulesen. So weit, so gut.

    Leider hat das eigentliche ListView-Control von alldem keine Ahnung. AutoIt speichert zwar die Control-ID im Eintrag, der Speicherort hat aber für das ListView-Control keine besondere Bedeutung. Wenn man den Index des Eintrags auslesen will, den man für die 'normale' Bearbeitung der ListVieweinträge braucht, muss man den 'per Hand' ermitteln, z.B. mit _GUICtrlListView_FindParam().

    Zitat von BugFix

    Listview sind die am effektivsten verwertbaren Control überhaupt.

    Ich würde sagen, sie sind ebensogut verwertbar wie die anderen Controls, wenn man die zugehörigen UDFs einsetzt.

    Für das, was casi4712 vorhaben mag, sollte es in jedem fall reichen.

  • sortieren nach IP

    • Velted
    • 11. Juli 2024 um 13:59

    Moin casi4712,

    je intensiver ich mich mit deisem Beitrag beschäftige, als desto dürftiger entpuppen sich die Möglichkeiten, die AutoIt als native Funktionen anbietet, um auf Inhalte eines ListView-Controls zuzugreifen.

    ListViews gehören zu den 'geschwätzigsten' Controls. Sie neigen dazu, das Elternfenster mit Nachrichten zu 'fluten'. Nun stellt sich heraus, dass AutoIt sich von all den vielen Nachrichten genau eine herausgreift, die dem Skript gemeldet wird: Den Klick auf eine Spaltenüberschrift im Header! Alles, was mit Klicks im ListView-Bereich zu tun hat, wird schnöde unter den Tisch gekehrt. Das gilt sowohl für den GetMsg- als auch für den OnEvent-Modus. Wenn Du also per GUIGetMsg() oder EventFunc() eine Nachricht vom ListView erhältst, kannst Du Dir sicher sein, dass der Benutzer sich gerade mit dem Header beschäftigt. Ich bin erschüttert.

    Du hast nun das einzige 'Event' dafür verbraucht, die Spaltensortierungzu unterstützen. Mehr ist ohne 'Verrenkungen' auch nicht möglich. Was soll denn der Spaltenklick sonst noch auslösen?

  • Frage zu seltsamen Verhalten von _WinAPI_CopyFileEx

    • Velted
    • 17. Mai 2024 um 17:50

    Moin, in der Beschreibung zu Volatile steht:

    Zitat

    Callback Funktion: Während der Ausführung der Funktion wird die Nachrichtenverarbeitung des Skripts nicht blockiert, wie es normalerweise für nicht-volatile Funktionen erfolgt.

    Die Funktion wird damit "von einer Art Schutzschicht" befreit.

    Wenn Du versuchst, das Progressfenster zu bewegen, werden entsprechende Nachrichten an das Skript gesendet. Windows wartet standardmäßig etwa 5 Sekunden darauf, dass diese Nachrichten verarbeitet werden. Das geschieht offenbar nicht rechtzeitig, weil die laufende Callbackfunktion die Nachrichtenbearbeitung verhindert. Nach Ablauf der 5 Sekunden erstellt Windows ein Geisterfenster (eine Bitmap des Fensters mit dem Zusatz "Not Responding") als Ersatz für das nicht reagierende Fenster. Dieses Fenster kann bewegt werden, tut aber sonst nichts.

    Ergänzende Erläuterungen findest Du hier: IsHungAppWindow function

    Man kann das anscheinend auch für den laufenden Prozess abschalten, siehe DisableProcessWindowsGhosting()

  • Ordnerverzeichnis auslesen und in Array speichern, anschließendes weiterverarbeiten

    • Velted
    • 15. Mai 2024 um 10:47

    Moin,

    Firefox/CommandLineOptions

    Für beide beschriebenen Formen von -CreateProfile steht da, "... the profile_name must not contain spaces ( )" bzw. "... (as with the previous syntax, profile_name must not contain spaces)".

    Der Versuch, einen Ordnernamen anzuhängen, mag deshalb erfolglos bleiben.

  • Ordnerverzeichnis auslesen und in Array speichern, anschließendes weiterverarbeiten

    • Velted
    • 12. Mai 2024 um 10:06

    Moin,

    ich weiß nicht so recht, was Du erreichen willst. Wie ich es verstehe, soll das Skript im Profilmanager nacheinander alle vorhandenen Profile auswählen. Ist es das, was Du willst?


    AutoIt
        ; Alle Einträge kopieren, beginnend beim Startindex
        For $i = $startIndex To UBound($dirList) - 1
            ClipPut($dirList[$i])
            Send("^v")
            MouseClick("left", 1089, 722)
            $startIndex = $i + 1 ; Aktualisieren des Startindex für den nächsten Durchlauf
        Next

    Diese Schleife wird mit maximaler Geschwindigkeit ausgeführt und soll nacheinander alle vorhandenen Verzeichnisnamen in den Profilmanager kopieren. AutoIt wartet nach dem Send("^v") nicht, und der Profilmanager braucht Zeit, um die Daten aus dem Clipboard zu holen. Im schlimmsten Fall werden alle Verzeichnisnamen sich überschreibend in das Clipboard gestellt, bevor der erste Name ausgelesen wird. Die äußere While-Schleife bringt dann nichts mehr, weil Startindex auf den letzten Eintrag im Array zeigt.

    Mein Vorschlag wäre deshalb:

    • Äußere While-Schleife inklusive Sleep(9000) entfernen.
    • Nach Send("^v") etwas Zeit für die Verarbeitung einräumen.

      AutoIt
          ; Alle Einträge kopieren, beginnend beim Startindex
          For $i = 1 To UBound($dirList) - 1
              ClipPut($dirList[$i])
              Send("^v")
              Sleep(100) ; bei Bedarf verlängern
              MouseClick("left", 1089, 722)
              ; Sleep(100) ; evtl. noch eine Verarbeitungspause
          Next

    Auf gutes Gelingen,

    Velted

  • Drag & Drop auf versteckten Button

    • Velted
    • 7. Mai 2024 um 09:37
    Zitat von Tweaky

    Ich würde aber gerne Opt("GUIOnEventMode", 1) aktiviert lassen.

    Und wo ist das Problem?

    AutoIt
    GUISetOnEvent($GUI_EVENT_DROPPED, "_dropped")
  • Drag & Drop auf versteckten Button

    • Velted
    • 6. Mai 2024 um 08:43

    Moin,

    warum benutzt Du nicht $GUI_EVENT_DROPPED?

  • Datei von Netzlaufwerk kopieren mit Progressbar

    • Velted
    • 17. April 2024 um 11:40

    Ok, nach der Doku ist die 5 für Netzlaufwerke immer falsch.

    Was passiert, wenn Du das Skript als normaler Benutzer laufen lässt?

  • Datei von Netzlaufwerk kopieren mit Progressbar

    • Velted
    • 17. April 2024 um 08:57

    Moin,

    die Routine entstammt offenbar den Beispielen für _WinAPI_MoveFileEx(). Leider hast Du Dir für den Parameter $iFlags einen 'unglücklichen' Wert ausgesucht.

    5 entspricht $MOVE_FILE_REPLACE_EXISTING (0x0001) + $MOVE_FILE_DELAY_UNTIL_REBOOT (0x0004).

    $MOVE_FILE_DELAY_UNTIL_REBOOT ist laut Doku für Dateien auf Netzlaufwerken nicht zulässig. Außerdem soll, wenn eine Datei auf ein anderes Laufwerk kopiert werden soll, das Flag MOVE_FILE_COPY_ALLOWED (0x0002) gesetzt werden.

    Ein 'glücklicherer' Wert für $iFlags wäre meiner Meinung nach deshalb 3.

  • Mit Shellexecute neue Programminstanz öffnen

    • Velted
    • 27. März 2024 um 17:00

    Moin,

    Zitat von hipfzwirgel

    So, mit dem folgenden Code geht es:

    Code
    $Homepage = "https://IP-Adresse
    			If Not ProcessExists("firefox.exe") Then
    				; Wenn Firefox nicht gestartet ist, starte eine Instanz
    				ShellExecute($Homepage)
    			Else
    				; Wenn Firefox bereits gestartet ist, starte eine neue Instanz
    				Run("C:\Program Files\Mozilla Firefox\firefox.exe -new-window " & $Homepage)
    			EndIf

    Wenn immer Firefox in einem neuen Fenster gestartet werden soll, tut es auch:

    AutoIt
    $HomePage = "www.berlin.de" ; hier geht's zur Hauptstadt
    $Browser = "firefox.exe"
    ShellExecute($Browser, "-new-window " & $Homepage)
  • Cairo unter Autoit nutzen

    • Velted
    • 26. März 2024 um 11:23

    Nachschlag für UEZ

    Code
            DllCall($g_hCairoDLL, "none:cdecl", "cairo_move_to", "ptr", $pSurface, "double", $x, "double", $y)
            DllCall($g_hCairoDLL, "none:cdecl", "cairo_line_to", "ptr", $pSurface, "double", $iW, "double", $iH)
            DllCall($g_hCairoDLL, "none:cdecl", "cairo_stroke", "ptr", $pContext)

    Das kann nicht funktionieren, weil Du versuchst, auf $pSurface zu zeichnen.

  • Cairo unter Autoit nutzen

    • Velted
    • 26. März 2024 um 11:21

    Moin,

    ich habe mich gestern lange und intensiv mit den Beipielen beschäftigt. Dabei hatte ich immer wieder Rückschläge, die ich mir nicht erklären konnte. Kurz vor dem endgültigem Aufgeben entstand dann aber doch noch eine (überwiegend) funktionierende Lösung. Nach verdienter Nachtruhe habe ich die noch etwas aufgebohrt und bin jetzt recht zufrieden damit.

    Ich wollte von vornherein ohne Umwege über Bitmaps/BitBlts direkt mit dem DC arbeiten. Nach vielem Try&Error habe ich dann folgendes in der Cairo-Doku gelesen:

    Zitat

    The resulting surface will always be of format CAIRO_FORMAT_RGB24; should you need another surface format, you will need to create one through cairo_win32_surface_create_with_format() or cairo_win32_surface_create_with_dib().

    Windows unterstützt seit Version 8 nur noch 32-Bit (A)RGB. Das scheint nicht so recht zu cairo_win32_surface_create () passen. Ich habe deshalb für Win 10 die Funktion Cairo_CreateWin32SurfaceWithFormat mit $CAIRO_FORMAT_ARGB32 aufgerufen, und siehe, alles lief deutlich besser. Beim Versuch, ein Control als Zeichenfläche zu nutzen, musste ich zunächst feststellen, dass Cairo den gesamten Clientbereich des Elternfensters übermalt. Die Erklärung fand sich hier:

    Zitat

    The DC will be queried for its initial clip extents, and this will be used as the size of the cairo surface.

    Ich habe einfach mal vermutet, dass da etwas nicht passt, und eine passende Clipping-Region gesetzt. Das hatte tatsächlich den gewünschten Erfolg.

    Lange Rede, kurzer Sinn, hier kommt das Ergebnis all meiner Mühe. Es läuft hier stabil mit den DLLs aus dem ersten Beitrag mit 32 und 64 Bit:

    AutoIt: Cairo_Test.au3
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <WinAPIGdi.au3>
    #include <WinAPISysWin.au3>
    #include "Cairo.au3"
    
    AutoItSetOption('MustDeclareVars', 1)
    
    Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi, $f2PI = $fPi * 2
    Global Const $iW = 600, $iH = 400
    Global $sTitle = "Cairo Test (" & (@AutoItX64 ? "64" : "32") & " Bit) / FPS: "
    Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit
    Global $iRX = 0, $iRY = 0, $iRW = 0, $iRH = 0
    Global $iDX = 0, $iDY = 0
    Global $sShape = ""
    
    _DrawRectangle()
    
    AutoItSetOption("GUIOnEventMode", 1)
    
    Cairo_Test()
    
    AutoItSetOption("GUIOnEventMode", 0)
    
    
    Func Cairo_Test()
    	Cairo_Init()
    
    	$hGUI = GUICreate($sTitle & "0", $iW + 20, $iH + 55)
    	GUICtrlCreateLabel('', 10, 10, $iW, $iH)
    	Local $hSurface = GUICtrlGetHandle(-1)
    	GUICtrlCreateButton('Rectangle', 10,  $iH + 20, 135)
    	GUICtrlSetOnEvent(-1, '_DrawRectangle')
    	GUICtrlCreateButton('Arc', 165, $iH + 20, 135)
    	GUICtrlSetOnEvent(-1, '_DrawArc')
    	GUICtrlCreateButton('Line', 320, $iH + 20, 135)
    	GUICtrlSetOnEvent(-1, '_DrawLine')
    	GUICtrlCreateButton('Stop', 475, $iH + 20, 135)
    	GUICtrlSetOnEvent(-1, '_StopDrawing')
    	Local $hClipRgn = _WinAPI_CreateRectRgn(0, 0, $iW, $iH)
    	GUISetState(@SW_SHOW, $hGUI)
    
    	$bExit = False
    	GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
     	AdlibRegister("CalcFPS", 1000)
    
    	Local $t, $tt = 1 / 60, $x, $y, $c
    	Local $pSurface = 0, $pContext = 0, $hDC = 0
    
    	_SetTimerResolution("Min")
    
    	Do
    		If $sShape = 'Stop' Then ContinueLoop
    		$c = 0.5 + 0.5 * Sin($t)
    		; Der von GetDC gelieferte DC hat keine Cipping-Region.
    		; Für Controls muss deshalb eine passende erstellt werden, damit Cairo die Größe erkennt.
    		; Ansonsten nimmt Cairo den gesamten Clientbereich des GUI-Fensters.
    		Local $hDC = _WinAPI_GetDC($hSurface)
    		_WinAPI_SelectClipRgn($hDC, $hClipRgn)
    		$pSurface = Cairo_CreateWin32SurfaceWithFormat($hDC)
    		$pContext = Cairo_CreateContext($pSurface)
    		Cairo_ClearContext($pContext, $c, $c, $c)
    		; DllCall($g_hCairoDLL, "none:cdecl", "cairo_set_source_rgba", "ptr", $pContext, "double", 0, "double", 0, "double", 0.5 + 0.5 * Cos($t), "double", 1.0)
    		DllCall($g_hCairoDLL, "none:cdecl", "cairo_set_source_rgb", "ptr", $pContext, "double", 0, "double", 0, "double", 0.5 + 0.5 * Cos($t))
    		DllCall($g_hCairoDLL, "none:cdecl", "cairo_set_line_width", "ptr", $pContext, "double", 1)
    		Switch $sShape
    			Case 'Rectangle'
    				DllCall($g_hCairoDLL, "none:cdecl", "cairo_rectangle", "ptr", $pContext, "double", $iRX, "double", $iRY, "double", $iRW, "double", $iRH)
    			Case 'Arc'
    				DllCall($g_hCairoDLL, "none:cdecl", "cairo_arc", "ptr", $pContext, "double", $iRX, "double", $iRY, "double", $iRW, "double", 0.0, "double", $f2PI)
    				DllCall($g_hCairoDLL, "none:cdecl", "cairo_fill", "ptr", $pContext)
    			Case 'Line'
    				DllCall($g_hCairoDLL, "none:cdecl", "cairo_move_to", "ptr", $pContext, "double", 0, "double", 0)
    				DllCall($g_hCairoDLL, "none:cdecl", "cairo_line_to", "ptr", $pContext, "double", $iRW, "double", $iRH)
    		EndSwitch
    		DllCall($g_hCairoDLL, "none:cdecl", "cairo_stroke", "ptr", $pContext)
    		; DllCall($g_hCairoDLL, "none:cdecl", "cairo_flush", "ptr", $pSurface)
    		Cairo_DestroyContext($pContext)
    		Cairo_DestroySurface($pSurface)
    		_WinAPI_ReleaseDC($hSurface, $hDC)
    
    		$iRX += $iDX
    		$iRY += $iDY
    		Switch $sShape
    			Case 'Rectangle'
    				$iRX += $iDX
    				$iRY += $iDY
    				If ($iRX < 0) Or ($iRX + $iRW) > $iW Then $iDX *= -1
    				If ($iRY < 0) Or ($iRY + $iRH) > $iH Then $iDY *= -1
    			Case 'Arc'
    				$iRX += $iDX
    				$iRY += $iDY
    				If (($iRX - $iRW) < 0) Or (($iRX + $iRW) > $iW) Then $iDX *= -1
    				If (($iRY - $iRW) < 0) Or (($iRY + $iRW) > $iH) Then $iDY *= -1
    			Case 'Line'
    				$iRH += $iDY
    				If $iRH < 0 Then $iDY *= -1
    				If $iRH > $iH Then $iDY *= -1
    		EndSwitch
    
    		$t += $tt
    
    		$iFPS += 1
    		If $bExit Then ExitLoop
    		_SleepXS(4)
    	Until False
    
    	_SetTimerResolution("Def")
    	_WinAPI_DeleteObject($hClipRgn)
    	GUIDelete($hGUI)
    	Cairo_Close()
    EndFunc
    
    Func _Exit()
    	$bExit = True
    EndFunc   ;==>_Exit
    
    Func CalcFPS() ;display FPS
    	$iShowFPS = $iFPS
    	$iFPS = 0
    	WinSetTitle($hGUI, "", $sTitle & $iShowFPS)
    EndFunc   ;==>CalcFPS
    
    Func _DrawRectangle()
    	$sShape = 'Rectangle'
    	$iRX = 0
    	$iRY = 0
    	$iRW = 100
    	$iRH = 100
    	$iDX = 1
    	$iDY = 1
    EndFunc
    Func _DrawArc()
    	$sShape = 'Arc'
    	$iRX = 100
    	$iRY = 100
    	$iRW = 50
    	$iRH = 50
    	$iDX = 1
    	$iDY = 1
    EndFunc
    
    Func _DrawLine()
    	$sShape = 'Line'
    	$iRX = 0
    	$iRY = 0
    	$iRW = $iW
    	$iRH = $iH
    	$iDX = 1
    	$iDY = 1
    EndFunc
    
    Func _StopDrawing()
    	$sShape = 'Stop'
    EndFunc
    
    Func _SleepXS($iMS)
    	DllCall("Kernel32.dll", "NONE", "Sleep", "UInt", $iMS)
    EndFunc
    
    Func _SetTimerResolution($vRes)
    	Static  $iMax = 0, $iMin = 0, $iDef = 0
    	Local $aCall = 0
    	If $iDef = 0 Then
    		$aCall = DllCall("Ntdll.dll", "BOOL", "NtQueryTimerResolution", "UInt*", $iMax, "UInt*", $iMin, "UInt*", $iDef)
    		If $aCall[0] = 0 Then
    			$iMax = $aCall[1]
    			$iMin = $aCall[2]
    			$iDef = $aCall[3]
    		Else
    			Return SetError(1, 0, 0)
    		EndIf
    	EndIf
    	Switch $vRes
    		Case "Def"
    			$vRes = $iDef
    		Case "Max"
    			$vRes = $iMax
    		Case "Min"
    			$vRes = $iMin
    		Case Else
    			If IsNumber($vRes) Then
    				$vRes *= 10000
    				If $vRes < $iMin Then $vRes = $iMin
    				If $vRes > $iMax Then $vRes = $iMax
    			Else
    				Return SetError(2, 0, 0)
    			EndIf
    	EndSwitch
    	Return Not DllCall("Ntdll.dll", "BOOL", "NtSetTimerResolution", "UInt", $vRes, "UInt", 1, "UInt*", 0)[0]
    EndFunc
    Alles anzeigen
  • Cairo unter Autoit nutzen

    • Velted
    • 24. März 2024 um 17:46

    Moin UEZ

    ich bin nicht sicher, meinst Du so etwas?

    AutoIt
    #AutoIt3Wrapper_UseX64=n
    
    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <WinAPIGdi.au3>
    #include "Cairo.au3"
    
    AutoItSetOption('MustDeclareVars', 1)
    
    Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi, $f2PI = $fPi * 2
    Global Const $iW = 600, $iH = 400, $sTitle = "Cairo Test / FPS: "
    Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit
    
    AutoItSetOption("GUIOnEventMode", 1)
    
    Cairo_Test()
    
    AutoItSetOption("GUIOnEventMode", 0)
    
    
    Func Cairo_Test()
    	Cairo_Init()
    	Local $iStride = Cairo_GetStride($iW)
    	ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iStride = ' & $iStride & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    
    	$hGUI = GUICreate($sTitle & "0", $iW, $iH)
    	Local Const $hDC = _WinAPI_GetDC($hGUI)
    ;~ 	Local $tBits = DllStructCreate("long[" & $iStride * $iH & "]")
    ;~ 	Local Const $hBitmapGDI = _WinAPI_CreateBitmap($iW, $iH, 1, 32, $tBits)
    	Local Const $hBitmapGDI = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
    	Local Const $hGfxDC = _WinAPI_CreateCompatibleDC($hDC)
    	Local Const $hObjOld = _WinAPI_SelectObject($hGfxDC, $hBitmapGDI)
    	GUISetState(@SW_SHOW, $hGUI)
    
    
    	$bExit = False
    	GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    	AdlibRegister("CalcFPS", 1000)
    
    	Local $pSurface = Cairo_CreateWin32Surface($hGfxDC)
    	ConsoleWrite("Surface status: " & DllCall($g_hCairoDLL, "long:cdecl", "cairo_surface_status", "ptr", $pSurface)[0] & @CRLF)
    	ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $pSurface = ' & $pSurface & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    
    	Local $pContext = Cairo_CreateContext($pSurface)
    	ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $pContext = ' & $pContext & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    	ConsoleWrite(DllCall($g_hCairoDLL, "str:cdecl", "cairo_status_to_string")[0] & @CRLF)
    
    	Local $t, $tt = 1 / 60, $x, $y, $c
    	Local $tPAINTSTRUCT
    	Local $iRX = 0, $iRY = 0, $iRW = 100, $iRH = 100
    	Do
            _WinAPI_BeginPaint($hGUI, $tPAINTSTRUCT)
    		$c = 0.5 + 0.5 * Sin($t)
    		Cairo_ClearContext($pContext, $c, $c, $c)
    
    
    		DllCall($g_hCairoDLL, "none:cdecl", "cairo_set_source_rgba", "ptr", $pContext, "double", 0, "double", 0, "double", 0.5 + 0.5 * Cos($t), "double", 1.0)
    		DllCall($g_hCairoDLL, "none:cdecl", "cairo_set_line_width", "ptr", $pContext, "double", $iH / 10)
    		; DllCall($g_hCairoDLL, "none:cdecl", "cairo_rectangle", "ptr",  $pContext, "double", $iW / 4, "double", $iH / 4, "double", $iW / 2, "double", $iH / 2)
    		DllCall($g_hCairoDLL, "none:cdecl", "cairo_rectangle", "ptr",  $pContext, "double", $iRX, "double", $iRY, "double", $iRW, "double", $iRH)
    		DllCall($g_hCairoDLL, "none:cdecl", "cairo_stroke", "ptr", $pContext)
    
    		$iRX += 1
    		$iRY += 1
    		If ($iRX + $iRW) > $iW Then $iRX = 0
    		If ($iRY + $iRH) > $iH Then $iRY = 0
    
    		_WinAPI_EndPaint($hGUI, $tPAINTSTRUCT)
    
    		$t += $tt
    
    
    		_WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $SRCCOPY)
    
    		$iFPS += 1
    		If $bExit Then ExitLoop
    	Until Not Sleep(10)
    
    	Cairo_DestroyContext($pContext)
    	Cairo_DestroySurface($pSurface)
    
    	_WinAPI_SelectObject($hGfxDC, $hObjOld)
    	_WinAPI_ReleaseDC($hGUI, $hDC)
    	_WinAPI_DeleteDC($hGfxDC)
    	_WinAPI_DeleteObject($hBitmapGDI)
    	GUIDelete($hGUI)
    	Cairo_Close()
    
    EndFunc
    
    Func _Exit()
    	$bExit = True
    EndFunc   ;==>_Exit_About
    
    Func CalcFPS() ;display FPS
    	$iShowFPS = $iFPS
    	$iFPS = 0
    	WinSetTitle($hGUI, "", $sTitle & $iShowFPS)
    EndFunc   ;==>CalcFPS
    Alles anzeigen
  • Hook auf die MsgBox

    • Velted
    • 8. März 2024 um 23:14

    Moin, noch ein Vorschlag, der allerdings statt der MsgBox einen Taskdialog verwendet:

    TaskDialogConstants.au3
    AutoIt: TaskDialogConstants.au3
    ; ===============================================================================================================================
    ; TASKDIALOG constants
    ; https://learn.microsoft.com/en-us/windows/win32/controls/task-dialogs
    ; ===============================================================================================================================
    ; TASKDIALOG_FLAGS 	Note: TASKDIALOG_FLAGS is an int
    Global Const $TDF_ENABLE_HYPERLINKS = 0x0001
    Global Const $TDF_USE_HICON_MAIN = 0x0002
    Global Const $TDF_USE_HICON_FOOTER = 0x0004
    Global Const $TDF_ALLOW_DIALOG_CANCELLATION = 0x0008
    Global Const $TDF_USE_COMMAND_LINKS = 0x0010
    Global Const $TDF_USE_COMMAND_LINKS_NO_ICON = 0x0020
    Global Const $TDF_EXPAND_FOOTER_AREA = 0x0040
    Global Const $TDF_EXPANDED_BY_DEFAULT = 0x0080
    Global Const $TDF_VERIFICATION_FLAG_CHECKED = 0x0100
    Global Const $TDF_SHOW_PROGRESS_BAR = 0x0200
    Global Const $TDF_SHOW_MARQUEE_PROGRESS_BAR = 0x0400
    Global Const $TDF_CALLBACK_TIMER = 0x0800
    Global Const $TDF_POSITION_RELATIVE_TO_WINDOW = 0x1000
    Global Const $TDF_RTL_LAYOUT = 0x2000
    Global Const $TDF_NO_DEFAULT_RADIO_BUTTON = 0x4000
    Global Const $TDF_CAN_BE_MINIMIZED = 0x8000
    Global Const $TDF_NO_SET_FOREGROUND = 0x00010000               ; Win 8+ -> Don't call SetForegroundWindow() when activating the dialog
    Global Const $TDF_SIZE_TO_CONTENT = 0x01000000                 ; used by ShellMessageBox to emulate MessageBox sizing behavior
    ; TASKDIALOG_MESSAGES
    Global Const $TDM_NAVIGATE_PAGE = 0x0400 + 101
    Global Const $TDM_CLICK_BUTTON = 0x0400 + 102                  ;wParam = Button ID
    Global Const $TDM_SET_MARQUEE_PROGRESS_BAR = 0x0400 + 103      ; wParam = 0 (nonMarque) wParam != 0 (Marquee)
    Global Const $TDM_SET_PROGRESS_BAR_STATE = 0x0400 + 104        ; wParam = new progress state
    Global Const $TDM_SET_PROGRESS_BAR_RANGE = 0x0400 + 105        ; lParam = MAKELPARAM(nMinRange, nMaxRange)
    Global Const $TDM_SET_PROGRESS_BAR_POS = 0x0400 + 106          ; wParam = new position
    Global Const $TDM_SET_PROGRESS_BAR_MARQUEE = 0x0400 + 107      ; wParam = 0 (stop marquee), wParam != 0 (start marquee), lparam = speed (milliseconds between repaints)
    Global Const $TDM_SET_ELEMENT_TEXT = 0x0400 + 108              ; wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
    Global Const $TDM_CLICK_RADIO_BUTTON = 0x0400 + 110            ; wParam = Radio Button ID
    Global Const $TDM_ENABLE_BUTTON = 0x0400 + 111                 ; lParam = 0 (disable), lParam != 0 (enable), wParam = Button ID
    Global Const $TDM_ENABLE_RADIO_BUTTON = 0x0400 + 112           ; lParam = 0 (disable), lParam != 0 (enable), wParam = Radio Button ID
    Global Const $TDM_CLICK_VERIFICATION = 0x0400 + 113            ; wParam = 0 (unchecked), 1 (checked), lParam = 1 (set key focus)
    Global Const $TDM_UPDATE_ELEMENT_TEXT = 0x0400 + 114           ; wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
    Global Const $TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = 0x0400 + 115 ; wParam = Button ID, lParam = 0 (elevation not required), lParam != 0 (elevation required)
    Global Const $TDM_UPDATE_ICON = 0x0400 + 116                   ; wParam = icon element (TASKDIALOG_ICON_ELEMENTS), lParam = new icon (hIcon if TDF_USE_HICON_* was set, PCWSTR otherwise)
    ; TASKDIALOG_NOTIFICATIONS
    Global Const $TDN_CREATED = 0
    Global Const $TDN_NAVIGATED = 1
    Global Const $TDN_BUTTON_CLICKED = 2                           ; wParam = Button ID
    Global Const $TDN_HYPERLINK_CLICKED = 3                        ; lParam = (LPCWSTR)pszHREF
    Global Const $TDN_TIMER = 4                                    ; wParam = Milliseconds since dialog created or timer reset
    Global Const $TDN_DESTROYED = 5
    Global Const $TDN_RADIO_BUTTON_CLICKED = 6                     ; wParam = Radio Button ID
    Global Const $TDN_DIALOG_CONSTRUCTED = 7
    Global Const $TDN_VERIFICATION_CLICKED = 8                     ; wParam = 1 if checkbox checked, 0 if not, lParam is unused and always 0
    Global Const $TDN_HELP = 9
    Global Const $TDN_EXPANDO_BUTTON_CLICKED = 10                  ; wParam = 0 (dialog is now collapsed), wParam != 0 (dialog is now expanded)
    ; TASKDIALOG_ELEMENTS
    Global Enum $TDE_CONTENT, $TDE_EXPANDED_INFORMATION, $TDE_FOOTER, $TDE_MAIN_INSTRUCTION
    ; TASKDIALOG_ICON_ELEMENTS
    Global Enum $TDIE_ICON_MAIN, $TDIE_ICON_FOOTER
    ; Predefined icons
    Global Const $TD_WARNING_ICON = -1
    Global Const $TD_ERROR_ICON = -2
    Global Const $TD_INFORMATION_ICON = -3
    Global Const $TD_SHIELD_ICON = -4
    ; TASKDIALOG_COMMON_BUTTON_FLAGS  Note: TASKDIALOG_COMMON_BUTTON_FLAGS is an int
    Global Const $TDCBF_OK_BUTTON = 0x0001         ; selected control return value IDOK
    Global Const $TDCBF_YES_BUTTON = 0x0002        ; selected control return value IDYES
    Global Const $TDCBF_NO_BUTTON = 0x0004         ; selected control return value IDNO
    Global Const $TDCBF_CANCEL_BUTTON = 0x0008     ; selected control return value IDCANCEL
    Global Const $TDCBF_RETRY_BUTTON = 0x0010      ; selected control return value IDRETRY
    Global Const $TDCBF_CLOSE_BUTTON = 0x0020      ; selected control return value IDCLOSE
    ; ===============================================================================================================================
    ; TASKDIALOG structures
    ; Note: TASKDDIALOG structures are aligned by <pshpack1.h>
    ; ===============================================================================================================================
    ; TASKDIALOG_BUTTON structure
    ; https://learn.microsoft.com/en-us/windows/win32/api/Commctrl/ns-commctrl-taskdialog_button
    ; ===============================================================================================================================
    Global Const $tagTASKDIALOG_BUTTON = "ALIGN 1;INT nButtonID;PTR pszButtonText;"
    ; ===============================================================================================================================
    ; TASKDIALOGCONFIG structure
    ; https://learn.microsoft.com/en-us/windows/win32/api/Commctrl/ns-commctrl-taskdialogconfig
    ; All string pointers (psz...) point to Unicode strings (WSTR)
    ; ===============================================================================================================================
    Global Const $tagTASKDIALOGCONFIG = "ALIGN    1;" & _
    		"UINT     cbSize;" & _
    		"HWND     hwndParent;" & _
    		"HANDLE   hInstance;" & _
    		"DWORD    dwFlags;" & _
    		"DWORD    dwCommonButtons;" & _
    		"PTR      pszWindowTitle;" & _
    		"PTR	  pUnion1;" & _                             ; HICON hMainIcon | PCWSTR pszMainIcon
    		"PTR      pszMainInstruction;" & _
    		"PTR      pszContent;" & _
    		"UINT     cButtons;" & _
    		"PTR      pButtons;" & _
    		"INT      nDefaultButton;" & _
    		"UINT     cRadioButtons;" & _
    		"PTR      pRadioButtons;" & _
    		"INT      nDefaultRadioButton;" & _
    		"PTR      pszVerificationText;" & _
    		"PTR      pszExpandedInformation;" & _
    		"PTR      pszExpandedControlText;" & _
    		"PTR      pszCollapsedControlText;" & _
    		"PTR      pUnion2;" & _                             ; HICON hFooterIcon | PCWSTR pszFooterIcon
    		"PTR      pszFooter;" & _
    		"PTR      pfCallback;" & _
    		"LONG_PTR lpCallbackData;" & _
    		"UINT     cxWidth;"
    ; ===============================================================================================================================
    Alles anzeigen
    RadioBox.au3
    AutoIt: RadioBox.au3
    #Include <TaskDialogConstants.au3>
    Global $Title = "" ; leer -> Skriptname
    Global $Main = "Stammdaten - Auswahl"
    Global $Content = "Auswahl für Nr. " & "xxxxxx" & " treffen"
    Global $Selection = ["Doku öffnen", "Nr.-Druck", "ERP suchen"]
    Global $Btn = 0
    Global $SelRB = RadioBox($Main, $Selection, $Btn, -1, $Content, $Title)
    MsgBox(0, "Ergebnis", $SelRB >= 0 ? "Deine Auswahl: " & $Selection[$SelRB] : "Keine Auswahl!")
    Exit
    ; ======================================================================================================================
    ; RadioBox
    ; Creates a task dialog querying the user to select one of several options with radio buttons.
    ; Parameters:
    ;     $Main     -  a string to be used for the main instruction
    ;     $Radios   -  an array of one or more radio button captions to be used for the selection
    ;     $BtnID    -  ByRef variable to receive the ID of the pressed common button
    ;                   	 0 -  no button (error)
    ;                   	 1 -  OK button
    ;                   	 2 -  CANCEL button
    ;     $DefRadio -  (optional) the default radio button:
    ;                   	-1 -  no default button
    ;                   	 0 -  the first button (default)
    ;                   	 n -  the button specified by n
    ;     $Content  -  (optional) a string to be used for the dialog's primary content.
    ;                   	 Default: "" -> no content
    ;     $Title    -  (optional) a string to be used for the task dialog title
    ;                   	 Default: "" -> the script's file name
    ;  Return values:
    ;     Returns -1 if an error occurred, the user cancelled the dialog, or no radio button is selected.
    ;     Returns the 0-based index of the selected radio button on success.
    ; ----------------------------------------------------------------------------------------------------------------------
    ; TaskDialogIndirect -> https://learn.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-taskdialogindirect
    ; TASKDIALOGCONFIG   -> https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-taskdialogconfig
    ; TASKDIALOG_BUTTON  -> https://learn.microsoft.com/en-us/windows/win32/api/Commctrl/ns-commctrl-taskdialog_button
    ; TDF_SIZE_TO_CONTENT = 0x01000000, TDF_ALLOW_DIALOG_CANCELLATION = 8, TDF_NO_DEFAULT_RADIO_BUTTON = 0x4000
    ; TDCBF_OK_BUTTON = 1, TDCBF_CANCEL_BUTTON = 8
    ; ======================================================================================================================
    Func RadioBox($Main, $Radios, ByRef $BtnID, $DefRadio = 0, $Content = "", $Title = "")
    	Static $MinRID = 10 ; minimum radio button ID
    	$BtnID = 0
    	If Not IsArray($Radios) Then Return SetError(1, 0, -1)
    	Local $RadioCount = UBound($Radios)
    	If Not IsInt($DefRadio) Then Return SetError(2, 0, -1)
    	If Not ($DefRadio <= $RadioCount) Then Return SetError(3, 0, -1)
    	$DefRadio += $MinRID
    	If ($Title = "") Then $Title = @ScriptName
    	Local $Flags = BitOR(0x01000000, $DefRadio < $MinRID ? 0x00004000 : 0) ; TDF_SIZE_TO_CONTENT, TDF_NO_DEFAULT_RADIO_BUTTON
    	Local $StrArr[$RadioCount] ; needed to store the captions for the radio buttons
    	Local $tagBtnArr = "ALIGN 1;"
    	For $I = 0 To $RadioCount - 1
    		$tagBtnArr &= "INT;PTR;"
    		$StrArr[$I] = DllStructCreate("WCHAR[" & (StringLen($Radios[$I]) + 1) & "];")
    		DllStructsetData($StrArr[$I], 1, $Radios[$I])
    	Next
    	Local $tBtnArr = DllStructCreate($tagBtnArr)
    	Local $J
    	For $I = 0 To $RadioCount - 1
    		$J = ($I * 2) + 1
    		DllStructSetData($tBtnArr, $J, $I + $MinRID)
    		DllStructSetData($tBtnArr, $J + 1, DllStructGetPtr($StrArr[$I]))
    	Next
    	Local $pBtnArr = DllStructGetPtr($tBtnArr)
    	Local $tMain = DllStructCreate("WCHAR[" & (StringLen($Main) + 1) & "];")
    	DllStructsetData($tMain, 1, $Main)
    	Local $pMain = DllStructGetPtr($tMain)
    	Local $pTitle = 0
    	If $Title <> "" Then
    		Local $tTitle = DllStructCreate("WCHAR[" & (StringLen($Title) + 1) & "];")
    		DllStructsetData($tTitle, 1, $Title)
    		$pTitle = DllStructGetPtr($tTitle)
    	EndIf
    	Local $pContent = 0
    	If $Content <> "" Then
    		Local $tContent = DllStructCreate("WCHAR[" & (StringLen($Content) + 1) & "];")
    		DllStructsetData($tContent, 1, $Content)
    		$pContent = DllStructGetPtr($tContent)
    	EndIf
    	; TASKDIALOGCONFIG structure
    	Local $tTDC = DllStructCreate($tagTASKDIALOGCONFIG)
    	DllStructSetData($tTDC, "cbSize", DllStructGetSize($tTDC))
    	DllStructSetData($tTDC, "hwndParent", 0)
    	DllStructSetData($tTDC, "dwFlags", $Flags)
    	DllStructSetData($tTDC, "dwCommonButtons", 9)
    	DllStructSetData($tTDC, "pszWindowTitle", $pTitle)
    	DllStructSetData($tTDC, "pszMainInstruction", $pMain)
    	DllStructSetData($tTDC, "pszContent", $pContent)
    	DllStructSetData($tTDC, "cRadioButtons", $RadioCount)
    	DllStructSetData($tTDC, "pRadioButtons", $pBtnArr)
    	DllStructSetData($tTDC, "nDefaultRadioButton", $DefRadio > $MinRID ? $DefRadio : 0)
    	Local $pTDC = DllStructGetPtr($tTDC)
    	Local $RID = 0    ; ID of the selected radio button
    	Local $aCall = DllCall("Comctl32.dll", "UInt", "TaskDialogIndirect", "PTR", $pTDC, "INT*", $BtnID, "INT*", $RID, "PTR", 0)
    	$BtnID = $aCall[2]
    	Select
    		Case @Error Or ($aCall[0] <> 0)
    			Return SetError(3, 0, -1)
    		Case $aCall[3] = 0
    			Return -1
    		Case $aCall[2] <> 1
    			Return -1
    		Case Else
    			Return $aCall[3] - $MinRID
    	EndSelect
    EndFunc
    Alles anzeigen

    Vielleicht gefällt es dir ?

  • Verschiedene Werte beim Auslesen eines NFC-Tags

    • Velted
    • 1. März 2024 um 13:56

    Moin hipfzwirgel,

    Zitat von hipfzwirgel

    @ Velted: beim Abbruch stand immer die Zahl 1 in der Variable drin. Da er beim D bereits ausgestiegen ist.

    Ich habe nach dem Inhalt der Variablen $tKEYHOOKS.vkCode gefragt. Ich glaube nicht, dass die mit Inhalt 1 zum Abbruch führt. Aber ...

    Zitat von hipfzwirgel

    Ich glaube wir können das Thema nun als erledigt betrachten, da das Problem ja ohnehin schon gelöst ist.

    Danke für die Info.

  • Verschiedene Werte beim Auslesen eines NFC-Tags

    • Velted
    • 29. Februar 2024 um 18:54

    Was steht denn beim Abbruch mit dem NFC-Leser in $tKEYHOOKS.vkCode?

  • Verschiedene Werte beim Auslesen eines NFC-Tags

    • Velted
    • 26. Februar 2024 um 18:44

    Moin,

    AutoIt
    Global $sHex = "1D70536A031080"
    Global $sRev = ""
    Global $iPos = 14 - 1
    While $iPos > 0
    	$sRev &= StringMid($sHex, $iPos, 2)
    	$iPos -= 2
    Wend
    Global $iSNR = Dec($sRev, 2)
    MsgBox(0, "SN", "Hex: " & $sHex & @LF & "Rev: " & $sRev & @LF & "Dez: " & $iSNR)
    Zitat

    ---------------------------
    SN
    ---------------------------
    Hex: 1D70536A031080
    Rev: 8010036A53701D
    Dez: 36046403873763357
    ---------------------------
    OK
    ---------------------------

    Alles anzeigen

    ?

  • Gesamtzeit richtig berechnen

    • Velted
    • 17. Februar 2024 um 13:31

    Moin, auch wenn ich die auf Spiele ausgerichteten Skripte nicht gern unterstütze: Ich kann Dein Problem nicht finden.

    Du verwaltest eine "bisherige Gesamtspielzeit" in der Registrierung. Die kannst Du beim Start des Skripts einlesen. Sie kann sich nicht verändern.

    Das Skript startet das Spiel. Du musst Dir also nur einmal den Startzeitpunkt merken.

    Wenn Du auf "Aktuelle Spielzeit" drückst, musst Du die Differenz zur Startzeit berechnen. Wie Du sagst, klappt das bereits.

    Wenn Du auf "Aktuelle Gesamtzeit" drückst, musst Du die "Aktuelle Spielzeit" berechnen und den beim Start des Skripts eingelesenen Wert aus der Registrierung addieren.

    Wenn das Spiel (btw. das Skript?) beendet wird, musst Du die "Aktuelle Spielzeit" berechnen, den beim Start des Skripts eingelesenen Wert aus der Registrierung addieren und das Ergebnis in die Registrierung zurückschreiben.

    Wo klemmt es?

  • Skript mit F10 starten und mit F9 beenden

    • Velted
    • 14. Februar 2024 um 12:51

    Moin,

    ob mit oder ohne Webdriver, für mich ist noch offen, wann und wie auf F9/F10 reagiert werden soll.

    In den bisher eingestellten Beispielen wird der aktuelle Schleifendurchlauf 'in aller Ruhe' beendet. Das ursprüngliche Beispiel aus Beitrag #1 enthält mehrfach

    AutoIt
    ; Pause for 2 Minutes for changing the Dashboard
    			Sleep(120000)

    Das könnte dann schon ein Weilchen dauern, bis das 'Durchschalten' durch die Dashboards beendet wird.

    DivineFaith, soll das so sein? Wenn nicht, was genau soll geschehen?

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™