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

Beiträge von SEuBo

  • Analyse eines Bildes auf schwarze/weiße Pixel

    • SEuBo
    • 23. April 2012 um 00:52

    Das wäre die schnelle, aber komplizierte Variante (ungetestet, und nur schnell in Scite getippt. Sollte aber funktionieren):

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <Array.au3>
    _GDIPlus_Startup()

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

    $hBitmap = _GDIPlus_BitmapCreateFromFile(...)
    $iWidth = _GDIPlus_ImageGetWidth($hBitmap)
    $iHeight = _GDIPlus_ImageGetHeight($hBitmap)

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

    $tLockBits = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $iWidth, $iHeight, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE))
    $tPixelData = DllStructCreate('dword['&$iWidth * $iHeight &']', DllStructGetData($tLockBits, 'Scan0'))
    Dim $aArray[$iWidth][$iHeight]

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

    For $iX = 0 To $iWidth -1
    For $iY = 0 To $iHeight - 1
    $iIndex = $iX + ($iY * $iWidth) + 1
    If DllStructGetData($tPixelData, 1, $iIndex) = 0x000000 Then
    $aArray[$iX][$iY] = 1
    Else
    $aArray[$iX][$iY] = 0
    EndIf
    Next
    Next

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

    _GDIPlus_BitmapUnlockBits($hBitmap, $tLockBits)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()

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

    _ArrayDisplay($aArray)

    [/autoit]

    Etwas einfacher, aber auch langsamer:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <Array.au3>
    _GDIPlus_Startup()

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

    $hBitmap = _GDIPlus_BitmapCreateFromFile(...)
    $iWidth = _GDIPlus_ImageGetWidth($hBitmap)
    $iHeight = _GDIPlus_ImageGetHeight($hBitmap)
    Dim $aArray[$iWidth][$iHeight]

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

    For $iX = 0 To $iWidth -1
    For $iY = 0 To $iHeight - 1

    If _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) = 0x000000 Then
    $aArray[$iX][$iY] = 1
    Else
    $aArray[$iX][$iY] = 0
    EndIf
    Next
    Next

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

    _GDIPlus_BitmapUnlockBits($hBitmap, $tLockBits)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()

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

    _ArrayDisplay($aArray)

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

    Func _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) ; From GDIP.au3
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapGetPixel", "hwnd", $hBitmap, "int", $iX, "int", $iY, "uint*", 0)

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

    If @error Then Return SetError(@error, @extended, 0)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[4]
    EndFunc ;==>_GDIPlus_BitmapGetPixel

    [/autoit]
  • Ordnernamen auslesen und in Listbox ausgeben

    • SEuBo
    • 16. April 2012 um 01:54
    Zitat von DeepRed92

    Ja, es geht. Bei Dateien und Ordner. Ob das ein Ordner ist oder nicht kannst du ganz einfach mit

    [autoit]

    FileGetAttrib

    [/autoit]

    feststellen.
    [ gelöst ] Prüfen, ob Verzeichnis oder Datei


    Bei der Verwendung von FileFindFirstFile und FileFindNextFile reicht es sogar, @extended nach FileFindNextFile abzufragen - Das wird von FileFindNextFile nämlich auf 1 gesetzt, wenn es einen Ordner gefunden hat.

  • Brauche Hilfe FileMove [sehr Kompliziert]

    • SEuBo
    • 12. April 2012 um 16:53
    Zitat von Irrlicht

    Wie kann man es schaffen, 6 Posts ohne Satzzeichen (Ausnahme Gänsefüßchen) zu erstellen?


    /OT

    OBJECTION! Im ersten Post findest du einen "." ;)

  • Brauche Hilfe FileMove [sehr Kompliziert]

    • SEuBo
    • 12. April 2012 um 16:45

    Ich stelle mir dein Script so vor:

    [autoit]

    $aFiles = _FileListToArray(@DesktopDir)
    For $i = 1 To $aFiles[0]
    FileMove(@DesktopDir & '\' & $aFiles[$i], 'C:\Aufgeräumt',1)
    Next

    [/autoit]

    Du verschiebst nun also nacheinander jede Datei von deinem Desktop nach "C:\" und nennst sie "Aufgeräumt".
    Die jeweils vorherige Datei wird dabei überschrieben.

    Du denkst, du besitzt einen Ordner, der wie eine Datei aussieht.
    In Wahrheit besitzt du allerdings nur noch eine einzige Datei (von vielen, die mal auf deinem Desktop waren) , die jetzt genauso heißt, wie der Ordner in den du Sie eigentlich hattest verschieben wollen. Comprende?

  • Random() mit Tendenz

    • SEuBo
    • 11. April 2012 um 10:20

    Nur mal für mich selbst gefragt:
    Würde das hier nicht das selbe machen, oder habe ich da einen logischen Denkfehler?

    [autoit]

    Local $iZahl

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

    Switch Random(1, 110, 1)
    Case 1 To 100
    $iZahl = Random(1,5,1)
    Case 101 To 110
    $iZahl = Random(1,3,1)
    EndSwitch

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

    MsgBox(0,'',$iZahl)

    [/autoit]
  • Es ist möglich ein Programm sich selber am ende löschen zu lassen....

    • SEuBo
    • 8. April 2012 um 21:48

    Oder man gibt in SciTE einfach das Abbrev"selfdelete" ein.

    [autoit]

    Func _SelfDelete($iDelay = 0)
    Local $sCmdFile
    FileDelete(@TempDir & "scratch.bat")
    $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _
    & ':loop' & @CRLF _
    & 'del "' & @ScriptFullPath & '" > nul' & @CRLF _
    & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
    & 'del ' & @TempDir & 'scratch.bat'
    FileWrite(@TempDir & "scratch.bat", $sCmdFile)
    Run(@TempDir & "scratch.bat", @TempDir, @SW_HIDE)
    EndFunc

    [/autoit]
  • autoitObject auf Attribute zugreifen

    • SEuBo
    • 6. April 2012 um 17:36

    Ich glaube, er sucht so etwas wie Eval() für Attribute eines Objektes...

  • Wie kann ich bei _ArrayDisplay die Spaltennamen angeben?

    • SEuBo
    • 3. April 2012 um 11:34
    Zitat von DOheim

    woher soll man das nur wissen?


    Man könnte sich beispielsweise die Parameter von _ArrayDisplay in der Hilfe nachschlagen.
    Die Parameter sind der Reihe nach mit jeweiliger Beschreibung aufgelistet.

  • Au3 in exe umwandeln

    • SEuBo
    • 25. März 2012 um 20:56
    Zitat von Slider99

    kann man au3 mit Passwort in exe umwandeln?


    Tools -> Build (F7), oder Tools -> Compile (Shift + F7) in SciTE. Äquivalent dazu geht es auch per Rechtsklick auf die .au3 im Explorer -> Compile Script, bzw Compile Script with Options.

  • Feststellen ob Desktop sichtbar ist

    • SEuBo
    • 16. März 2012 um 09:59
    Zitat von m-obi

    ich versuche nun schon lange festzustellen ob alle Fenster minimiert sind und der Desktop sichtbar ist.
    Ich komme aber zu keiner Lösung.


    Alle Fenster minimiert, und der Desktop komplett sichtbar - oder nicht alle Fenster maximiert, und der Desktop (zumindest zu einem minimalen Teil) sichtbar?

  • WinAPI: BitBlt sehr langsam, bei Verwendung von DIB

    • SEuBo
    • 13. März 2012 um 20:57
    Zitat von Andy

    Hab dein Script mal bissl abgeändert und komme so nur auf 1/6 der Zeit


    Das könnte daran liegen, dass du das BitBlt jetzt nicht mehr mit Berücksichtigst ;)

    Die Struct auszulagern, war eigentlich keine schlechte Idee - komme jetzt mit meiner Kröte von Laptop (Früher war er mal schnell :D) auf durchschnittlich 120 ms.
    Außerdem scheint auch der Funktionsaufruf von _ScreenGetPixel_2_GetPixel() (~120 ms) im Gegensatz zum direkten Aufruf von DLLStructGetData() (~60ms) einiges an Zeit zu fressen.
    Auf den kann ich aber eigentlich nicht verzichten - da das ganze eine UDF werden sollte, falls jemand sowas mal braucht, sollte es auch komfortabel gehalten sein.

    Aber vielen vielen Dank für die Mühe Andy. Du hast mir schonmal ein ganzes Stück weitergeholfen - habe das ganze jetzt so, und ich denke mal, ich werde es so lassen:

    Spoiler anzeigen
    [autoit]

    #include <Memory.au3>
    #include <WindowsConstants.au3>
    #include <WinAPI.au3>

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

    Global $_SGP2_hGDI32DLL, $_SGP2_hDC_Screen, $_SGP2_hDC_Memory, $_SGP2_pBitmapBits, $_SGP2_tStruct, $_SGP2_hMem_Alloc
    Global $_SGP2_aArea_0, $_SGP2_aArea_1, $_SGP2_aArea_2, $_SGP2_aArea_3
    _ScreenGetPixel_2_Startup(100, 100) ; 100x100 großer DIB-Bereich

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

    $iSum = 0
    For $i = 1 To 10
    $iTimer = TimerInit()
    _ScreenGetPixel_2_Refresh(0, 0)

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

    For $y = 0 To 99
    For $x = 0 To 99
    _ScreenGetPixel_2_GetPixel($x, $y)
    Next
    Next

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

    $iTimer = TimerDiff($iTimer)
    $iSum += $iTimer
    ConsoleWrite('Durchgang #' & $i & ': ' & $iTimer & @CRLF)
    Next

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

    ConsoleWrite('Gesamt: ' & $iSum & @CRLF)
    ConsoleWrite('Durchschnitt: ' & $iSum / ($i - 1) & @CRLF)
    _ScreenGetPixel_2_Shutdown()

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

    ;==========================================================
    ; Übergeben werden muss die Größe des Bildschirmbereiches,
    ; der später übertragen werden soll. Je größer der Bereich, desto
    ; länger dauert das BitBlt beim _ScreenGetPixel_2_Refresh()
    ;==========================================================
    Func _ScreenGetPixel_2_Startup($iWidth, $iHeight, $iX = 0, $iY = 0)
    Local Const $tagBITMAPINFOHEADER = 'dword biSize;long biWidth;long biHeight;ushort biPlanes;ushort biBitCount;dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant;'

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

    Local $pBitmapHeader, $tBitmapHeader

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

    ; Wir holen uns zuerst den DC vom Desktop.
    $_SGP2_hDC_Screen = _WinAPI_GetDC(0)

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

    ; Dazu erstellen wir uns noch einen kompatiblen DC im Memory, der
    ; mit der DIB verknüpft wird. Wenn wir ein BitBlt in diesen DC machen,
    ; und die Farbinformationen vom Desktop-DC übertragen, enthält die DIB
    ; unsere Farbdaten.
    $_SGP2_hDC_Memory = _WinAPI_CreateCompatibleDC($_SGP2_hDC_Screen)
    ; Speicher für Bitmap-Header reservieren
    $_SGP2_hMem_Alloc = _MemGlobalAlloc(40, $GMEM_FIXED)

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

    If Not @error Then
    ; Pointer des reservierten Speichers holen
    $pBitmapHeader = _MemGlobalLock($_SGP2_hMem_Alloc)
    ; BitmapHeader in reserviertem Speicherbereich erstellen
    $tBitmapHeader = DllStructCreate($tagBITMAPINFOHEADER, $pBitmapHeader)

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

    ; Bitmapinfos ausfüllen
    DllStructSetData($tBitmapHeader, 'biSize', DllStructGetSize($tBitmapHeader))
    DllStructSetData($tBitmapHeader, 'biWidth', $iWidth)
    DllStructSetData($tBitmapHeader, 'biHeight', $iHeight)
    DllStructSetData($tBitmapHeader, 'biPlanes', 1)
    DllStructSetData($tBitmapHeader, 'biBitCount', @DesktopDepth)
    DllStructSetData($tBitmapHeader, 'biCompression', 0)
    DllStructSetData($tBitmapHeader, 'biSizeImage', 0)
    DllStructSetData($tBitmapHeader, 'biXPelsPerMeter', 0)
    DllStructSetData($tBitmapHeader, 'biYPelsPerMeter', 0)
    DllStructSetData($tBitmapHeader, 'biClrUsed', 0)
    DllStructSetData($tBitmapHeader, 'biClrImportant', 0)

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

    ; Globale Daten füllen
    $_SGP2_aArea_0 = $iX
    $_SGP2_aArea_1 = $iY
    $_SGP2_aArea_2 = $iWidth
    $_SGP2_aArea_3 = $iHeight

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

    ; DIB-Section erstellen. $_SGP2_pBitmapBits ist ein Pointer direkt auf die
    ; Farbinformationen der DIB.
    $hBitmap = _WinAPI_CreateDIBSection(0, $tBitmapHeader, 0, $_SGP2_pBitmapBits)

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

    ; Struktur für Pixelfarbe erstellen
    $_SGP2_tStruct = DllStructCreate('dword[' & $iWidth * $iHeight & ']', $_SGP2_pBitmapBits)

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

    ; DIB in den Device Context laden.
    _WinAPI_SelectObject($_SGP2_hDC_Memory, $hBitmap)

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

    $_SGP2_hGDI32DLL = DllOpen('gdi32.dll')
    _ScreenGetPixel_2_Refresh()

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

    EndIf
    EndFunc ;==>_ScreenGetPixel_2_Startup

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

    ;==========================================================
    ; Aktualisiert die Pixelfarben, die in zwischen-
    ; gespeicherter Form vorliegen.
    ;==========================================================
    Func _ScreenGetPixel_2_Refresh($iX = -1, $iY = -1)
    Local Const $SRCCOPY = 0x00CC0020 ; WindowsConstants.au3

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

    ; Wenn X oder Y Koordinate nicht mitgegeben wurde,
    ; verwende die bei StartUp angegebenen Koordinaten als
    ; linke obere Ecke.
    If $iX = -1 Then $iX = $_SGP2_aArea_0
    If $iY = -1 Then $iY = $_SGP2_aArea_1

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

    ; Hier passiert die Maagie!
    __WinAPI_BitBlt($_SGP2_hDC_Memory, 0, 0, $_SGP2_aArea_2, $_SGP2_aArea_3, $_SGP2_hDC_Screen, $iX, $iY, $SRCCOPY)
    EndFunc ;==>_ScreenGetPixel_2_Refresh

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

    ;==========================================================
    ; Holt eine Pixelfarbe aus den Bitmap Bits der DIB
    ;==========================================================
    Func _ScreenGetPixel_2_GetPixel($iX, $iY)
    Return DllStructGetData($_SGP2_tStruct, 1, $iX + $iY * $_SGP2_aArea_2)
    EndFunc ;==>_ScreenGetPixel_2_GetPixel

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

    ;==========================================================
    ; Aufräumarbeiten. Sollte vor einem erneuten
    ; _ScreenGetPixel_2_Startup IMMER durchgeführt werden!
    ;==========================================================
    Func _ScreenGetPixel_2_Shutdown()
    ; DCs freigeben.
    _WinAPI_ReleaseDC(0, $_SGP2_hDC_Screen)
    _WinAPI_DeleteDC($_SGP2_hDC_Memory)

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

    ; Speicher für den Bitmapheader freigeben .
    _MemGlobalFree($_SGP2_hMem_Alloc)
    DllClose($_SGP2_hGDI32DLL)

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

    $_SGP2_hDC_Screen = 0
    $_SGP2_hDC_Memory = 0
    $_SGP2_pBitmapBits = 0
    $_SGP2_aArea_0 = 0
    $_SGP2_aArea_1 = 0
    $_SGP2_aArea_2 = 0
    $_SGP2_aArea_3 = 0
    EndFunc ;==>_ScreenGetPixel_2_Shutdown

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

    ; From WinAPIEx.au3
    ;
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _WinAPI_CreateDIBSection
    ; Description....: Creates a DIB that applications can write to directly.
    ; Syntax.........: _WinAPI_CreateDIBSection ( $hDC, $tBITMAPINFO, $iUsage, ByRef $pBits [, $hSection [, $iOffset]] )
    ; Parameters.....: $hDC - Handle to a device context. If the value of $iUsage is $DIB_PAL_COLORS, the function uses this
    ; device context's logical palette to initialize the DIB colors.
    ; $tBITMAPINFO - $tagBITMAPINFO structure that specifies various attributes of the DIB, including the bitmap
    ; dimensions and colors.
    ; $iUsage - The type of data contained in the $pBits array. (either logical palette indexes or literal RGB values).
    ; The following values are defined.
    ;
    ; $DIB_PAL_COLORS
    ; $DIB_RGB_COLORS
    ;
    ; $pBits - A pointer to the location of the DIB bit values.
    ; $hSection - Handle to a file-mapping object that the function will use to create the DIB.
    ; $iOffset - The offset from the beginning of the file-mapping object referenced by $hSection where storage
    ; for the bitmap bit values is to begin. This value is ignored if $hSection is 0.
    ; Return values..: Success - Handle to the newly created DIB, and $pBits points to the bitmap bit values. You can create the
    ; structure by using $pBits pointer to further its filling. For example,
    ; DllStructCreate('dword[4]', $pBits).
    ; Failure - 0 and sets the @error flag to non-zero, $pBits also is 0.
    ; Author.........: Yashied
    ; Modified.......:
    ; Remarks........: When you are finished using the icon, destroy it using the _WinAPI_DestroyIcon() function.
    ; Related........:
    ; Link...........: @@MsdnLink@@ CreateDIBSection
    ; Example........: Yes
    ; ===============================================================================================================================
    Func _WinAPI_CreateDIBSection($hDC, $tBITMAPINFO, $iUsage, ByRef $pBits, $hSection = 0, $iOffset = 0)

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

    Local $Ret = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', $hDC, 'ptr', DllStructGetPtr($tBITMAPINFO), 'uint', $iUsage, 'ptr*', 0, 'ptr', $hSection, 'dword', $iOffset)

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

    If (@error) Or (Not $Ret[0]) Then
    $pBits = 0
    Else
    $pBits = $Ret[4]
    EndIf
    Return SetError(Number(Not $Ret[0]), 0, $Ret[0])
    EndFunc ;==>_WinAPI_CreateDIBSection

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _WinAPI_BitBlt
    ; Description ...: Performs a bit-block transfer of color data
    ; Syntax.........: _WinAPI_BitBlt($hDestDC, $iXDest, $iYDest, $iWidth, $iHeight, $hSrcDC, $iXSrc, $iYSrc, $iROP)
    ; Parameters ....: $hDestDC - Handle to the destination device context
    ; $iXDest - X value of the upper-left corner of the destination rectangle
    ; $iYDest - Y value of the upper-left corner of the destination rectangle
    ; $iWidth - Width of the source and destination rectangles
    ; $iHeight - Height of the source and destination rectangles
    ; $hSrcDC - Handle to the source device context
    ; $iXSrc - X value of the upper-left corner of the source rectangle
    ; $iYSrc - Y value of the upper-left corner of the source rectangle
    ; $iROP - Specifies a raster operation code. These codes define how the color data for the source
    ; +rectangle is to be combined with the color data for the destination rectangle to achieve the final color:
    ; |$BLACKNESS - Fills the destination rectangle using the color associated with palette index 0
    ; |$CAPTUREBLT - Includes any window that are layered on top of your window in the resulting image
    ; |$DSTINVERT - Inverts the destination rectangle
    ; |$MERGECOPY - Merges the color of the source rectangle with the brush currently selected in hDest, by
    ; +using the AND operator.
    ; |$MERGEPAINT - Merges the color of the inverted source rectangle with the colors of the destination
    ; +rectangle by using the OR operator.
    ; |$NOMIRRORBITMAP - Prevents the bitmap from being mirrored
    ; |$NOTSRCCOPY - Copies the inverted source rectangle to the destination
    ; |$NOTSRCERASE - Combines the colors of the source and destination rectangles by using the OR operator and
    ; +then inverts the resultant color.
    ; |$PATCOPY - Copies the brush selected in hdcDest, into the destination bitmap
    ; |$PATINVERT - Combines the colors of the brush currently selected in hDest, with the colors of the
    ; +destination rectangle by using the XOR operator.
    ; |$PATPAINT - Combines the colors of the brush currently selected in hDest, with the colors of the
    ; +inverted source rectangle by using the OR operator. The result of this operation is combined with the color
    ; +of the destination rectangle by using the OR operator.
    ; |$SRCAND - Combines the colors of the source and destination rectangles by using the AND operator
    ; |$SRCCOPY - Copies the source rectangle directly to the destination rectangle
    ; |$SRCERASE - Combines the inverted color of the destination rectangle with the colors of the source
    ; +rectangle by using the AND operator.
    ; |$SRCINVERT - Combines the colors of the source and destination rectangles by using the XOR operator
    ; |$SRCPAINT - Combines the colors of the source and destination rectangles by using the OR operator
    ; |$WHITENESS - Fills the destination rectangle using the color associated with index 1 in the physical
    ; +palette.
    ; Return values .: Success - True
    ; Failure - False
    ; Author ........: Paul Campbell (PaulIA)
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........: @@MsdnLink@@ BitBlt
    ; Example .......:
    ; ===============================================================================================================================
    Func __WinAPI_BitBlt($hDestDC, $iXDest, $iYDest, $iWidth, $iHeight, $hSrcDC, $iXSrc, $iYSrc, $iROP)
    Local $aResult = DllCall($_SGP2_hGDI32DLL, "bool", "BitBlt", "handle", $hDestDC, "int", $iXDest, "int", $iYDest, "int", $iWidth, "int", $iHeight, _
    "handle", $hSrcDC, "int", $iXSrc, "int", $iYSrc, "dword", $iROP)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
    EndFunc ;==>__WinAPI_BitBlt

    [/autoit]
  • WinAPI: BitBlt sehr langsam, bei Verwendung von DIB

    • SEuBo
    • 13. März 2012 um 19:32

    Das schaut ja sehr gut aus. Liegt das tatsächlich nur an meinem Rechner? Ich bekomme nämlich

    Spoiler anzeigen
    Code
    @@ Debug(9) : $m = 250.395822193106
    >Error code: 0
    @@ Debug(13) : $m = 0.4038609998254892
    >Error code: 0
    @@ Debug(15) : $a = 4293981433
    >Error code: 0

    Das ist schonmal einen Zacken besser, aber immer noch viel zu langsam. o.o
    Was ist dein Ergebnis, wenn du den neuen Code (Startpost) durchlaufen lässt?

  • WinAPI: BitBlt sehr langsam, bei Verwendung von DIB

    • SEuBo
    • 13. März 2012 um 17:04

    Hallo,

    Ich habe folgendes Problem: Ich möchte eine Reihe von Pixelfarben in einem beliebigen DC auslesen. Das ganze soll aber ohne die API-Funktion 'GetPixel' funktionieren:
    Mein Plan war es, den Inhalt des DC in eine HBitmap zu BitBlt'en. Das funktioniert auch super.

    Allerdings komme ich dann nur an die rohen Farbdaten, wenn ich diese entweder mit Hilfe von
    - LockBits() (was vorher eine Umwandlung der HBitmap in ein GDI+-Bitmap-Objekt erfordern würde),
    - oder CreateDIBSection auslese.

    BitmapLockBits ist für mich ein alter Hut - mich stört lediglich die unnötige Verschwendung von Performance, da die Bitmap-Bits erst in einen Buffer kopiert werden - weswegen ich mich für CreateDIBSection entschieden habe. Laut MSDN wird hier direkter zugriff auf die DIBits ermöglicht. Klingt ja sehr performant!

    Jetzt kommen wir zum eigentlichen Problem:
    Bei der Verwendung von CreateDIBSection ist BitBlt extrem(!) langsam - mehrere hundert millisekunden (600+ ms) ist für mich absolut nicht tragbar. Kann mir jemand sagen, warum die performance hier so mies ist? Oder am besten mit einem Verbesserungsvorschlag um die Ecke kommen? Mir ist ja bewusst, dass BitBlt hier eventuell einige kleine Konversionen durchführen muss, aber die DC's sind doch untereinander kompatibel und die DIB hat die gleiche Farbtiefe, wie der Screen-DC. Ich versteh's nicht.
    /Edit: Neuer, Kommentierter Code.

    Spoiler anzeigen
    [autoit]

    #include <Memory.au3>
    #include <WindowsConstants.au3>
    #include <WinAPI.au3>

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

    Global $_SGP2_hDC_Screen, $_SGP2_hDC_Memory, $_SGP2_pBitmapBits, $_SGP2_hMem_Alloc, $_SGP2_aArea[4]

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

    _ScreenGetPixel_2_Startup(100, 100) ; 100x100 großer DIB-Bereich

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

    $iSum = 0
    For $i = 1 To 10
    $iTimer = TimerInit()
    _ScreenGetPixel_2_Refresh(Random(0, 300, 1), Random(0, 300, 1)) ; einen 100x100 Bereich irgendwo ab X: 0-300, Y: 0-300 übertragen

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

    For $y = 0 To 99
    For $x = 0 To 99
    _ScreenGetPixel_2_GetPixel($x, $y)
    Next
    Next

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

    $iTimer = TimerDiff($iTimer)
    $iSum += $iTimer
    ConsoleWrite('Durchgang #' & $i & ': ' & $iTimer & @CRLF)
    Next

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

    ConsoleWrite('Gesamt: ' & $iSum & @CRLF)
    ConsoleWrite('Durchschnitt: ' & $iSum / $i & @CRLF)
    _ScreenGetPixel_2_Shutdown()

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

    ;==========================================================
    ; Übergeben werden muss die Größe des Bildschirmbereiches,
    ; der später übertragen werden soll. Je größer der Bereich, desto
    ; länger dauert das BitBlt beim _ScreenGetPixel_2_Refresh()
    ;==========================================================
    Func _ScreenGetPixel_2_Startup($iWidth, $iHeight, $iX = 0, $iY = 0)
    Local Const $tagBITMAPINFOHEADER = 'dword biSize;long biWidth;long biHeight;ushort biPlanes;ushort biBitCount;dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant;'

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

    Local $pBitmapHeader, $tBitmapHeader

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

    ; Wir holen uns zuerst den DC vom Desktop.
    $_SGP2_hDC_Screen = _WinAPI_GetDC(0)

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

    ; Dazu erstellen wir uns noch einen kompatiblen DC im Memory, der
    ; mit der DIB verknüpft wird. Wenn wir ein BitBlt in diesen DC machen,
    ; und die Farbinformationen vom Desktop-DC übertragen, enthält die DIB
    ; unsere Farbdaten.
    $_SGP2_hDC_Memory = _WinAPI_CreateCompatibleDC($_SGP2_hDC_Screen)
    ; Speicher für Bitmap-Header reservieren
    $_SGP2_hMem_Alloc = _MemGlobalAlloc(40, $GMEM_FIXED)

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

    If Not @error Then
    ; Pointer des reservierten Speichers holen
    $pBitmapHeader = _MemGlobalLock($_SGP2_hMem_Alloc)
    ; BitmapHeader in reserviertem Speicherbereich erstellen
    $tBitmapHeader = DllStructCreate($tagBITMAPINFOHEADER, $pBitmapHeader)

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

    ; Bitmapinfos ausfüllen
    DllStructSetData($tBitmapHeader, 'biSize', DllStructGetSize($tBitmapHeader))
    DllStructSetData($tBitmapHeader, 'biWidth', $iWidth)
    DllStructSetData($tBitmapHeader, 'biHeight', $iHeight)
    DllStructSetData($tBitmapHeader, 'biPlanes', 1)
    DllStructSetData($tBitmapHeader, 'biBitCount', @DesktopDepth)
    DllStructSetData($tBitmapHeader, 'biCompression', 0)
    DllStructSetData($tBitmapHeader, 'biSizeImage', 0)
    DllStructSetData($tBitmapHeader, 'biXPelsPerMeter', 0)
    DllStructSetData($tBitmapHeader, 'biYPelsPerMeter', 0)
    DllStructSetData($tBitmapHeader, 'biClrUsed', 0)
    DllStructSetData($tBitmapHeader, 'biClrImportant', 0)

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

    ; Globale Daten füllen
    $_SGP2_aArea[0] = $iX
    $_SGP2_aArea[1] = $iY
    $_SGP2_aArea[2] = $iWidth
    $_SGP2_aArea[3] = $iHeight

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

    ; DIB-Section erstellen. $_SGP2_pBitmapBits ist ein Pointer direkt auf die
    ; Farbinformationen der DIB.
    $hBitmap = _WinAPI_CreateDIBSection(0, $tBitmapHeader, 0, $_SGP2_pBitmapBits)

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

    ; DIB in den Device Context laden.
    _WinAPI_SelectObject($_SGP2_hDC_Memory, $hBitmap)

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

    _ScreenGetPixel_2_Refresh()

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

    EndIf
    EndFunc ;==>_ScreenGetPixel_2_Startup

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

    ;==========================================================
    ; Aktualisiert die Pixelfarben, die in zwischen-
    ; gespeicherter Form vorliegen.
    ;==========================================================
    Func _ScreenGetPixel_2_Refresh($iX = -1, $iY = -1)
    Local Const $SRCCOPY = 0x00CC0020 ; WindowsConstants.au3

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

    ; Wenn X oder Y Koordinate nicht mitgegeben wurde,
    ; verwende die bei StartUp angegebenen Koordinaten als
    ; linke obere Ecke.
    If $iX = -1 Then $iX = $_SGP2_aArea[0]
    If $iY = -1 Then $iY = $_SGP2_aArea[1]

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

    ; Hier passiert die Maagie!
    _WinAPI_BitBlt($_SGP2_hDC_Memory, 0, 0, $_SGP2_aArea[2], $_SGP2_aArea[3], $_SGP2_hDC_Screen, $iX, $iY, $SRCCOPY)
    EndFunc ;==>_ScreenGetPixel_2_Refresh

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

    ;==========================================================
    ; Holt eine Pixelfarbe aus den Bitmap Bits der DIB
    ;==========================================================
    Func _ScreenGetPixel_2_GetPixel($iX = 0, $iY = 0)
    Local $tStruct, $iReturn
    ; Struktur für Pixelfarbe erstellen
    $tStruct = DllStructCreate("dword", $_SGP2_pBitmapBits + ($iX * 4) + ($iY * $_SGP2_aArea[2] * 4))
    ; Farbe auslesen
    $iReturn = DllStructGetData($tStruct, 1)
    ; Struktur freigeben
    $tStruct = 0
    Return $iReturn
    EndFunc ;==>_ScreenGetPixel_2_GetPixel

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

    ;==========================================================
    ; Aufräumarbeiten. Sollte vor einem erneuten
    ; _ScreenGetPixel_2_Startup IMMER durchgeführt werden!
    ;==========================================================
    Func _ScreenGetPixel_2_Shutdown()
    ; DCs freigeben.
    _WinAPI_ReleaseDC(0, $_SGP2_hDC_Screen)
    _WinAPI_DeleteDC($_SGP2_hDC_Memory)

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

    ; Speicher für den Bitmapheader freigeben .
    _MemGlobalFree($_SGP2_hMem_Alloc)

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

    $_SGP2_hDC_Screen = 0
    $_SGP2_hDC_Memory = 0
    $_SGP2_pBitmapBits = 0
    $_SGP2_aArea[0] = 0
    $_SGP2_aArea[1] = 0
    $_SGP2_aArea[2] = 0
    $_SGP2_aArea[3] = 0
    EndFunc ;==>_ScreenGetPixel_2_Shutdown

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

    ; From WinAPIEx.au3
    ;
    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _WinAPI_CreateDIBSection
    ; Description....: Creates a DIB that applications can write to directly.
    ; Syntax.........: _WinAPI_CreateDIBSection ( $hDC, $tBITMAPINFO, $iUsage, ByRef $pBits [, $hSection [, $iOffset]] )
    ; Parameters.....: $hDC - Handle to a device context. If the value of $iUsage is $DIB_PAL_COLORS, the function uses this
    ; device context's logical palette to initialize the DIB colors.
    ; $tBITMAPINFO - $tagBITMAPINFO structure that specifies various attributes of the DIB, including the bitmap
    ; dimensions and colors.
    ; $iUsage - The type of data contained in the $pBits array. (either logical palette indexes or literal RGB values).
    ; The following values are defined.
    ;
    ; $DIB_PAL_COLORS
    ; $DIB_RGB_COLORS
    ;
    ; $pBits - A pointer to the location of the DIB bit values.
    ; $hSection - Handle to a file-mapping object that the function will use to create the DIB.
    ; $iOffset - The offset from the beginning of the file-mapping object referenced by $hSection where storage
    ; for the bitmap bit values is to begin. This value is ignored if $hSection is 0.
    ; Return values..: Success - Handle to the newly created DIB, and $pBits points to the bitmap bit values. You can create the
    ; structure by using $pBits pointer to further its filling. For example,
    ; DllStructCreate('dword[4]', $pBits).
    ; Failure - 0 and sets the @error flag to non-zero, $pBits also is 0.
    ; Author.........: Yashied
    ; Modified.......:
    ; Remarks........: When you are finished using the icon, destroy it using the _WinAPI_DestroyIcon() function.
    ; Related........:
    ; Link...........: @@MsdnLink@@ CreateDIBSection
    ; Example........: Yes
    ; ===============================================================================================================================
    Func _WinAPI_CreateDIBSection($hDC, $tBITMAPINFO, $iUsage, ByRef $pBits, $hSection = 0, $iOffset = 0)

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

    Local $Ret = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', $hDC, 'ptr', DllStructGetPtr($tBITMAPINFO), 'uint', $iUsage, 'ptr*', 0, 'ptr', $hSection, 'dword', $iOffset)

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

    If (@error) Or (Not $Ret[0]) Then
    $pBits = 0
    Else
    $pBits = $Ret[4]
    EndIf
    Return SetError(Number(Not $Ret[0]), 0, $Ret[0])
    EndFunc ;==>_WinAPI_CreateDIBSection

    [/autoit]


    Alter Code, den ich ursprünglich gepostet hatte:

    Spoiler anzeigen
    [autoit][/autoit]
    Spoiler anzeigen
    [autoit]

    [autoit]#include <Memory.au3>
    #include <WinAPIEx.au3>
    #include <WindowsConstants.au3>

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

    Global $_SGP2_hDC_Screen, $_SGP2_hDC_Memory, $_SGP2_pBitmapBits, $_SGP2_hMem_Alloc, $_SGP2_aArea[4]

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

    ;==========================================================
    ; Übergeben werden muss der Bildschirmbereich, in dem
    ; später gesucht werden soll. Je größer der bereich, desto
    ; länger dauert das BitBlt beim _ScreenGetPixel_2_Refresh()
    ;==========================================================
    Func _ScreenGetPixel_2_Startup($iX, $iY, $iWidth, $iHeight)
    Local $pBitmapHeader, $tBitmapHeader

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

    $_SGP2_hDC_Screen = _WinAPI_GetDC(0)
    $_SGP2_hDC_Memory = _WinAPI_CreateCompatibleDC($_SGP2_hDC_Screen)
    $_SGP2_hMem_Alloc = _MemGlobalAlloc(40, $GMEM_FIXED)

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

    If Not @error Then
    $pBitmapHeader = _MemGlobalLock($_SGP2_hMem_Alloc)
    $tBitmapHeader = DllStructCreate($tagBITMAPINFOHEADER, $pBitmapHeader)

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

    DllStructSetData($tBitmapHeader, 'biSize', DllStructGetSize($tBitmapHeader))
    DllStructSetData($tBitmapHeader, 'biWidth', Abs($iWidth))
    DllStructSetData($tBitmapHeader, 'biHeight', Abs($iHeight))
    DllStructSetData($tBitmapHeader, 'biPlanes', 1)
    DllStructSetData($tBitmapHeader, 'biBitCount', @DesktopDepth)
    DllStructSetData($tBitmapHeader, 'biCompression', 0)
    DllStructSetData($tBitmapHeader, 'biSizeImage', 0)
    DllStructSetData($tBitmapHeader, 'biXPelsPerMeter', 0)
    DllStructSetData($tBitmapHeader, 'biYPelsPerMeter', 0)
    DllStructSetData($tBitmapHeader, 'biClrUsed', 0)
    DllStructSetData($tBitmapHeader, 'biClrImportant', 0)

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

    $_SGP2_aArea[0] = $iX
    $_SGP2_aArea[1] = $iY
    $_SGP2_aArea[2] = $iWidth
    $_SGP2_aArea[3] = $iHeight

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

    $hBitmap = _WinAPI_CreateDIBSection(0, $tBitmapHeader, 0, $_SGP2_pBitmapBits)
    _WinAPI_SelectObject($_SGP2_hDC_Memory, $hBitmap)
    _MemGlobalFree($_SGP2_hMem_Alloc)

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

    _ScreenGetPixel_2_Refresh()

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

    EndIf
    EndFunc ;==>_ScreenGetPixel_2_Startup

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

    ;==========================================================
    ; Aktualisiert die Pixelfarben, die in zwischen-
    ; gespeicherter Form vorliegen.
    ;==========================================================
    Func _ScreenGetPixel_2_Refresh($iX = -1, $iY = -1)
    Local Const $SRCCOPY = 0x00CC0020 ; WindowsConstants.au3

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

    If $iX = -1 Then $iX = $_SGP2_aArea[0]
    If $iY = -1 Then $iY = $_SGP2_aArea[1]
    _WinAPI_BitBlt($_SGP2_hDC_Memory, 0, 0, $_SGP2_aArea[2], $_SGP2_aArea[3], $_SGP2_hDC_Screen, $iX, $iY, $SRCCOPY)
    EndFunc ;==>_ScreenGetPixel_2_Refresh

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

    ;==========================================================
    ; Holt eine Pixelfarbe aus dem Zwischenspeicher
    ;==========================================================
    Func _ScreenGetPixel_2_GetPixel($iX, $iY)
    Local $tStruct, $iReturn
    $tStruct = DllStructCreate("dword", $_SGP2_pBitmapBits + ($iX * 4) + ($iY * $_SGP2_aArea[2] * 4))
    $iReturn = DllStructGetData($tStruct, 1)
    $tStruct = 0
    Return $iReturn
    EndFunc ;==>_ScreenGetPixel_2_GetPixel

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

    ;==========================================================
    ; Aufräumarbeiten. Sollte vor einem erneuten
    ; _ScreenGetPixel_2_Startup IMMER durchgeführt werden!
    ;==========================================================
    Func _ScreenGetPixel_2_Shutdown()
    _WinAPI_ReleaseDC(0, $_SGP2_hDC_Screen)
    _WinAPI_DeleteDC($_SGP2_hDC_Memory)

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

    $_SGP2_hDC_Screen = 0
    $_SGP2_hDC_Memory = 0
    $_SGP2_pBitmapBits = 0
    $_SGP2_aArea[0] = 0
    $_SGP2_aArea[1] = 0
    $_SGP2_aArea[2] = 0
    $_SGP2_aArea[3] = 0
    EndFunc ;==>_ScreenGetPixel_2_Shutdown

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


    Gruß, SEuBo

  • Nach Buttonklick nachfolgenden Code als Admin ausführen

    • SEuBo
    • 13. März 2012 um 15:32
    Zitat von CyRoX

    Ist es also möglich, nur ab einem bestimmten Codeteil Adminrechte anzufordern?


    Einfach in ein neues Script auslagern. Das geht sogar zur Laufzeit.

    Spoiler anzeigen
    [autoit]

    $hGUI = GUICreate('', 100, 30)
    $cButton = GUICtrlCreateButton('Admin!', 5, 5, 90, 20)
    GUISetState()

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case -3
    Exit
    Case $cButton
    _CodeAlsAdminAusfuehren('MsgBox(0, "", "Wird MsgBox wird als Admin ausgeführt! IsAdmin() = " & String(IsAdmin()))')
    EndSwitch
    WEnd

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

    Func _CodeAlsAdminAusfuehren($sCode)
    FileDelete(@TempDir & '\~tempscript.au3')

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

    FileWrite(@TempDir & '\~tempscript.au3', _
    '#RequireAdmin' & @CRLF & _
    $sCode _
    )

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

    RunWait('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & @TempDir & '\~tempscript.au3"', @TempDir, @SW_SHOW)
    EndFunc ;==>_CodeAlsAdminAusfuehren

    [/autoit]
  • URL Verknüpung auf dem offentlichen Desktop mit Icon

    • SEuBo
    • 12. März 2012 um 13:52

    Warum legt ihr nicht einfach statt der Verknüpfung eine .exe an, die als Verknüfpung dient.

    [autoit]

    ShellExecute("http://www.google.de")

    [/autoit]


    Und das Icon könnt ihr für die .exe doch setzen, wie ihr wollt...

  • WinHttp Headers vom Request

    • SEuBo
    • 11. März 2012 um 00:25
    Zitat von DarkManX

    Worauf verweist nun dieser RequestHandle?


    Dieser Request-Handle ist ein sogenannter hInternet-Handle. Und ja, es gibt mit Sicherheit eine Möglichkeit, diese Request Headers auszulesen. Nur ist das von Microsoft wohl nicht vorgesehen, und deswegen auch nicht über die integrierten Funktionen der WinHTTP API zu lösen. Die Möglichkeit, einen Sniffer zu verwenden ist mit Sicherheit die unkomplizierteste ;)

  • Leichte StringRegExpReplace-Pattern

    • SEuBo
    • 10. März 2012 um 20:31
    Zitat von $var

    Eins, das alle @CR, @LF und @CRLF aus einem String entfernt.
    Und eins, das alle nicht-alphanumerischen Zeichen entfernt. (!, @, #, $ usw.)


    Geht übrigens auch in einem ;)

    [autoit]

    StringRegExpReplace($sString, '[\r\n\W]', '')

    [/autoit]
  • WinHttp Headers vom Request

    • SEuBo
    • 10. März 2012 um 20:24
    Zitat von chip

    Ein Request ist die Antwort des Servers.


    Eine RESPONSE ist die Antwort des Servers!

    Zitat von DarkManX

    Ich will aber irgendwie die Headers der Anfrage auslesen.


    WinHTTP-Intern kenne ich dafür keine Möglichkeit.
    Mein Tipp: Benutze einen HTTP/HTTPS-Sniffer, wie "Fiddler2" dafür, damit funktioniert es problemlos. Du darfst nur nicht vergessen, den WinHTTP-Traffic über Fiddler zu leiten, also Fiddler als Proxy für WinHTTP zu setzen. ( Standardmäßig nutzt Fiddler glaube ich 127.0.0.1:8888 )

  • SciTE - Variablen- und Funktions- Tipp (CallTipp oder Konsolenausgabe) per HotKey od. Kontextmenü, Suche nach Variable [v0.11]

    • SEuBo
    • 7. März 2012 um 11:12
    Zitat von BugFix

    Niemals einen Variablennamen zweimal verwenden. Das erspart viel Fehlersuche. Einzige Doppel, die Sinn machen sind z.B. $sRead, $sTmp etc. - also Variablen die nur kurzzeitig belegt werden und da ist eine Beschreibung überflüssig.


    Also ich verwende oft gleiche Variablennamen - eben bei den von dir angesprochenen Fällen. Da gibt's aber nicht nur $sRead und sTmp, sondern auch $sString, $aArray, $aReturn, $sReturn, $hDC, $hBitmap, $hHBitmap, $aSplit, $iCount, $hWnd, $sTitle, usw usw.. Ich persönlich, fänd's sinnvoll - ob du das einbaust oder nicht, bleibt dir überlassen. Es war nur eine Idee.

    Zitat von BugFix

    Sorry, aber da stehe ich auf dem Schlauch. Was um Himmels Willen ist ein "L-Wert"?


    Der L-Wert ist der Wert auf der linken Seite einer Zuweisung. $L_Wert = $R_Wert
    http://de.wikipedia.org/wiki/Variable_…t_von_Variablen

  • SciTE - Variablen- und Funktions- Tipp (CallTipp oder Konsolenausgabe) per HotKey od. Kontextmenü, Suche nach Variable [v0.11]

    • SEuBo
    • 6. März 2012 um 17:31

    Hallo BugFix,

    Was ist mit verschiedenen Gültigkeitsbereichen? Die werden wahrscheinlich nicht beachtet, oder? Wäre doch eventuell praktisch: Man könnte Variablen mit gleichem Namen in unterschiedlichen Funktionen unterschiedliche "Tipps" zuweisen.

    Auch würde es Schreibarbeit ersparen, wenn man zum Beispiel mit einem einfachen ;@ [TIPP] die zuletzt als L-Wert verwendete Variable mit einem Tipp versehen könnte.

    [autoit]

    $Variable1 = 245
    ;@ Das ist der Tip für $Variable 1
    ConsoleWrite($Variable & @CRLF)
    $Variable2 = StringLeft($Variable1,2)
    ConsoleWrite($Variable & @CRLF)
    ;@ Hier kommt noch der Tipp für $Variable2

    [/autoit]

    Gruß

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

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