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

Beiträge von Oscar

  • neues PC Gehäuse gesucht

    • Oscar
    • 24. August 2014 um 17:01

    Also ich besitze diesen Bigtower "Cooler Master Cosmos".
    Da sind 39 cm Platz bis zu den internen Laufwerken. Eine 30 cm Grafikkarte passt da also locker rein. Netzteil sitzt unten (sehr praktisch, besitzt einen eigenen Lufteinlass von unten).
    Lässt sich sehr gut (leise) kühlen.
    Mit der Befestigung des Prozessorkühlers ans Gehäuse kann ich Dir nicht weiterhelfen. Wie genau wird der denn dort befestigt?

  • Fehler beim Speichern von Variablen in ini Datei

    • Oscar
    • 23. August 2014 um 17:42

    Warum speichert man etwas in einer Inidatei, wenn man dann die Ini-Funktionen (IniRead, IniWrite) nicht verwendet?

  • Laufwerksinformationen auslesen

    • Oscar
    • 20. August 2014 um 14:46

    Hier die Funktion aus meinen Computer-Info:

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    #include <WinAPIMisc.au3>

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

    $aDriveInfo = _CI_GetHarddrives()
    _ArrayDisplay($aDriveInfo)

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

    Func _CI_GetHarddrives($strComputer = '.')
    Local $aReturn[1][7] = [[ _
    'Bezeichnung:', 'Größe:', 'Anschluss:', 'Bytes/Sektor:', 'Anzahl der Sektoren:', _
    'PNPDeviceID:', 'Status:']]
    Local $x = 0, $objWMIService, $colItems
    $objWMIService = ObjGet('winmgmts:\\' & $strComputer & '\root\cimv2')
    If Not IsObj($objWMIService) Then Return SetError(1, 0, 0)
    $colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_DiskDrive', 'WQL', 0x30)
    If IsObj($colItems) Then
    For $objItem In $colItems
    $x += 1
    ReDim $aReturn[$x + 1][7]
    $aReturn[$x][0] = $objItem.Model
    $aReturn[$x][1] = _WinAPI_StrFormatByteSize($objItem.Size)
    $aReturn[$x][2] = $objItem.InterfaceType
    $aReturn[$x][3] = $objItem.BytesPerSector
    $aReturn[$x][4] = $objItem.TotalSectors
    $aReturn[$x][5] = $objItem.PNPDeviceID
    $aReturn[$x][6] = $objItem.Status
    Next
    EndIf
    Return $aReturn
    EndFunc ;==>_CI_GetHarddrives

    [/autoit]
  • Listview ohne Reiter

    • Oscar
    • 19. August 2014 um 18:31

    Das bezeichnet man als Header. Und ja, den kann man auch ausblenden:

    [autoit]


    #include <ListViewConstants.au3>
    GUICreate('test', 400, 300)
    $idListView = GUICtrlCreateListView('A|B|C', 10, 10, 380, 280, $LVS_NOCOLUMNHEADER)
    GUICtrlCreateListViewItem('1|2|3', $idListView)
    GUICtrlCreateListViewItem('4|5|6', $idListView)
    GUISetState()
    Do
    Until GUIGetMsg() = -3

    [/autoit]
  • SMTP E-Mail Funktion funktioniert nicht!

    • Oscar
    • 19. August 2014 um 18:03

    Versuch's mal mit Port "465" und SSL = "1"
    GMX und Yahoo nehmen auf Port 25 keine EMails mehr an. Es muss SSL verschlüsselt sein.

  • ImageList in ListView zu langsam

    • Oscar
    • 19. August 2014 um 14:39

    Du könntest von allen Images erstmal die kleinen Icons generieren lassen und diese abspeichern.
    Das würde dann einmalig länger dauern, aber das anschließende einlesen geht sehr schnell.
    Hier mal meine Variante:

    Spoiler anzeigen
    [autoit]


    #include <File.au3>
    #include <FileConstants.au3>
    #include <GDIPlus.au3>
    #include <GuiImageList.au3>
    #include <GuiListView.au3>
    #include <WinAPI.au3>
    #include <WinAPIGdi.au3>
    #include <WinAPIRes.au3>
    #include <WinAPISys.au3>

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

    $hForm = GUICreate('MyGUI', 400, 400)
    $hListView = GUICtrlCreateListView('', 10, 10, 380, 380)
    _GUICtrlListView_AddColumn($hListView, 'Items', 200)
    $hImageList = _GUIImageList_Create(120, 90, 5, 1)
    _GUICtrlListView_SetImageList($hListView, $hImageList, 1)
    GUISetState()

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

    $sDir = 'c:\Users\Oscar\Downloads\img\' ; <- Pfad anpassen!
    $aSize = _GUIImageList_GetIconSize($hImageList)

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

    ToolTip('Bitte warten!')
    $iTimer = TimerInit()
    _ImageFilesToIcons($sDir, '*.jpg', $aSize[0], $aSize[1]) ; <- mit dieser Funktion werden die Icons erstellt
    ToolTip('')
    MsgBox(0, 'Icons erstellt', 'Benötigte Zeit (s): ' & Round(TimerDiff($iTimer) / 1000, 3))

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

    $aFiles = _FileListToArray($sDir, '*.ico', $FLTA_FILES, False) ; <- alle Icondateien in das Array holen
    $hIcon = 0
    For $i = 1 To $aFiles[0]
    $hIcon = _WinAPI_LoadIconWithScaleDown(0, $sDir & $aFiles[$i], $aSize[0], $aSize[1]) ; Icon laden
    _GUIImageList_ReplaceIcon($hImageList, -1, $hIcon) ; in die ImageList einfügen
    _WinAPI_DestroyIcon($hIcon) ; Icon zerstören und Speicher freigeben
    _GUICtrlListView_AddItem($hListView, $aFiles[$i], $i - 1) ; ListView-Eintrag hinzufügen
    Next

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

    Do
    Until GUIGetMsg() = -3

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

    Func _ImageFilesToIcons($sFilePath, $sFilter = '*', $iWidth = 32, $iHeight = 32)
    Local $aFiles = _FileListToArray($sFilePath, $sFilter, $FLTA_FILES, True)
    If @error Then Return SetError(1, 0, 0)
    Local $hPic, $hBitmap, $hIcon
    _GDIPlus_Startup()
    For $i = 1 To $aFiles[0]
    $hPic = _GDIPlus_ImageLoadFromFile($aFiles[$i])
    If Not @error Then
    $hBitmap = _GDIPlus_ImageResize($hPic, $iWidth, $iHeight)
    $hIcon = _GDIPlus_HICONCreateFromBitmap($hBitmap)
    _GDIPlus_ImageDispose($hPic)
    _GDIPlus_BitmapDispose($hBitmap)
    _WinAPI_SaveHICONToFile(StringRegExpReplace($aFiles[$i], '(.+\.).+', '$1') & 'ico', $hIcon)
    _WinAPI_DestroyIcon($hIcon)
    Else
    ConsoleWrite('!> "' & $aFiles[$i] & '" konnte nicht geladen werden!' & @CR)
    EndIf
    Next
    _GDIPlus_Shutdown()
    EndFunc ;==>_ImageFilesToIcons

    [/autoit]
  • Listview sortieren nach zweiter Spalte

    • Oscar
    • 17. August 2014 um 18:43

    Naja, das passiert, weil AutoIt die Prozentzahlen nicht als Zahlen behandelt, sondern als Strings (diese werden von links nach rechts in ihrer Wertigkeit sortiert).
    Prog@ndy hat mal ein NaturalArraySort geschrieben. Wenn man das in die ListView-Sortierung einbaut, dann werden auch Prozentzahlen richtig sortiert:

    Spoiler anzeigen
    [autoit]


    #include <ListViewConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiListView.au3>

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

    GUICreate("ListView SimpleSort Natural", 400, 300)
    $hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
    GUICtrlSendMsg($hListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
    GUICtrlSendMsg($hListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
    GUICtrlCreateListViewItem("line4|5%|more_a", $hListView)
    GUICtrlCreateListViewItem("line5|75% |more_c", $hListView)
    GUICtrlCreateListViewItem("line5|49% |more_c", $hListView)
    GUICtrlCreateListViewItem("line3|23%|more_e", $hListView)
    GUICtrlCreateListViewItem("line2|55% |more_d", $hListView)
    GUICtrlCreateListViewItem("line1|60% |more_b", $hListView)
    GUICtrlCreateListViewItem("line1|98% |more_b", $hListView)
    GUICtrlCreateListViewItem("line1|3%|more_b", $hListView)
    _GUICtrlListView_SetColumnWidth($hListView, 0, 75)
    _GUICtrlListView_SetColumnWidth($hListView, 1, 75)
    _GUICtrlListView_SetColumnWidth($hListView, 2, 75)
    GUISetState()

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

    Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($hListView)]
    _GUICtrlListView_SimpleSortNatural($hListView, $B_DESCENDING, 1) ; 3ter Parameter ist Spalten-Index, Nullbasiert

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

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

    Func _GUICtrlListView_SimpleSortNatural($hWnd, ByRef $vSortSense, $iCol, $bToggleSense = True)
    Local $iItemCount = _GUICtrlListView_GetItemCount($hWnd)
    If $iItemCount Then
    Local $iDescending = 0
    If UBound($vSortSense) Then
    $iDescending = $vSortSense[$iCol]
    Else
    $iDescending = $vSortSense
    EndIf
    Local $vSeparatorChar = Opt('GUIDataSeparatorChar')
    Local $iColumnCount = _GUICtrlListView_GetColumnCount($hWnd)
    Local Enum $iIndexValue = $iColumnCount, $iItemParam ; Additional columns for the index value and ItemParam
    Local $aListViewItems[$iItemCount][$iColumnCount + 2]

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

    Local $aSelectedItems = StringSplit(_GUICtrlListView_GetSelectedIndices($hWnd), $vSeparatorChar)
    Local $aCheckedItems = __GUICtrlListView_GetCheckedIndices($hWnd)
    Local $sItemText, $iFocused = -1
    For $i = 0 To $iItemCount - 1 ; Rows
    If $iFocused = -1 Then
    If _GUICtrlListView_GetItemFocused($hWnd, $i) Then $iFocused = $i
    EndIf
    _GUICtrlListView_SetItemSelected($hWnd, $i, False)
    _GUICtrlListView_SetItemChecked($hWnd, $i, False)
    For $j = 0 To $iColumnCount - 1 ; Columns
    $sItemText = StringStripWS(_GUICtrlListView_GetItemText($hWnd, $i, $j), $STR_STRIPTRAILING)
    If (StringIsFloat($sItemText) Or StringIsInt($sItemText)) Then
    $aListViewItems[$i][$j] = Number($sItemText)
    Else
    $aListViewItems[$i][$j] = $sItemText
    EndIf
    Next
    $aListViewItems[$i][$iIndexValue] = $i ; Index value
    $aListViewItems[$i][$iItemParam] = _GUICtrlListView_GetItemParam($hWnd, $i) ; ItemParam
    Next

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

    ; Sort the ListView array
    _ArrayNaturalSort($aListViewItems, $iDescending, 0, 0, $iCol)

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

    For $i = 0 To $iItemCount - 1 ; Rows
    For $j = 0 To $iColumnCount - 1 ; Columns
    _GUICtrlListView_SetItemText($hWnd, $i, $aListViewItems[$i][$j], $j)
    Next

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

    _GUICtrlListView_SetItemParam($hWnd, $i, $aListViewItems[$i][$iItemParam]) ; ItemParam

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

    For $j = 1 To $aSelectedItems[0]
    If $aListViewItems[$i][$iIndexValue] = $aSelectedItems[$j] Then
    If $aListViewItems[$i][$iIndexValue] = $iFocused Then
    _GUICtrlListView_SetItemSelected($hWnd, $i, True, True)
    Else
    _GUICtrlListView_SetItemSelected($hWnd, $i, True)
    EndIf
    ExitLoop
    EndIf
    Next
    For $j = 1 To $aCheckedItems[0]
    If $aListViewItems[$i][$iIndexValue] = $aCheckedItems[$j] Then
    _GUICtrlListView_SetItemChecked($hWnd, $i, True)
    ExitLoop
    EndIf
    Next
    Next
    If $bToggleSense Then ; Automatic sort sense toggle
    If UBound($vSortSense) Then
    $vSortSense[$iCol] = Not $iDescending
    Else
    $vSortSense = Not $iDescending
    EndIf
    EndIf
    EndIf
    EndFunc ;==>_GUICtrlListView_SimpleSortNatural

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

    ; #FUNCTION# ;===============================================================================
    ;
    ; Name...........: _NaturalCompare
    ; Description ...: Compare two strings using Natural (Alphabetical) sorting.
    ; Syntax.........: _NaturalCompare($s1, $s2, $iCase = 0)
    ; Parameters ....: $s1, $s2 - Strings to compare
    ; $iCase - Case sensitive or insensitive comparison
    ; |0 - Case insensitive (default)
    ; |1 - Case sensitive
    ; Return values .: Success - One of the following:
    ; |0 - Strings are equal
    ; |-1 - $s1 comes before $s2
    ; |1 - $s1 goes after $s2
    ; Failure - Returns -2 and Sets @Error:
    ; |1 - $s1 or $s2 is not a string
    ; |2 - $iCase is invalid
    ; Author ........: Erik Pilsits
    ; Modified.......:
    ; Remarks .......: Original algorithm by Dave Koelle
    ; Related .......: StringCompare
    ; Link ..........: http://www.davekoelle.com/alphanum.html
    ; Example .......: Yes
    ;
    ; ;==========================================================================================
    Func _NaturalCompare($s1, $s2, $iCase = 0)
    If (Not IsString($s1)) Or (Not IsString($s2)) Then Return SetError(1, 0, -2)
    If $iCase <> 0 And $iCase <> 1 Then Return SetError(2, 0, -2)

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

    Local $n = 0, $iLen = 1
    Local $s1chunk, $s2chunk

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

    While $n == 0 ; get next chunk
    ; STRING 1
    $iLen = 1
    If StringIsDigit(StringLeft($s1, 1)) Then
    ; chunk of digits
    For $i = 2 To StringLen($s1)
    If StringIsDigit(StringMid($s1, $i, 1)) Then
    $iLen += 1
    Else
    ExitLoop
    EndIf
    Next
    Else
    ; chunk of letters
    For $i = 2 To StringLen($s1)
    If Not StringIsDigit(StringMid($s1, $i, 1)) Then
    $iLen += 1
    Else
    ExitLoop
    EndIf
    Next
    EndIf
    $s1chunk = StringLeft($s1, $iLen)

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

    ; STRING 2
    $iLen = 1
    If StringIsDigit(StringLeft($s2, 1)) Then
    ; chunk of digits
    For $i = 2 To StringLen($s2)
    If StringIsDigit(StringMid($s2, $i, 1)) Then
    $iLen += 1
    Else
    ExitLoop
    EndIf
    Next
    Else
    ; chunk of letters
    For $i = 2 To StringLen($s2)
    If Not StringIsDigit(StringMid($s2, $i, 1)) Then
    $iLen += 1
    Else
    ExitLoop
    EndIf
    Next
    EndIf
    $s2chunk = StringLeft($s2, $iLen)

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

    ; ran out of chunks, strings are the same, return 0
    If $s1chunk == "" And $s2chunk == "" Then Return 0

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

    ; remove chunks from strings
    $s1 = StringMid($s1, StringLen($s1chunk) + 1)
    $s2 = StringMid($s2, StringLen($s2chunk) + 1)

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

    ; Case 1: both chunks contain letters
    If (Not StringIsDigit($s1chunk)) And (Not StringIsDigit($s2chunk)) Then
    $n = StringCompare($s1chunk, $s2chunk, $iCase)
    Else
    ; Case 2: both chunks contain numbers
    If StringIsDigit($s1chunk) And StringIsDigit($s2chunk) Then
    Local $i1chunk = Int($s1chunk)
    Local $i2chunk = Int($s2chunk)
    If $i1chunk > $i2chunk Then
    Return 1
    ElseIf $i1chunk < $i2chunk Then
    Return -1
    EndIf
    Else
    ; Case 3: one chunk has letters, the other has numbers; or one is empty
    ; if we get here, this should be the last and deciding test, so return the result
    Return StringCompare($s1chunk, $s2chunk, $iCase)
    EndIf
    EndIf
    WEnd

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

    Return $n
    EndFunc ;==>_NaturalCompare

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _ArrayNaturalSort
    ; Description ...: Sort a 1D or 2D array on a specific index using the quicksort/insertionsort algorithms.
    ; Syntax.........: _ArrayNaturalSort(ByRef $avArray[, $iDescending = 0[, $iStart = 0[, $iEnd = 0[, $iSubItem = 0]]]])
    ; Parameters ....: $avArray - Array to sort
    ; $iDescending - [optional] If set to 1, sort descendingly
    ; $iStart - [optional] Index of array to start sorting at
    ; $iEnd - [optional] Index of array to stop sorting at
    ; $iSubItem - [optional] Sub-index to sort on in 2D arrays
    ; Return values .: Success - 1
    ; Failure - 0, sets @error:
    ; |1 - $avArray is not an array
    ; |2 - $iStart is greater than $iEnd
    ; |3 - $iSubItem is greater than subitem count
    ; |4 - $avArray has too many dimensions
    ; Author ........: Jos van der Zande <jdeb at autoitscript dot com>
    ; Modified.......: LazyCoder - added $iSubItem option, Tylo - implemented stable QuickSort algo, Jos van der Zande - changed logic to correctly Sort arrays with mixed Values and Strings, Ultima - major optimization, code cleanup, removed $i_Dim parameter
    ; Prog@ndy - natural sort
    ; Remarks .......:
    ; Related .......:
    ; Link ..........;
    ; Example .......; Yes
    ; ===============================================================================================================================
    Func _ArrayNaturalSort(ByRef $avArray, $iDescending = 0, $iStart = 0, $iEnd = 0, $iSubItem = 0)
    If Not IsArray($avArray) Then Return SetError(1, 0, 0)

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

    Local $iUBound = UBound($avArray) - 1

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

    ; Bounds checking
    If $iEnd < 1 Or $iEnd > $iUBound Then $iEnd = $iUBound
    If $iStart < 0 Then $iStart = 0
    If $iStart > $iEnd Then Return SetError(2, 0, 0)

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

    ; Sort
    Switch UBound($avArray, 0)
    Case 1
    __ArrayNaturalQuickSort1D($avArray, $iStart, $iEnd)
    If $iDescending Then _ArrayReverse($avArray, $iStart, $iEnd)
    Case 2
    Local $iSubMax = UBound($avArray, 2) - 1
    If $iSubItem > $iSubMax Then Return SetError(3, 0, 0)

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

    If $iDescending Then
    $iDescending = -1
    Else
    $iDescending = 1
    EndIf

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

    __ArrayNaturalQuickSort2D($avArray, $iDescending, $iStart, $iEnd, $iSubItem, $iSubMax)
    Case Else
    Return SetError(4, 0, 0)
    EndSwitch

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

    Return 1
    EndFunc ;==>_ArrayNaturalSort

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

    ; #INTERNAL_USE_ONLY#============================================================================================================
    ; Name...........: __ArrayNaturalQuickSort1D
    ; Description ...: Helper function for sorting 1D arrays
    ; Syntax.........: __ArrayNaturalQuickSort1D(ByRef $avArray, ByRef $iStart, ByRef $iEnd)
    ; Parameters ....: $avArray - Array to sort
    ; $iStart - Index of array to start sorting at
    ; $iEnd - Index of array to stop sorting at
    ; Return values .: None
    ; Author ........: Jos van der Zande, LazyCoder, Tylo, Ultima
    ; Modified.......: Prog@ndy - natural sort
    ; Remarks .......: For Internal Use Only
    ; Related .......:
    ; Link ..........;
    ; Example .......;
    ; ===============================================================================================================================
    Func __ArrayNaturalQuickSort1D(ByRef $avArray, ByRef $iStart, ByRef $iEnd)
    If $iEnd <= $iStart Then Return

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

    Local $vTmp

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

    ; InsertionSort (faster for smaller segments)
    If ($iEnd - $iStart) < 15 Then
    Local $i, $j, $vCur
    For $i = $iStart + 1 To $iEnd
    $vTmp = $avArray[$i]

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

    For $j = $i - 1 To $iStart Step -1
    If (_NaturalCompare($vTmp, $avArray[$j], 1) >= 0) Then ExitLoop
    $avArray[$j + 1] = $avArray[$j]
    Next

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

    $avArray[$j + 1] = $vTmp
    Next
    Return
    EndIf

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

    ; QuickSort
    Local $L = $iStart, $R = $iEnd, $vPivot = $avArray[Int(($iStart + $iEnd) / 2)]
    Do
    While (_NaturalCompare($avArray[$L], $vPivot, 1) < 0)
    $L += 1
    WEnd
    While (_NaturalCompare($avArray[$R], $vPivot, 1) > 0)
    $R -= 1
    WEnd

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

    ; Swap
    If $L <= $R Then
    $vTmp = $avArray[$L]
    $avArray[$L] = $avArray[$R]
    $avArray[$R] = $vTmp
    $L += 1
    $R -= 1
    EndIf
    Until $L > $R

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

    __ArrayNaturalQuickSort1D($avArray, $iStart, $R)
    __ArrayNaturalQuickSort1D($avArray, $L, $iEnd)
    EndFunc ;==>__ArrayNaturalQuickSort1D

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

    ; #INTERNAL_USE_ONLY#============================================================================================================
    ; Name...........: __ArrayNaturalQuickSort2D
    ; Description ...: Helper function for sorting 2D arrays
    ; Syntax.........: __ArrayNaturalQuickSort2D(ByRef $avArray, ByRef $iStep, ByRef $iStart, ByRef $iEnd, ByRef $iSubItem, ByRef $iSubMax)
    ; Parameters ....: $avArray - Array to sort
    ; $iStep - Step size (should be 1 to sort ascending, -1 to sort descending!)
    ; $iStart - Index of array to start sorting at
    ; $iEnd - Index of array to stop sorting at
    ; $iSubItem - Sub-index to sort on in 2D arrays
    ; $iSubMax - Maximum sub-index that array has
    ; Return values .: None
    ; Author ........: Jos van der Zande, LazyCoder, Tylo, Ultima
    ; Modified.......: Prog@ndy - natural sort
    ; Remarks .......: For Internal Use Only
    ; Related .......:
    ; Link ..........;
    ; Example .......;
    ; ===============================================================================================================================
    Func __ArrayNaturalQuickSort2D(ByRef $avArray, ByRef $iStep, ByRef $iStart, ByRef $iEnd, ByRef $iSubItem, ByRef $iSubMax)
    If $iEnd <= $iStart Then Return

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

    ; QuickSort
    Local $i, $vTmp, $L = $iStart, $R = $iEnd, $vPivot = $avArray[Int(($iStart + $iEnd) / 2)][$iSubItem]
    Do

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

    While ($iStep * _NaturalCompare($avArray[$L][$iSubItem], $vPivot, 1) < 0)
    $L += 1
    WEnd
    While ($iStep * _NaturalCompare($avArray[$R][$iSubItem], $vPivot, 1) > 0)
    $R -= 1
    WEnd

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

    ; Swap
    If $L <= $R Then
    For $i = 0 To $iSubMax
    $vTmp = $avArray[$L][$i]
    $avArray[$L][$i] = $avArray[$R][$i]
    $avArray[$R][$i] = $vTmp
    Next
    $L += 1
    $R -= 1
    EndIf
    Until $L > $R

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

    __ArrayNaturalQuickSort2D($avArray, $iStep, $iStart, $R, $iSubItem, $iSubMax)
    __ArrayNaturalQuickSort2D($avArray, $iStep, $L, $iEnd, $iSubItem, $iSubMax)
    EndFunc ;==>__ArrayNaturalQuickSort2D

    [/autoit]
  • Tool hängt sich auf - aber wo?

    • Oscar
    • 15. August 2014 um 18:57

    Das ist ein Bug!
    Von MicroSoft gibt es einen HotFix: http://support.microsoft.com/kb/978155

  • Case Anweisung mit Array?

    • Oscar
    • 13. August 2014 um 19:24

    Auch bei Deinem Beispiel finde ich die Switch-Variante übersichtlicher:

    Spoiler anzeigen
    [autoit]


    #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
    _main()
    Func _main()
    Local $input, $nMsg, $result, $aBtn[20]
    Local $aBtnLbl[20] = ["7", "8", "9", " / ", "4", "5", "6", " * ", "1", "2", "3", " - ", ".", "0", "^", " + ", "(", ")", "Clear", "="]
    GUICreate("Mod-TRechner-Tut", 235, 325)
    $input = GUICtrlCreateInput("", 10, 10, 215, 30, BitOR(0x0800, 0x0002)) ; $ES_READONLY $ES_RIGHT
    For $k = 0 To 19
    $aBtn[$k] = GUICtrlCreateButton($aBtnLbl[$k], 10 + Mod($k, 4) * 55, 50 + Int($k / 4) * 55, 50, 50)
    Next

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

    GUISetState(@SW_SHOW)

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

    Do
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $aBtn[0] To $aBtn[17]
    GUICtrlSetData($input, GUICtrlRead($input) & $aBtnLbl[$nMsg - $aBtn[0]])
    Case $aBtn[19]
    $result = Execute(StringRegExpReplace(GUICtrlRead($input), '[^\.\(\)\*\/\-\+\d]', ''))
    If $result == "1.#INF" Or $result == "-1.#IND" Then $result = "Error"
    GUICtrlSetData($input, $result)
    Case $aBtn[18]
    GUICtrlSetData($input, "")
    EndSwitch
    Until $nMsg = -3
    EndFunc ;==>_main
    ; Ende

    [/autoit]
  • Case Anweisung mit Array?

    • Oscar
    • 13. August 2014 um 16:36

    Für die MessageLoop-Schleife könntest Du mit Switch arbeiten:

    Spoiler anzeigen
    [autoit]


    While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $array[8] To $array[80]
    GUICtrlSetBkColor($array, $COLOR_BLACK)
    EndSwitch
    WEnd

    [/autoit]
  • Nutzergesteuerte Datum/Zeit-Ausgabe

    • Oscar
    • 12. August 2014 um 17:33

    Ich dachte mir, die Funktion kann man doch auch etwas internationaler gestalten und da ich das ja schonmal gemacht habe (_DateDayOfWeekML),
    habe ich Deine Funktion diesbezüglich noch ein wenig verändert:

    Spoiler anzeigen
    [autoit]


    ConsoleWrite('Italian: ' & _DateTimeUser('ww DD.MM.YYYY hh:mm:ss', '', '', 2014, 1, 1, 0, 0, 0, "0410") & @CR)
    ConsoleWrite('German: ' & _DateTimeUser('ww DD.MM.YYYY hh:mm:ss', '', '', 2014, 1, 1, 0, 0, 0, "0407") & @CR)
    ConsoleWrite('English: ' & _DateTimeUser('ww DD.MM.YYYY hh:mm:ss', '', '', 2014, 1, 1, 0, 0, 0, "0409") & @CR)
    ConsoleWrite('French: ' & _DateTimeUser('ww DD.MM.YYYY hh:mm:ss', '', '', 2014, 1, 1, 0, 0, 0, "040c") & @CR)
    ConsoleWrite('Norwegian: ' & _DateTimeUser('ww DD.MM.YYYY hh:mm:ss', '', '', 2014, 1, 1, 0, 0, 0, "0414") & @CR)

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

    ;===============================================================================
    ; Function Name....: _DateTimeUser
    ; Description......: Nutzergesteuerte Datum- und/oder Zeitausgabe
    ; Parameter(s).....: $_time_format Nutzerdefiniertes Ausgabeformat
    ; .................: Makros YYYY / YY - Jahr 4/2 -stellig
    ; .................: MM / M - Monat 2/1 -stellig
    ; .................: DD / D - Tag 2/1 -stellig
    ; .................: hh / h - Stunde 2/1 -stellig
    ; .................: mm / m - Minute 2/1 -stellig
    ; .................: ss / s - Sekunde 2/1 -stellig
    ; .................: ww / w - Wochentag lang/kurz (Montag/Mo)
    ; .................: Bsp. "YYYY-MM-DD", "YYYYMMDD", "D.M.YY", "DD.MM.YYYY hh:mm:ss" (Standard)
    ; .................: "ww, DD.MM.YYYY"
    ; .................: Auch einzelne Werte und beliebige Kombinationen können abgefragt werden. "DD-hh-mm"
    ; ....[optional]...: $_pre vorangestellter String
    ; ....[optional]...: $_post nachgestellter String
    ; Return Value(s)..: Der formatierte Datum/Zeitstring für das heutige Datum
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _DateTimeUser($_time_format = '', $_pre = '', $_post = '', $iYear = @YEAR, $iMon = @MON, $iDay = @MDAY, $iHour = @HOUR, $iMin = @MIN, $iSec = @SEC, $sLang = @OSLang)
    $_time_format = ($_time_format = '') ? 'DD.MM.YYYY hh:mm:ss' : $_time_format
    Local $aTime[10][2] = [['MM', $iMon], ['DD', $iDay], ['hh', $iHour], ['mm', $iMin], ['ss', $iSec], _
    ['M', $iMon], ['D', $iDay], ['h', $iHour], ['m', $iMin], ['s', $iSec]]
    StringReplace($_time_format, 'Y', 'Y')
    Local $sYear = StringLeft('YYYY', @extended), $output = $_time_format
    Local $srepl = (StringLen($sYear) < 4) ? StringRight($iYear, 2) : $iYear
    If $sYear <> '' Then _
    $output = StringReplace($_time_format, $sYear, $srepl)
    Local $sformat
    For $i = 0 To 9
    $sformat = '%0' & StringLen($aTime[$i][0]) & 'd'
    $output = StringReplace($output, $aTime[$i][0], StringFormat($sformat, $aTime[$i][1]), 1, 1)
    Next
    If StringInStr($output, 'w') Then
    Local $sDayFormat = StringInStr($_time_format, 'ww') ? 'dddd' : 'ddd'
    Local $tDATE = DllStructCreate('word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds')
    DllStructSetData($tDATE, 'Year', $iYear)
    DllStructSetData($tDATE, 'Month', $iMon)
    DllStructSetData($tDATE, 'Day', $iDay)
    Local $Ret = DllCall('kernel32.dll', 'int', 'GetDateFormatW', 'ulong', Dec($sLang), 'dword', 0, 'ptr', DllStructGetPtr($tDATE), 'wstr', $sDayFormat, 'wstr', '', 'int', 2048)
    If @error Or Not $Ret[0] Then Return SetError(1, 0, '')
    Local $sWDay = $Ret[5]
    $output = StringReplace($output, 'ww', $sWDay, 1, 1)
    If Not @extended Then $output = StringReplace($output, 'w', $sWDay, 1, 1)
    EndIf
    Return $_pre & $output & $_post
    EndFunc ;==>_DateTimeUser

    [/autoit]
  • Ordnerpfad aus Textdatei auslesen

    • Oscar
    • 12. August 2014 um 16:50

    Bei GUISetIcon kannst Du als zweiten Parameter die Icon-ID angeben. Damit wählst Du (bei mehreren Icons) das entsprechende Icon aus.

  • _WinGetTitleEx - Extended WinGetTitle

    • Oscar
    • 12. August 2014 um 05:16

    Äh...dafür gibt es doch:

    [autoit]

    Opt('WinTitleMatchMode', 2)

    [/autoit]
  • Nutzergesteuerte Datum/Zeit-Ausgabe

    • Oscar
    • 11. August 2014 um 20:11

    Eine schöne Funktion, aber ich würde die Makros nur optional verwenden. Den Aufruf lieber auch mit beliebigen Daten zulassen.
    Also so:

    Spoiler anzeigen
    [autoit]


    ConsoleWrite(_DateTimeUser('ww DD.MM.YYYY hh:mm:ss', '', '', 2014, 1, 1, 0, 0, 0) & @CR)

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

    ;===============================================================================
    ; Function Name....: _DateTimeUser
    ; Description......: Nutzergesteuerte Datum- und/oder Zeitausgabe
    ; Parameter(s).....: $_time_format Nutzerdefiniertes Ausgabeformat
    ; .................: Makros YYYY / YY - Jahr 4/2 -stellig
    ; .................: MM / M - Monat 2/1 -stellig
    ; .................: DD / D - Tag 2/1 -stellig
    ; .................: hh / h - Stunde 2/1 -stellig
    ; .................: mm / m - Minute 2/1 -stellig
    ; .................: ss / s - Sekunde 2/1 -stellig
    ; .................: ww / w - Wochentag lang/kurz (Montag/Mo)
    ; .................: Bsp. "YYYY-MM-DD", "YYYYMMDD", "D.M.YY", "DD.MM.YYYY hh:mm:ss" (Standard)
    ; .................: "ww, DD.MM.YYYY"
    ; .................: Auch einzelne Werte und beliebige Kombinationen können abgefragt werden. "DD-hh-mm"
    ; ....[optional]...: $_pre vorangestellter String
    ; ....[optional]...: $_post nachgestellter String
    ; Return Value(s)..: Der formatierte Datum/Zeitstring für das heutige Datum
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _DateTimeUser($_time_format='', $_pre='', $_post='', $iYear = @YEAR, $iMon = @MON, $iDay = @MDAY, $iHour = @HOUR, $iMin = @MIN, $iSec = @SEC)
    $_time_format = ($_time_format = '') ? 'DD.MM.YYYY hh:mm:ss' : $_time_format
    Local $aTime[10][2] = [['MM', $iMon], ['DD', $iDay], ['hh', $iHour], ['mm', $iMin], ['ss', $iSec], _
    ['M', $iMon], ['D', $iDay], ['h', $iHour], ['m', $iMin], ['s', $iSec]]
    StringReplace($_time_format, 'Y', 'Y')
    Local $sYear = StringLeft('YYYY', @extended), $output = $_time_format
    Local $srepl = (StringLen($sYear) < 4) ? StringRight($iYear, 2) : $iYear
    If $sYear <> '' Then _
    $output = StringReplace($_time_format, $sYear, $srepl)
    Local $sformat
    For $i = 0 To 9
    $sformat = '%0' & StringLen($aTime[$i][0]) & 'd'
    $output = StringReplace($output, $aTime[$i][0], StringFormat($sformat, $aTime[$i][1]), 1, 1)
    Next
    If StringInStr($output, 'w') Then
    Local $YY = StringRight($iYear, 2), $aMonval[13] = ['',0,3,3,6,1,4,6,2,5,0,3,5], $iDiff
    Local $Y_val = Mod(($YY + Int($YY/4)), 7), $M_val = $aMonval[$iMon], $D_val = $iDay
    Local $aY_val[7][2] = [[2300,0],[2200,2],[2100,4],[2000,6],[1900,0],[1800,2],[1700,4]]
    For $i = 0 To 6
    If $iYear >= $aY_val[$i][0] Then
    $iDiff = $aY_val[$i][1]
    ExitLoop
    EndIf
    Next
    If ((Mod($iYear,400)=0)?1:(Mod($iYear,100)=0)?0:(Mod($iYear,4)=0)?1:0) Then $iDiff -= 1
    Local $aWDay[7][2] = [['Sonntag','So'],['Montag','Mo'],['Dienstag','Di'],['Mittwoch','Mi'], _
    ['Donnerstag','Do'],['Freitag','Fr'],['Samstag','Sa']]
    Local $w = Mod($Y_val + $M_val + $D_val + $iDiff, 7)
    $output = StringReplace($output, 'ww', $aWDay[$w][0], 1, 1)
    If Not @extended Then $output = StringReplace($output, 'w', $aWDay[$w][1], 1, 1)
    EndIf
    Return $_pre & $output & $_post
    EndFunc ;==>_DateTimeUser

    [/autoit]


    Die Zeile 51 habe ich noch um

    [autoit]

    If Not @extended Then

    [/autoit]


    ergänzt, weil sonst beim Mittwoch das "w" nochmal durch "Mi" ersetzt wird.

  • Über C++ mit unrar.dll .rar Datein entpacken

    • Oscar
    • 11. August 2014 um 15:25

    [verschoben nach "Andere Programmiersprachen"]

  • Listview-Datenbank-Beispiel

    • Oscar
    • 10. August 2014 um 11:38

    Ich habe das Beispiel-Script noch etwas erweitert und eine Beispiel-Datenbank erstellt.
    Siehe Post#1.

  • Textausgabe

    • Oscar
    • 9. August 2014 um 14:34

    Für die Textausgabe gibt es mehrere Möglichkeiten:
    - Label
    - Edit
    - ListBox
    - ListView
    - RichEdit
    - embedded IE

  • Ordnerpfad aus Textdatei auslesen

    • Oscar
    • 9. August 2014 um 14:31

    Von mir auch noch eine kurze Anmerkung. Das hier:

    [autoit]


    for $t=1 to 400
    $line = FileReadLine($file,$t)

    [/autoit]


    ist ungünstig, weil es bei großen Dateien sehr lange dauert (es wird jedes Mal vom Anfang der Datei gelesen).
    Wenn Du sowieso die ganze Datei zeilenweise abarbeiten willst, dann lasse den Line-Parameter ($t) bei FileReadLine weg.

    Siehe hierzu auch die Hilfe:

    Zitat

    From a performance standpoint it is a bad idea to read line by line specifying "line" parameter whose value is incrementing by one. This forces AutoIt to reread the file from the beginning until it reach the specified line.

  • Tabs .... aufgerufene Grafik bleibt bestehen bei Tab wechsel

    • Oscar
    • 9. August 2014 um 14:24

    Wo ist das lauffähige Beispielscript?

    Es kommt natürlich darauf an, wo Du die Grafik einbaust.
    Wenn sie nur auf einem bestimmten Tab auftauchen soll, dann musst Du sie auch dort erstellen.

  • Buttons zählen?

    • Oscar
    • 9. August 2014 um 14:21

    Bei ID und Buttons denke ich immer zuerst an eine AutoIt-GUI.
    Jetzt kommst Du mit einer Webseite, schreibst aber wieder nicht um welche Seite es sich handelt.
    Wo ist der HTML-Quelltext?
    Ein bißchen mehr Informationen und das Problem wäre wohl längst abgehakt. :S

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™