Beiträge von UEZ
-
-
-
-
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
;Example by UEZ
;#NoTrayIcon
#include <GDIPlus.au3>
#include <Misc.au3>Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $hWnd, $hGraphic, $hBitmap, $hBackbuffer, $hImage
[/autoit] [autoit][/autoit] [autoit]
Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
Global $title = "GDI+ Beispiel: Text spiegeln", _
$width = 500, _
$height = 130Global $reflect, $MousePos
[/autoit] [autoit][/autoit] [autoit]$hWnd = GUICreate($title, $width, $height, -1, -1, 0x80000000, BitOR(0x00000080, 0x00080000, 0x00000008))
[/autoit] [autoit][/autoit] [autoit]_Startup()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsClear($hBackbuffer, 0x00000000)
Draw_Text($hBackbuffer, "Spiegel Schrift", $width, $height)_GDIPlus_GraphicsReflectImageRect($hBackbuffer, $hBitmap, 0, 60, -1, 40, 0)
[/autoit] [autoit][/autoit] [autoit]$gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_WinAPI_SelectObject($dc, $gdibitmap)
_WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
_WinAPI_DeleteObject($gdibitmap)
_GDIClose()
GUISetOnEvent(-3, "_Close")
GUISetState()While Sleep(100000)
[/autoit] [autoit][/autoit] [autoit]
WEndFunc Draw_Text($hGFX, $text, $w, $h, $fs = 40, $fn = "Comic Sans MS", $fc = 0xFF0000A0, $fa = 1)
[/autoit] [autoit][/autoit] [autoit]
$hBrush = _GDIPlus_BrushCreateSolid($fc)
$hFamily = _GDIPlus_FontFamilyCreate($fn)
$hFont = _GDIPlus_FontCreate($hFamily, $fs)
$hLayout = _GDIPlus_RectFCreate(0, 0, $w, $h)
$hStringFormat = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($hStringFormat, $fa)
_GDIPlus_GraphicsDrawStringEx($hGFX, $text, $hFont, $hLayout, $hStringFormat, $hBrush)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_FontDispose($hFont)
_GDIPlus_StringFormatDispose($hStringFormat)
EndFuncFunc _Startup()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)$ScreenDc = _WinAPI_GetDC($hWnd)
[/autoit] [autoit][/autoit] [autoit]
$dc = _WinAPI_CreateCompatibleDC($ScreenDc)$tSize = DllStructCreate($tagSIZE)
[/autoit] [autoit][/autoit] [autoit]
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", $width)
DllStructSetData($tSize, "Y", $height)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", 0xFF)
DllStructSetData($tBlend, "Format", 1)
$tPoint = DllStructCreate($tagPOINT)
$pPoint = DllStructGetPtr($tPoint)
DllStructSetData($tPoint, "X", 0)
DllStructSetData($tPoint, "Y", 0)
EndFuncFunc _GDIClose()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_ImageDispose($hImage)
_GDIPlus_GraphicsDispose($hBackbuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFuncFunc _Close()
[/autoit] [autoit][/autoit] [autoit]
Exit
EndFunc; #FUNCTION# ==========================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; Name...........: _GDIPlus_GraphicsReflectImageRect
; Description ...: Spiegelt ein Bildobjekt mit abfallender Transparents und einstellbarer Schräge.
; Syntax.........: _GDIPlus_GraphicsReflectImageRect($hGraphic, $hImage, $xpos, $ypos, [$dwidth, [$dheight, [$divx]]])
; Parameters ....: $hGraphics - Handle zu einem Graphicobjekt
; $hImage - Handle zu einem Bildobjekt
; $xpos - Die X Koordinate des Startzeichenpunktes
; $ypos - Die Y Koordinate des Startzeichenpunktes
; $dwidth - Breite des zu zeichnenden Bildes
; $dheight - Höhe des zu zeichnenden Bildes (!FEHLERHAFT)
; $divx - Die Anzahl der Pixel, die pro Zeile nach links eingerückt werden
; Return values .: Success - True
; Failure - @error
; Author ........: h2112
; Remarks .......: Die Funktion _GDIPlus_GraphicsDrawImageRectRectTrans wird benötigt
;======================================================================================================================
Func _GDIPlus_GraphicsReflectImageRect($hGraphic, $hImage, $xpos, $ypos, $dwidth = -1, $dheight = -1, $divx = 0.7)
Local $height, $width, $clone, $stat, $check
Local $divy, $divtrans, $trans, $x, $y, $olddivy$height = _GDIPlus_ImageGetHeight($hImage)
[/autoit] [autoit][/autoit] [autoit]
$width = _GDIPlus_ImageGetWidth($hImage)If $dheight = -1 Then $dheight = $height
[/autoit] [autoit][/autoit] [autoit]
If $dwidth = -1 Then $dwidth = $width$divtrans = 255 / $height
[/autoit] [autoit][/autoit] [autoit]
$divy = $dheight / $heightFor $i = $height To 0 Step -1
[/autoit] [autoit][/autoit] [autoit]
$trans = 1 / 255 * $divtrans * $i
$x = $divx * ($height - $i)
$y = $divy * ($height - $i)
If Int($y) <> Int($divy) * ($height - $i) + $stat Then
$stat += 1
$check = 1
$olddivy = $divy
$divy += Int($y) - Int($divy) * ($height - $i) + $stat
EndIf
$clone = _GDIPlus_BitmapCloneArea($hImage, 0, $i, $width, 1, $GDIP_PXF64PARGB)
_GDIPlus_GraphicsDrawImageRectRectTrans($hGraphic, $clone, 0, 0, $width, $height, $xpos - $x, $y + $ypos, $dwidth, $divy, "", $trans)
If $check = 1 Then
$divy = $olddivy
$check = 0
EndIf
Next
If Not @error Then
Return True
Else
Return @error
EndIf
EndFunc; #FUNCTION# ===================================================================================================
[/autoit]
; Name...........: _GDIPlus_GraphicsDrawImageRectRectTrans
; Description ...: Draw an Image object with transparency
; Syntax.........: _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hImage, $iSrcX, $iSrcY, [$iSrcWidth, _
; [$iSrcHeight, [$iDstX, [$iDstY, [$iDstWidth, [$iDstHeight[, [$iUnit = 2]]]]]]])
; Parameters ....: $hGraphics - Handle to a Graphics object
; $hImage - Handle to an Image object
; $iSrcX - The X coordinate of the upper left corner of the source image
; $iSrcY - The Y coordinate of the upper left corner of the source image
; $iSrcWidth - Width of the source image
; $iSrcHeight - Height of the source image
; $iDstX - The X coordinate of the upper left corner of the destination image
; $iDstY - The Y coordinate of the upper left corner of the destination image
; $iDstWidth - Width of the destination image
; $iDstHeight - Height of the destination image
; $iUnit - Specifies the unit of measure for the image
; $nTrans - Value range from 0 (Zero for invisible) to 1.0 (fully opaque)
; Return values .: Success - True
; Failure - False
; Author ........: Siao
; Modified.......: Malkey
; Remarks .......:
; Related .......:
; Link ..........; http://www.autoitscript.com/forum/index.ph…ndpost&p=517195
; Example .......; Yes
Func _GDIPlus_GraphicsDrawImageRectRectTrans($hGraphics, $hImage, $iSrcX, $iSrcY, $iSrcWidth = "", $iSrcHeight = "", _
$iDstX = "", $iDstY = "", $iDstWidth = "" , $iDstHeight = "", $iUnit = 2, $nTrans = 1)
Local $tColorMatrix, $x, $hImgAttrib, $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage)
If $iSrcWidth = 0 or $iSrcWidth = "" Then $iSrcWidth = $iW
If $iSrcHeight = 0 or $iSrcHeight = "" Then $iSrcHeight = $iH
If $iDstX = "" Then $iDstX = $iSrcX
If $iDstY = "" Then $iDstY = $iSrcY
If $iDstWidth = "" Then $iDstWidth = $iSrcWidth
If $iDstHeight = "" Then $iDstHeight = $iSrcHeight
If $iUnit = "" Then $iUnit = 2
;;create color matrix data
$tColorMatrix = DllStructCreate("float[5];float[5];float[5];float[5];float[5]")
;blending values:
$x = DllStructSetData($tColorMatrix, 1, 1, 1) * DllStructSetData($tColorMatrix, 2, 1, 2) * DllStructSetData($tColorMatrix, 3, 1, 3) * _
DllStructSetData($tColorMatrix, 4, $nTrans, 4) * DllStructSetData($tColorMatrix, 5, 1, 5)
;;create an image attributes object and update its color matrix
$hImgAttrib = DllCall($ghGDIPDll, "int", "GdipCreateImageAttributes", "ptr*", 0)
$hImgAttrib = $hImgAttrib[1]
DllCall($ghGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, _
"int", 1, "ptr", DllStructGetPtr($tColorMatrix), "ptr", 0, "int", 0)
;;draw image into graphic object with alpha blend
DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGraphics, "hwnd", $hImage, "int", $iDstX, "int", _
$iDstY, "int", $iDstWidth, "int", $iDstHeight, "int", $iSrcX, "int", $iSrcY, "int", $iSrcWidth, "int", _
$iSrcHeight, "int", $iUnit, "ptr", $hImgAttrib, "int", 0, "int", 0)
;;clean up
DllCall($ghGDIPDll, "int", "GdipDisposeImageAttributes", "ptr", $hImgAttrib)
Return
EndFunc ;==>_GDIPlus_GraphicsDrawImageRectRectTransIst eine Modifikation des Beispiels von H2112: _GDIPlus_GraphicsReflectImageRect
Gruß,
UEZ
-
Freut mich, dass ich dir helfen konnte!

Gruß,
UEZ
-
Alles anzeigen
Hallo UEZ,
Funktioniert das jetzt besser auf deinem Dual-Monitor?Spoiler anzeigen
[autoit]#include <Array.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <WindowsConstants.au3>
HotKeySet("{ESC}", "_Exit") ; Set the Hotkey to exit.
$hDLL = DllOpen("user32.dll") ; Open the DLL for _WinIsHovered() (faster with DLL-handle)$h_Left = GUICreate("SlideGUI left", 155, 350, -1, -1, -1, $WS_EX_TOPMOST)
[/autoit] [autoit][/autoit] [autoit]
$_Button1 = GUICtrlCreateButton("Example Button", 40, 40, 100, 30)
GUICtrlCreateEdit("Sample Edit...", 20, 90, 120, 200)
$h_Right = GUICreate("SlideGUI Right", 155, 350, -1, -1, -1, $WS_EX_TOPMOST)
GUICtrlCreateEdit("Sample Edit...", 20, 20, 150, 300)
$h_Bottom = GUICreate("SlideGUI Bottom", 350, 155, -1, -1, -1, $WS_EX_TOPMOST)
GUICtrlCreateCheckbox("Sample Checkbox", 40, 30)
GUICtrlCreateCombo("Combo", 140, 50)
$h_Top = GUICreate("SlideGUI Top", 350, 155, -1, -1, -1, $WS_EX_TOPMOST)
$_ListView = GUICtrlCreateListView("Columnd 1|Column 2", 5, 5, 340, 145)
GUICtrlCreateListViewItem("Item 1_1|Item 1_2",$_ListView)
GUICtrlCreateListViewItem("Item 2_1|Item 2_2",$_ListView)
GUICtrlCreateListViewItem("Item 3_1|Item 3_2",$_ListView); Move GUI's to the right place and set the Variables State to False
[/autoit] [autoit][/autoit] [autoit]
Global $LEFT_IN = False, $RIGHT_IN = False, $BOTTOM_IN = False, $TOP_IN = False
_SlideWin($h_Left, "out", "left")
_SlideWin($h_Right, "out", "right")
_SlideWin($h_Bottom, "out", "bottom")
_SlideWin($h_Top, "out", "top"); Show GUI's
[/autoit] [autoit][/autoit] [autoit]
GUISetState(@SW_SHOWNOACTIVATE, $h_Left)
GUISetState(@SW_SHOWNOACTIVATE, $h_Right)
GUISetState(@SW_SHOWNOACTIVATE, $h_Bottom)
GUISetState(@SW_SHOWNOACTIVATE, $h_Top)While 1 * Sleep(10)
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg(1)
Select
Case $nMsg[0] = -3
Exit
Case $nMsg[0] = $_Button1
MsgBox(0, "", "Example Button clicked.")
Case _WinIsHovered($h_Left, $hDLL) ; Check if we need to Slide in a GUI.
If Not $LEFT_IN Then ; If not already slide-in,
_SlideWin($h_Left, "in", "left") ; Slide in GUI
$LEFT_IN = True ; Set var to True.
EndIf
Case _WinIsHovered($h_Right, $hDLL)
If Not $RIGHT_IN Then
_SlideWin($h_Right, "in", "right")
$RIGHT_IN = True
EndIf
Case _WinIsHovered($h_Bottom, $hDLL)
If Not $BOTTOM_IN Then
_SlideWin($h_Bottom, "in", "bottom")
$BOTTOM_IN = True
EndIf
Case _WinIsHovered($h_Top, $hDLL)
If Not $TOP_IN Then
_SlideWin($h_Top, "in", "top")
$TOP_IN = True
EndIf
Case Else ; No window is hovered. Check if we need to Slide out a GUI.
Select
Case $LEFT_IN
_SlideWin($h_Left, "out", "left")
$LEFT_IN = False
Case $RIGHT_IN
_SlideWin($h_Right, "out", "right")
$RIGHT_IN = False
Case $TOP_IN
_SlideWin($h_Top, "out", "top")
$TOP_IN = False
Case $BOTTOM_IN
_SlideWin($h_Bottom, "out", "bottom")
$BOTTOM_IN = False
EndSelect
EndSelect
WEndFunc _SlideWin($hWnd, $sMode, $sSide)
[/autoit] [autoit][/autoit] [autoit]
;$hWnd = Window to slide.
;$sMode = Slide-In or -out (in|out)
;$sSide = Side where you want the GUI to slide. (left|right|top|bottom)
Local $aScreen_Res = WinGetPos(WinGetHandle("Program Manager"))
Local $aWPos = WinGetPos($hWnd), $m = 0 - ($sMode = "in") + ($sMode = "out")
Local $h = 0 - ($sSide = "left") + ($sSide = "right"), $v = 0 - ($sSide = "top") + ($sSide = "bottom")WinMove($hWnd, "", _ ; Move GUI according to $sMode and $sSide.
[/autoit] [autoit][/autoit] [autoit]
0 - (($h = -1) * ($m = -1) * ($aWPos[2] - 10)) _
+ (($h = 1) * (($h = 1) * $aScreen_Res[2] - (10 * ($m = -1)) - ($m <> -1) * $aWPos[2])) _
+ (($h = 0) * (($h = 0) * ($aScreen_Res[2] / 2) - ($aWPos[2] / 2))) _
, _
0 - (($v = -1) * ($m = -1) * ($aWPos[3] - 10)) _
+ (($v = 1) * (($v = 1) * $aScreen_Res[3] - (10 * ($m = -1)) - ($m <> -1) * $aWPos[3])) _
+ (($v = 0) * (($v = 0) * ($aScreen_Res[3] / 2) - ($aWPos[3] / 2))) _
)$aWPos = WinGetPos($hWnd)
[/autoit] [autoit][/autoit] [autoit]
; Slide GUI.
Switch $sSide
Case "left", "right"
Local $STEP = (((($h = 1) And ($m = 1)) Or (($h = -1) And ($m = -1))) - ((($h = -1) And ($m = 1)) Or (($h = 1) And ($m = -1)))) * 10
Local $FROM = $aWPos[0], $TO = $aWPos[0] _
+ (((($h = 1) And ($m = 1)) Or (($h = -1) And ($m = -1))) * ($aWPos[2])) _
- (((($h = 1) And ($m = -1)) Or (($h = -1) And ($m = 1))) * ($aWPos[2])) - $STEP
For $i = $aWPos[0] To $TO Step $STEP
WinMove($hWnd, "", $i, $aWPos[1])
Sleep(10)
Next
Case "top", "bottom"
Local $STEP = (((($v = 1) And ($m = 1)) Or (($v = -1) And ($m = -1))) - ((($v = -1) And ($m = 1)) Or (($v = 1) And ($m = -1)))) * 10
Local $FROM = $aWPos[1], $TO = $aWPos[1] _
+ (((($v = 1) And ($m = 1)) Or (($v = -1) And ($m = -1))) * ($aWPos[3])) _
- (((($v = 1) And ($m = -1)) Or (($v = -1) And ($m = 1))) * ($aWPos[3])) - $STEP
For $i = $aWPos[1] To $TO Step $STEP
WinMove($hWnd, "", $aWPos[0], $i)
Sleep(10)
Next
EndSwitch
EndFunc ;==>_SlideWinFunc _WinIsHovered($hWnd, $vDLL = "User32.dll")
[/autoit] [autoit][/autoit] [autoit]
Local $aResult, $aWPos = WinGetPos($hWnd), $aMPos = MouseGetPos()
Local $tRect = DllStructCreate("int Left;int Top;int Right;int Bottom")
Local $iLeft = $aWPos[0], $iTop = $aWPos[1], $iWidth = $aWPos[2], $iHeight = $aWPos[3]
Local $iX = $aMPos[0], $iY = $aMPos[1]
DllStructSetData($tRect, "Left", $iLeft)
DllStructSetData($tRect, "Top", $iTop)
DllStructSetData($tRect, "Right", $iLeft + $iWidth)
DllStructSetData($tRect, "Bottom", $iTop + $iHeight)$aResult = DllCall($vDLL, "int", "PtInRect", "ptr", DllStructGetPtr($tRect), "int", $iX, "int", $iY)
[/autoit] [autoit][/autoit] [autoit]
If @error Then Return SetError(@error, 0, False)Return $aResult[0] <> 0
[/autoit] [autoit][/autoit] [autoit]
EndFunc ;==>_WinIsHoveredFunc _Exit()
[/autoit]
DllClose($hDLL) ; Dont forget to close your DLL-Handle
Exit
EndFunc ;==>_ExitIst die selbe falsche Darstellung. Meine Laptop hat die Auflösung 1920x1200 und mein 2.ter Monitor 1280x1024 => 1920x2224! Laptop unten, Monitor oben!
Display Array:
[0]: 0
[1]: -1024
[2]: 1920
[3]: 2224Gruß,
UEZ -
Nun ja für eine handvoll ist die Laufzeit -> O(n^2) ja noch akzeptable! Aber versuche es doch mal mit den 9999 Daten

Intern wird ja Quicksort benutzt, das im schlechtesten Fall auch quadratische Laufzeit hat, wenn man nicht irgendwelche Tricks benutzt!
Gruß,
UEZ -
Wollte ich eigentlich auch, habe ich aber auf die schnelle nicht hinbekommen. Werde ich bei nächster Gelegenheit umsetzen.
Jetzt muss ich mir nur noch überlegen, wie ich das umsetzen kann / soll!?
Natürlich. Nimm dir was du brauchen kannst.
Hier mit dem Index:
[autoit]
[/autoit]
Func _Array1DTo2D($a1D, $sDelim = ";", $iSeveral = 0)
;funkey 17.02.2010
Local $iUbound = UBound($a1D) - 1
Local $iTemp = 0, $iColumn = 0
For $i = 0 To $iUbound
If $iSeveral Then
$iTemp = UBound(StringRegExp($a1D[$i], $sDelim & "+", 3))
Else
$iTemp = UBound(StringSplit($a1D[$i], $sDelim, 3))
EndIf
If $iTemp > $iColumn Then $iColumn = $iTemp
Next
Local $a2D[UBound($a1D)][$iColumn + 2]
Local $aTemp
For $i = 0 To $iUbound
If $iSeveral Then
$aTemp = StringSplit(StringRegExpReplace($a1D[$i], $sDelim & "+", $sDelim), $sDelim, 3)
Else
$aTemp = StringSplit($a1D[$i], $sDelim, 3)
EndIf
For $j = 0 To UBound($aTemp) - 1
$a2D[$i][0] = $i
$a2D[$i][$j + 1] = $aTemp[$j]
Next
$a2D[0][0] = "Index"
Next
Return SetExtended($iColumn, $a2D)
EndFunc ;==>_Array1DTo2DFür SIC2 wollte ich dein Tools komplett dazu tun (nicht in SIC2 integrieren), damit man die CSV's sich anschauen kann!
Mache mich gleich an die Farben...
Gruß,
UEZ -
[autoit]
[/autoit]
#include <Array.au3>
Global $hScreen = WinGetHandle("Program Manager")
Global $aScreen_Res = WinGetPos($hScreen)
#cs
$array[0] = X position
$array[1] = Y position
$array[2] = Width
$array[3] = Height
#ce
_ArrayDisplay($aScreen_Res)
ExitGruß,
UEZ -
Vielen Dank für die Vorschläge. Habe weitere Verbesserungen eingebaut! Siehe Post#1
Update auf Version 0.4
--> Farbe für das Listview (zum selber auswählen)
--> Optionales OnTop-Fenster
--> Drag and drop von Dateien in das Listview
--> Resizing des Fensters
--> HTML-Export
Bei den Farben dachte ich eher daran, das z.B. ungerade Zeilen eine andere farben haben als gerade Zeilen (zur besseren Übersicht) wie in dem HTML Export!
Nette Idee mit dem HTML Export!
Ein fortlaufender Index ganz links wäre auch nicht schlecht!
Darf ich dein Tool mit in SIC2 packen? Passt nämlich wunderbar!
Gruß,
UEZ -
Nette Idee, aber bei Multimonitoren funzt es nicht richtig!
Gruß,
UEZ -
Alles anzeigen
Hallo UEZ,
ich habe einmal deine und meine Lösung gegenübergestellt: deine Laufzeit 7384 ms, meine 5741 ms. Eine anschliessende Überprüfung auf Übereinstimmung erbrachte nur Unterschiede in Spalte 1 von 3, was ja laut Vorgabe von Oscar zulässig ist.
Hier das Skript dazu:Spoiler anzeigen
[autoit]#include <array.au3>
[/autoit] [autoit][/autoit] [autoit]
Dim $array[9999][3] ; = [['abc', 'a11', '555'],['bcd', 'a11', '444'],['cde', 'a11', '666']]
Dim $aNew[9999][3]
For $i = 0 To 9998
$array[$i][0] = Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1))
$array[$i][1] = Chr(Random(65, 90, 1)) & Random(0, 99, 1)
$array[$i][2] = Random(100, 999, 1)
Next
$bench_start = TimerInit()
For $i = 0 To UBound($array, 1) - 1
$aNew[$i][0] = $array[$i][1] & "|" & $array[$i][2] & "|" & $array[$i][0]
;ConsoleWrite($array[$i][1] & "|" & $array[$i][2] & "|" & $array[$i][0] & @CRLF)
Next
_ArraySort($aNew, 0, 0, 0, 0)
For $i = 0 To UBound($array, 1) - 1
$aSplit = StringSplit($aNew[$i][0], "|")
$aNew[$i][0] = $aSplit[3]
$aNew[$i][1] = $aSplit[1]
$aNew[$i][2] = $aSplit[2]
Next
$bench_end = Round(TimerDiff($bench_start), 2)
ConsoleWrite("Laufzeit: " & $bench_end & " ms!" & @CRLF)
;_ArrayDisplay($aNew)$1ste_spalte = 1
[/autoit] [autoit][/autoit] [autoit]
$2te_spalte = 2
$j = 0
$k = 1$bench_start = TimerInit()
[/autoit] [autoit][/autoit] [autoit]
_ArraySort($array, 0, 0, 0, $1ste_spalte)While $k < UBound($array)
[/autoit] [autoit][/autoit] [autoit]
If $array[$j][$1ste_spalte] <> $array[$k][$1ste_spalte] Then
If $k - $j > 1 Then
_ArraySort($array, 0, $j, $k - 1, $2te_spalte)
$j = $k
Else
$j = $k
EndIf
EndIf
$k += 1
WEndIf $k - $j > 1 Then _ArraySort($array, 0, $j, $k, $2te_spalte)
[/autoit] [autoit][/autoit] [autoit]$bench_end = Round(TimerDiff($bench_start), 2)
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("Laufzeit: " & $bench_end & " ms!" & @CRLF & @crlf)
;_ArrayDisplay($array)ConsoleWrite("Jetzt wird noch auf Übereinstimmung geprüft!" & @CRLF)
[/autoit] [autoit][/autoit] [autoit]For $i = 0 To UBound($array, 1) - 1
[/autoit]
For $j = 0 To 2 ;alle 3 Spalten vergleichen
If $aNew[$i][$j] <> $array[$i][$j] Then
ConsoleWrite("Unterschied in ARRAYS Zeile: " & $i & " Spalte: " & $j & @CRLF)
if $j <> 0 then ;Spalte 0 darf sich unterscheiden
ConsoleWrite("Eine der beiden Sortiermethoden ist fehlerhaft" & @CRLF)
Exit
EndIf
EndIf
Next
Next
@kleiner27, deine Routine ist fehlerhaft (Unterschied in Spalte 2, schon in der 1. Zeile)mfg (Auto)Bert
Ich hatte eine Idee und die habe ich versucht zu implementieren

Nur was mir bei dir aufgefallen ist, dass deine Sortierung nicht ganz stimmt:
Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist. In Zeile 2 ist die 85 nach 590 und 710! Anscheinend wird "nur" nach der ersten Ziffer links sortiert

Gruß,
UEZ -
Hier mein zweiter Versuch:
[autoit]
[/autoit][autoit][/autoit][autoit]
#include <array.au3>
$max = 9999
Dim $array[$max][3]
for $i = 0 to $max - 1
$array[$i][0]= Chr(Random(65,90,1)) & Chr(Random(65,90,1)) & Chr(Random(65,90,1))
$array[$i][1]= Chr(Random(65,90,1)) & Random(0,99,1)
$array[$i][2]= Random(0,999,1)
Next;~ Dim $array[4][3] = [['AAB', 'S60', '127'], _
[/autoit][autoit][/autoit][autoit]
;~ ['AAA', 'Z27', '256'], _
;~ ['AAC', 'A11', '550'], _
;~ ['AAG', 'Z47', '406']]$1ste_spalte = 1
[/autoit][autoit][/autoit][autoit]
$2te_spalte = 2
$j = 0
$k = 1$bench_start = TimerInit()
[/autoit][autoit][/autoit][autoit]_ArraySort($array, 0, 0, 0, $1ste_spalte)
[/autoit][autoit][/autoit][autoit]While $k < UBound($array)
[/autoit][autoit][/autoit][autoit]
If $array[$j][$1ste_spalte] <> $array[$k][$1ste_spalte] Then
If $k - $j > 1 Then
_ArraySort($array, 0, $j, $k - 1, $2te_spalte)
$j = $k
Else
$j = $k
EndIf
EndIf
$k += 1
WEndIf $k - $j > 1 Then _ArraySort($array, 0, $j, $k, $2te_spalte)
[/autoit][autoit][/autoit][autoit]$bench_end = Round(TimerDiff($bench_start), 2)
[/autoit][autoit][/autoit][autoit]
ConsoleWrite("Laufzeit: " & $bench_end & " ms!" & @CRLF)_ArrayDisplay($array)
[/autoit]Meine Laufzeit: 2596.75 ms!
Ich hoffe, dass der Code fehlerfrei ist
Gruß,
UEZ -
Cool wäre es, wenn ich in den Notizzettel klicken könnte, so dass die Eingabe direkt auf den Zettel geschrieben werden könnte oder mit der Maus (vielleicht zu schwierig)!
Fontauswahl wäre auch von Vorteil

Gruß,
UEZ -
Und so?
[autoit]
[/autoit]
#include <Array.au3>
Dim $array[3][3] = [['abc', 'a11', '555'],['bcd', 'a11', '444'],['cde', 'a11', '666']]
_ArrayDisplay($array)
_ArraySort($array,1,0,0,2)
_ArraySort($array,0,0,0,1)
_ArrayDisplay($array)Gruß,
UEZEdit: Führt auch nicht zum Ziel

-
Compile Script (x86) geht aber wie bei ProcessGetStats mit großen Abweichungen.
Im calc.exe Beispiel wird 11540 KB angezeigt laut Taskmanager sind es aber nur 5004
Komisch! Und die Datei im Anhang?
Richtig: unter x64 wird der Mem doppelt so viel angezeigt. Muss mal nachforschen!
UEZ
-
Win 7 x64.
Hast recht! Auf Win7 x64 im native 64-bit mode geht's nicht! Kompiliere es doch mal vorher mit der Option: #AutoIt3Wrapper_UseX64=n oder RMT -> Compile Script (x86)!
Ich muss mal sehen, wie der Code unter x64 im native mode umgestrickt werden muss...
UEZ
-
Was für ein OS benutzt du?
Bei mir ist es Vista x32!
Gruß,
UEZ -
Da kommt bei mir leider nur CPU: 0 und Ram:0
CPU 0% ist ja klar, da Calc.exe ja nichts macht! Kannst ja mal 999999! berechnen!
Bei mir sieht es so aus: calc.exe | PID: 7712 | CPU time: 0:00:00.046 (h:m:s.ms) | Mem usage: 5264 KB | CPU usage: 0 %
Gruß,
UEZ -