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

Beiträge von UEZ

  • suche jemanden für nen treiber - ich hoffe ich hab das hier alles richtig verstanden .

    • UEZ
    • 11. November 2010 um 00:34

    Einen Treiber mit AutoIt schreiben? ?(

    Wer das schafft, ist wirklich krank... 8)

    Gruß,
    UEZ

  • ArrayUnique ohne Bug´s und Schneller

    • UEZ
    • 10. November 2010 um 22:28

    Habe auch mal was gebastelt:

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    ;~ Dim $aNames[10][2] = [["Anton", ""], ["Berta", 15]]
    Dim $aNames[10] = ["Antonia", "Anton", "Cäsar", "Dora", "Emil", "Friedrich", "Gustav", "Heinrich", "Ida", "Julius"]

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

    Dim $aUnique[100000]
    For $I = 0 To Ubound($aUnique) - 1
    $r = Random(0, 9, 1)
    $aUnique[$I] = $aNames[$r]
    Next

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

    $ts = TimerInit()
    $test = ArrayUnique($aUnique)
    $te = TimerDiff($ts)
    ConsoleWrite(Round($te, 2) & " ms." & @CRLF)
    _ArrayDisplay($test)

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

    Dim $aNames[10][2] = [["Antonia", ""], ["Anton", ""], ["Cäsar", 300], ["Dora", 24], ["Emil", 33], ["Friedrich", 57], ["Gustav", 53], ["Heinrich", 34], ["Ida", 13], ["Julius", 77]]
    Dim $aUnique[100000][2]
    For $I = 0 To Ubound($aUnique) - 1
    $r = Random(0, 9, 1)
    $aUnique[$I][0] = $aNames[$r][0]
    $aUnique[$I][1] = $aNames[$r][1]
    Next

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

    $ts = TimerInit()
    $test = ArrayUnique($aUnique)
    $te = TimerDiff($ts)
    ConsoleWrite(Round($te, 2) & " ms." & @CRLF)
    _ArrayDisplay($test)

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

    ; #FUNCTION# =====================================================================================================================
    ; Name.............: ArrayUnique
    ; Description ...: Returns the Unique Elements of a 1-dimensional or 2-dimensional array.
    ; Syntax...........: _ArrayUnique($aArray[, $iBase = 0, oBase = 0, $iCase = 0])
    ; Parameters ...: $aArray - The Array to use
    ; $iBase - [optional] Is the input Array 0-base or 1-base index. 0-base by default
    ; $oBase - [optional] Is the output Array 0-base or 1-base index. 0-base by default
    ; $iCase - [optional] Flag to indicate if the operations should be case sensitive.
    ; 0 = not case sensitive, using the user's locale (default)
    ; 1 = case sensitive
    ; 2 = not case sensitive, using a basic/faster comparison
    ; Return values: Success - Returns a 1-dimensional or 2-dimensional array containing only the unique elements of that Dimension
    ; Failure - Returns 0 and Sets @Error:
    ; 0 - No error.
    ; 1 - Returns 0 if parameter is not an array.
    ; 2 - Array has more than 2 dimensions
    ; 3 - Array is already unique
    ; 4 - when source array is selected as one base but UBound(array) - 1 <> array[0] / array[0][0]
    ; 5 - Scripting.Dictionary cannot be created for 1D array unique code
    ; Author .........: UEZ 2010 for 2D-array, Yashied for 1D-array (modified by UEZ)
    ; Version ........: 0.96 Build 2010-11-20 Beta
    ; ================================================================================================================================
    Func ArrayUnique($aArray, $iBase = 0, $oBase = 0, $iCase = 0)
    If Not IsArray($aArray) Then Return SetError(1, 0, 0) ;not an array
    If UBound($aArray, 0) > 2 Then Return SetError(2, 0, 0) ;array is greater than a 2D array
    If UBound($aArray) = $iBase + 1 Then Return SetError(3, 0, $aArray) ;array is already unique because of only 1 element
    Local $dim = UBound($aArray, 2), $i
    If $dim Then ;2D array
    If $iBase And UBound($aArray) - 1 <> $aArray[0][0] Then Return SetError(4, 0, 0)
    Local $oD = ObjCreate('Scripting.Dictionary')
    If @error Then Return SetError(5, 0, 0)
    Local $i, $j, $k = $oBase, $l, $s, $aTmp, $flag, $sSep = Chr(01)
    Local $aUnique[UBound($aArray)][$dim]
    If Not $oBase Then $flag = 2
    For $i = $iBase To UBound($aArray) - 1
    For $j = 0 To $dim - 1
    $s &= $aArray[$i][$j] & $sSep
    Next
    If Not $oD.Exists($s) And StringLen($s) > 3 Then
    $oD.Add($s, $i)
    $aTmp = StringSplit(StringTrimRight($s, 1), $sSep, 2)
    For $l = 0 To $dim - 1
    $aUnique[$k][$l] = $aTmp[$l]
    Next
    $k += 1
    EndIf
    $s = ""
    Next
    $oD.RemoveAll
    If $k > 0 Then
    If $oBase Then $aUnique[0][0] = $k - 1
    ReDim $aUnique[$k][$dim]
    Else
    ReDim $aUnique[1][$dim]
    EndIf
    Else ;1D array
    If $iBase And UBound($aArray) - 1 <> $aArray[0] Then Return SetError(4, 0, 0)
    Local $sData = '', $sSep = ChrW(160), $flag
    For $i = $iBase To UBound($aArray) - 1
    If Not IsDeclared($aArray[$i] & '$') Then
    Assign($aArray[$i] & '$', 0, 1)
    $sData &= $aArray[$i] & $sSep
    EndIf
    Next
    If Not $oBase Then $flag = 2
    Local $aUnique = StringSplit(StringTrimRight($sData, 1), $sSep, $flag)
    EndIf
    Return SetError(0, 0, $aUnique)
    EndFunc ;==>ArrayUnique

    [/autoit]

    Sollte auch für 2D Arrays funzen!

    Gruß,
    UEZ

    Dateien

    ArrayUnique - Example.au3 1,22 kB – 561 Downloads ArrayUnique.au3 3,2 kB – 595 Downloads
  • ArrayUnique ohne Bug´s und Schneller

    • UEZ
    • 10. November 2010 um 21:55

    Wer ist denn UZE? :P

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    Dim $aNames[10][2] = [["Anton", 33], ["Berta", 15], ["Cäsar", 300], ["Dora", 24], ["Emil", 33], ["Friedrich", 57], ["Gustav", 53], ["Heinrich", 34], ["Ida", 13], ["Julius", 77]]
    Dim $aUnique[1000][2]
    For $I = 0 To Ubound($aUnique) - 1
    $r = Random(0, 9, 1)
    $aUnique[$I][0] = $aNames[$r][0]
    $aUnique[$I][1] = $aNames[$r][1]
    Next
    $test2 = _ArrayUnique3($aUnique)
    _ArrayDisplay($test2)

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

    Func _ArrayUnique3(Const ByRef $aArray, $iDimension = 0, Const $iBase = 0, Const $iCase = 0, $vDelim = '|')
    If ($iDimension > 2) Or ($iDimension < 0) Then Return SetError(3, 0, -2)
    If Not IsArray($aArray) Then Return SetError(1, 0, -1)
    If ($vDelim = '|') Then $vDelim = Chr(01)
    Local $iUboundDim = UBound($aArray)
    Local $sHold
    If Not UBound($aArray, 2) Then
    For $I = $iBase To $iUboundDim - 1
    If Not StringInStr($sHold, $aArray[$I], $iCase) Then $sHold &= $aArray[$I] & $vDelim
    Next
    Else
    For $I = $iBase To $iUboundDim - 1
    If Not StringInStr($sHold, $aArray[$I][$iDimension], $iCase) Then $sHold &= $aArray[$I][$iDimension] & $vDelim
    Next
    EndIf
    If $sHold Then Return StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim, 2)
    Return SetError(2, 0, 0)
    EndFunc

    [/autoit]

    Ich bekomme nur ein 1D Array zurück!

    Gruß,
    UEZ

  • Array Ergenisse nur 1 mal

    • UEZ
    • 10. November 2010 um 17:04

    2D Arrays scheinen auch nicht zu funzen:

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    Dim $aNames[10][2] = [["Anton", 33], ["Berta", 15], ["Cäsar", 300], ["Dora", 24], ["Emil", 33], ["Friedrich", 57], ["Gustav", 53], ["Heinrich", 34], ["Ida", 13], ["Julius", 77]]
    Dim $aUnique[1000][2]
    For $I = 0 To Ubound($aUnique) - 1
    $r = Random(0, 9, 1)
    $aUnique[$I][0] = $aNames[$r][0]
    $aUnique[$I][1] = $aNames[$r][1]
    Next
    _ArrayDisplay($aUnique, "Vorher")
    Dim $T1 = 0, $T2 = 0
    For $I = 1 To 20
    $T = TimerInit()
    $aTemp1 = ___ArrayUnique($aUnique, 1, 1)
    $T1 += TimerDiff($T)
    $T = TimerInit()
    $aTemp2 = _ArrayUnique($aUnique, 1, 1)
    $T2 += TimerDiff($T)
    Next
    _ArrayDisplay($aTemp1, Round($T1) & " ms")
    _ArrayDisplay($aTemp2, Round($T2) & " ms")
    Exit

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _ArrayUnique
    ; Description ...: Returns the Unique Elements of a 1-dimensional array.
    ; Syntax.........: _ArrayUnique($aArray[, $iDimension = 1[, $iBase = 0[, $iCase = 0[, $vDelim = "|"]]]])
    ; Parameters ....: $aArray - The Array to use
    ; $iDimension - [optional] The Dimension of the Array to use
    ; $iBase - [optional] Is the Array 0-base or 1-base index. 0-base by default
    ; $iCase - [optional] Flag to indicate if the operations should be case sensitive.
    ; 0 = not case sensitive, using the user's locale (default)
    ; 1 = case sensitive
    ; 2 = not case sensitive, using a basic/faster comparison
    ; $vDelim - [optional] One or more characters to use as delimiters. However, cannot forsee its usefullness
    ; Return values .: Success - Returns a 1-dimensional array containing only the unique elements of that Dimension
    ; Failure - Returns 0 and Sets @Error:
    ; 0 - No error.
    ; 1 - Returns 0 if parameter is not an array.
    ; 2 - _ArrayUnique failed for some other reason
    ; 3 - Array dimension is invalid, should be an integer greater than 0
    ; Author ........: SmOke_N
    ; Modified.......: litlmike
    ; Remarks .......: Returns an array, the first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) contain the unique strings.
    ; Related .......: _ArrayMax, _ArrayMin
    ; Link ..........:
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func ___ArrayUnique($aArray, $iDimension = 1, $iBase = 0, $iCase = 0, $vDelim = "|")
    Local $iUboundDim
    ;$aArray used to be ByRef, but litlmike altered it to allow for the choosing of 1 Array Dimension, without altering the original array
    If $vDelim = "|" Then $vDelim = Chr(01) ; by SmOke_N, modified by litlmike
    If Not IsArray($aArray) Then Return SetError(1, 0, 0) ;Check to see if it is valid array

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

    ;Checks that the given Dimension is Valid
    If Not $iDimension > 0 Then
    Return SetError(3, 0, 0) ;Check to see if it is valid array dimension, Should be greater than 0
    Else
    ;If Dimension Exists, then get the number of "Rows"
    $iUboundDim = UBound($aArray, 1) ;Get Number of "Rows"
    If @error Then Return SetError(3, 0, 0) ;2 = Array dimension is invalid.
    ;Declare blank array, which will hold the dimension declared by user
    Local $aArrayTmp[$iUboundDim]
    ;If $iDimension Exists, And the number of "Rows" is Valid:
    If $iDimension > 1 Then ;Makes sure the Array dimension desired is more than 1-dimensional
    For $i = 0 To $iUboundDim - 1 ;Loop through "Rows"
    $aArrayTmp[$i] = $aArray[$i][$iDimension - 1] ;$iDimension-1 to match Dimension
    Next
    Else ;Makes sure the Array dimension desired is 1-dimensional
    ;If Dimension Exists, And the number of "Rows" is Valid, and the Dimension desired is not > 1, then:
    ;For the Case that the array is 1-Dimensional
    If UBound($aArray, 0) = 1 Then ;Makes sure the Array is only 1-Dimensional
    ;~ For $i = 0 To $iUboundDim - 1
    ;~ $aArrayTmp[$i] = $aArray[$i]
    ;~ Next
    $aArrayTmp = $aArray
    Else ;For the Case that the array is 2-Dimensional
    For $i = 0 To $iUboundDim - 1
    $aArrayTmp[$i] = $aArray[$i][$iDimension - 1] ;$iDimension-1 to match Dimension
    Next
    EndIf
    EndIf
    EndIf

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

    Local $sHold ;String that holds the Unique array info
    For $iCC = $iBase To UBound($aArrayTmp) - 1 ;Loop Through array
    ;If Not the case that the element is already in $sHold, then add it
    If Not StringInStr($vDelim & $sHold, $vDelim & $aArrayTmp[$iCC] & $vDelim, $iCase) Then _
    $sHold &= $aArrayTmp[$iCC] & $vDelim
    Next
    If $sHold Then
    $aArrayTmp = StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim, 2 - $iBase) ;Split the string into an array
    Return $aArrayTmp ;SmOke_N's version used to Return SetError(0, 0, 0)
    EndIf
    Return SetError(2, 0, 0) ;If the script gets this far, it has failed
    EndFunc ;==>_ArrayUnique

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

    Func ____ArrayUnique(Const ByRef $aArray, $iDimension = 1, Const $iBase = 0, Const $iCase = 0, $vDelim = "|")
    If Not IsArray($aArray) Then Return SetError(1, 0, 0)
    If Not $iDimension Then Return SetError(3, 0, 0)
    If ($vDelim = '|') Then $vDelim = Chr(01)
    Local $iUboundDim = UBound($aArray)
    Local $sHold
    If (UBound($aArray, 0) = 1) Then
    For $I = $iBase To $iUboundDim - 1
    If Not StringInStr($sHold, $aArray[$I], $iCase) Then $sHold &= $aArray[$I] & $vDelim
    Next
    Else
    For $I = $iBase To $iUboundDim - 1
    If Not StringInStr($sHold, $aArray[$I][$iDimension - 1], $iCase) Then $sHold &= $aArray[$I][$iDimension - 1] & $vDelim
    Next
    EndIf
    If $sHold Then Return StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim, 2)
    Return SetError(2, 0, 0)
    EndFunc ;==>___ArrayUnique

    [/autoit]


    Wenn ich Zeit finde, bastele ich an einer ArrayUnique Funktion.

    Gruß,
    UEZ

  • Array Ergenisse nur 1 mal

    • UEZ
    • 9. November 2010 um 21:27

    Ich habe mir mal die _ArrayUnique() Funktion genauer angeschaut und es sieht nach einem Bug aus:

    [autoit]


    ...
    If $sHold Then
    $aArrayTmp = StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim, 1) ;Split the string into an array
    Return $aArrayTmp ;SmOke_N's version used to Return SetError(0, 0, 0)
    EndIf
    ...

    [/autoit]

    Der Fehler liegt an dem StringSplit(), sollte so aussehen:

    [autoit]


    $aArrayTmp = StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim, 2 - $iBase) ;Split the string into an array

    [/autoit]

    Das Beispiel von oben:

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>

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

    Dim $aArray[10] = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
    _ArrayDisplay($aArray, "$aArray")
    $aNewArray = __ArrayUnique($aArray, 1, 0) ;Using Default Parameters
    _ArrayDisplay($aNewArray, "$aNewArray represents the 1st Dimension of $aArray")

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _ArrayUnique
    ; Description ...: Returns the Unique Elements of a 1-dimensional array.
    ; Syntax.........: _ArrayUnique($aArray[, $iDimension = 1[, $iBase = 0[, $iCase = 0[, $vDelim = "|"]]]])
    ; Parameters ....: $aArray - The Array to use
    ; $iDimension - [optional] The Dimension of the Array to use
    ; $iBase - [optional] Is the Array 0-base or 1-base index. 0-base by default
    ; $iCase - [optional] Flag to indicate if the operations should be case sensitive.
    ; 0 = not case sensitive, using the user's locale (default)
    ; 1 = case sensitive
    ; 2 = not case sensitive, using a basic/faster comparison
    ; $vDelim - [optional] One or more characters to use as delimiters. However, cannot forsee its usefullness
    ; Return values .: Success - Returns a 1-dimensional array containing only the unique elements of that Dimension
    ; Failure - Returns 0 and Sets @Error:
    ; 0 - No error.
    ; 1 - Returns 0 if parameter is not an array.
    ; 2 - _ArrayUnique failed for some other reason
    ; 3 - Array dimension is invalid, should be an integer greater than 0
    ; Author ........: SmOke_N
    ; Modified.......: litlmike
    ; Remarks .......: Returns an array, the first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) contain the unique strings.
    ; Related .......: _ArrayMax, _ArrayMin
    ; Link ..........:
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func __ArrayUnique($aArray, $iDimension = 1, $iBase = 0, $iCase = 0, $vDelim = "|")
    Local $iUboundDim
    ;$aArray used to be ByRef, but litlmike altered it to allow for the choosing of 1 Array Dimension, without altering the original array
    If $vDelim = "|" Then $vDelim = Chr(01) ; by SmOke_N, modified by litlmike
    If Not IsArray($aArray) Then Return SetError(1, 0, 0) ;Check to see if it is valid array

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

    ;Checks that the given Dimension is Valid
    If Not $iDimension > 0 Then
    Return SetError(3, 0, 0) ;Check to see if it is valid array dimension, Should be greater than 0
    Else
    ;If Dimension Exists, then get the number of "Rows"
    $iUboundDim = UBound($aArray, 1) ;Get Number of "Rows"
    If @error Then Return SetError(3, 0, 0) ;2 = Array dimension is invalid.

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

    ;If $iDimension Exists, And the number of "Rows" is Valid:
    If $iDimension > 1 Then ;Makes sure the Array dimension desired is more than 1-dimensional
    Local $aArrayTmp[1] ;Declare blank array, which will hold the dimension declared by user
    For $i = 0 To $iUboundDim - 1 ;Loop through "Rows"
    _ArrayAdd($aArrayTmp, $aArray[$i][$iDimension - 1]) ;$iDimension-1 to match Dimension
    Next
    _ArrayDelete($aArrayTmp, 0) ;Get rid of 1st-element which is blank
    Else ;Makes sure the Array dimension desired is 1-dimensional
    ;If Dimension Exists, And the number of "Rows" is Valid, and the Dimension desired is not > 1, then:
    ;For the Case that the array is 1-Dimensional
    If UBound($aArray, 0) = 1 Then ;Makes sure the Array is only 1-Dimensional
    Dim $aArrayTmp[1] ;Declare blank array, which will hold the dimension declared by user
    For $i = 0 To $iUboundDim - 1
    _ArrayAdd($aArrayTmp, $aArray[$i])
    Next
    _ArrayDelete($aArrayTmp, 0) ;Get rid of 1st-element which is blank
    Else ;For the Case that the array is 2-Dimensional
    Dim $aArrayTmp[1] ;Declare blank array, which will hold the dimension declared by user
    For $i = 0 To $iUboundDim - 1
    _ArrayAdd($aArrayTmp, $aArray[$i][$iDimension - 1]) ;$iDimension-1 to match Dimension
    Next
    _ArrayDelete($aArrayTmp, 0) ;Get rid of 1st-element which is blank
    EndIf
    EndIf
    EndIf

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

    Local $sHold ;String that holds the Unique array info
    For $iCC = $iBase To UBound($aArrayTmp) - 1 ;Loop Through array
    ;If Not the case that the element is already in $sHold, then add it
    If Not StringInStr($vDelim & $sHold, $vDelim & $aArrayTmp[$iCC] & $vDelim, $iCase) Then _
    $sHold &= $aArrayTmp[$iCC] & $vDelim
    Next
    If $sHold Then
    $aArrayTmp = StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim, 2 - $iBase) ;Split the string into an array
    Return $aArrayTmp ;SmOke_N's version used to Return SetError(0, 0, 0)
    EndIf
    Return SetError(2, 0, 0) ;If the script gets this far, it has failed
    EndFunc ;==>_ArrayUnique

    [/autoit]


    Gruß,
    UEZ

  • Array Ergenisse nur 1 mal

    • UEZ
    • 9. November 2010 um 20:41

    Hier ein Workaround:

    [autoit]


    #include <Array.au3>
    Dim $aArray[10] = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
    _ArrayDisplay($aArray, "$aArray")
    $aNewArray = _ArrayUnique($aArray) ;Using Default Parameters
    _ArrayDelete($aNewArray, 0)
    _ArrayDisplay($aNewArray, "$aNewArray represents the 1st Dimension of $aArray")

    [/autoit]

    Beispiel ist aus der Hilfe.

    Gruß,
    UEZ

  • StringRegExp Tutorial / Reguläre Ausdrücke in AutoIt

    • UEZ
    • 9. November 2010 um 19:14
    Zitat von Oscar

    UEZ: So geht's

    [autoit]


    #include <Array.au3>
    $string = '14 124 AutoIt 4 283 Coding macht Spass 0815 Ende'
    $array = StringRegExp($string, '([^\d+|\h]+?)(?:\h|\z)', 3)
    _ArrayDisplay($array)

    [/autoit]

    Vielen Dank Oscar! :thumbup:

    Ich dachte da eher an einen "Schalter" in RegEx, der das Ergebnis im Prinzip umkehrt. Anscheinend gibt es diesen "Schalter" nicht!

    Gruß,
    UEZ

  • Was ist die schnellste Grafik(engine) ?

    • UEZ
    • 9. November 2010 um 15:34

    Nach meiner Meinung ist diese Frage irrelevant für AutoIt, da AutoIt der Flaschenhals ist! Ob man jetzt Direct2D, Direct3D, OpenGL, Irrlicht benutzt, ist teilweise eher geschmacksache, aber an der absoluten Geschwindigkeit wird sich nicht viel ändern.

    Wer in die Programmierung von 2D/3D Grafiken einsteigen will, sollte lieber eine andere Programmiersprachen nehmen (wie Andy bereits sagte)!

    Gruß,
    UEZ

  • StringRegExp Tutorial / Reguläre Ausdrücke in AutoIt

    • UEZ
    • 9. November 2010 um 15:26

    Alizame: Dass es anders geht, ist ja klar, aber wie geht es mit RegEx ist hier die Frage oder?

    Apropos Frage: kann man das Resultat umkehren (inventieren) für allgemeine reg. Ausdrücke?

    Z.B:
    14
    124
    AutoIt
    4
    283
    Coding
    macht
    Spaß
    0815

    Suche nach allen Zahlen mit RegEx und inventiere das Ergebnis, so dass man hier nur Wörter erhält!

    Warum suchst du nicht gleich nach Wörtern, wäre vielleicht eine Antwort! Aber wenn ich nicht weiß, dass es Wörter sind, aber ich weiß, dass es Zahlen sind, wäre es einfach nach dem Rest zu suchen!

    Gruß,
    UEZ

  • Skripte als 32bit und 64bit kompilieren

    • UEZ
    • 7. November 2010 um 17:04

    Das keiner drauf gekommen ist :whistling:

    [autoit]


    #AutoIt3Wrapper_Run_Before=del /f /q "%scriptfile%_x64.exe"
    #AutoIt3Wrapper_Run_Before=del /f /q "%scriptfile%_x86.exe"
    #AutoIt3Wrapper_Run_Before=""%autoitdir%\aut2exe\aut2exe.exe" /in "%in%" /out "%scriptdir%\%scriptfile%_x64.exe" /nopack /x64"
    #AutoIt3Wrapper_UseX64=n
    #AutoIt3Wrapper_Run_After=ren "%out%" "%scriptfile%_x86.exe"

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

    If @OSArch = "X86" Then
    MsgBox(0, "CPU", "CPU is x86", 10)
    Else
    MsgBox(0, "CPU", "CPU is x64", 10)
    EndIf

    [/autoit]

    Gruß,
    UEZ

  • CPU Auslastung eines Prozesses

    • UEZ
    • 7. November 2010 um 12:19

    Vielleicht hilft dir ja dieser Link: [ offen ] CPU Auslastung

    Gruß,
    UEZ

  • mit GDI+ Stream Amplitude (Bass.dll) anzeigen

    • UEZ
    • 7. November 2010 um 00:31

    Suche doch mal nach Bass.dll und eukalyptus!

    Die Wahrscheinlichkeit ist relativ groß was für dich zu finden.

    Gruß,
    UEZ

  • Bild proportional darstellen

    • UEZ
    • 5. November 2010 um 23:30

    Hilft dir das vielleicht weiter (ohne GDI+ ;) )?

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>

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

    $iFile = FileOpenDialog("Bitte ein Bild selektieren", "", "Bild (*.jpg;*.png;*.bmp;*.gif)")
    $iD = GetImageDim($iFile)
    If @error Then Exit

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

    $iW = $iD[0]
    $iH = $iD[1]

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

    $base_w = 150
    $base_h = 150

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

    $hGUI_w = 320
    $hGUI_h = 150
    $button_w = 100
    $hGUI = GUICreate("Bild Proportional Anzeiger von UEZ 2010", $hGUI_w, $hGUI_h) ;Titel klingt ja schreg
    $button = GUICtrlCreateButton("Exit", $base_w + ($hGUI_w - $base_w - $button_w ) / 2, $hGUI_h / 2 - 12, $button_w)

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

    If $iW < $base_w And $iH < $base_h Then
    $w = $base_w / 2 - $iW / 2
    $h = $base_h / 2 - $iH / 2
    GUICtrlCreatePic($iFile, $base_w / 2 - $iW / 2, $base_h / 2 - $iH / 2, $iW, $iH)
    Else
    If $iW > $iH Then
    $f = $iW / $base_w
    $w = $iW / $f
    $h = $ih / $f
    Else
    $f = $iH / $base_h
    $w = $iW / $f
    $h = $ih / $f
    EndIf
    GUICtrlCreatePic($iFile, $base_w / 2 - $w / 2, $base_h / 2 - $h / 2, $w, $h)
    EndIf

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

    $g = GUICtrlCreateGraphic(0, 0, $base_w, $base_h)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xc0c0ff, 0xc0c0ff)
    GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, 0, $base_w, $base_h)

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

    GUISetState()

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

    Do
    Switch GUIGetMsg()
    Case -3, $button
    GUIDelete($hGUI)
    Exit
    EndSwitch
    Until False

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

    Func GetImageDim($file) ;code by Melba23 - modified by UEZ
    Local $sFile = StringRegExp($file, "(?i).*\\(.*)", 3)
    If Not IsArray($sFile) Or @error Then Return SetError(1, 0, 0)
    Local $sPath = StringRegExp($file, "(?i)(.*)\\.+", 3)
    If Not IsArray($sFile) Or @error Then Return SetError(1, 0, 0)
    Local $sDimensions = ""
    Local $oShellApp = ObjCreate("shell.application")
    If IsObj($oShellApp) Then
    Local $oDir = $oShellApp.NameSpace($sPath[0])
    If IsObj($oDir) Then
    Local $oFile = $oDir.Parsename($sFile[0])
    If IsObj($oFile) Then
    If @OSBuild > 6000 Then
    $sDimensions = $oDir.GetDetailsOf($oFile, 31)
    ElseIf @OSVersion = "WIN_XP" Then
    $sDimensions = $oDir.GetDetailsOf($oFile, 26)
    EndIf
    EndIf
    EndIf
    EndIf
    If $sDimensions = "" Then Return SetError(1, 0, 0) ;"Object creation failed"
    Local $aDimensions = StringRegExp($sDimensions, "(?i)[\d]*x*[\d]", 3)
    If Not IsArray($aDimensions) Then Return SetError(1, 0, 0) ;"Cannot get image resolution!"
    Return SetError(0, 0, $aDimensions)
    EndFunc

    [/autoit]

    Einige PNGs bzw. BMPs werden leider mit GUICtrlCreatePic() überhaupt nicht bzw. falsch angezeigt!

    Da ich mich nicht so mit den Styles auskenne, kann es sein, dass man den Code mit Styles verkürzen kann...

    Zitat


    ich hab ein gui, bei dem des Picture Control 150x150 groß ist.. in diesem control soll ein bild (beispielsweiße 1500x3000) proportional angezeit (es wird also auf 150x300 runterskaliert..)

    Du meinst hier doch bestimmt 75x150 oder?

    Gruß,
    UEZ

  • Eine Variable = 0001 soll zu Variable 0002 ...0010

    • UEZ
    • 4. November 2010 um 21:15
    [autoit]


    For $i = 1 To 50
    $f = StringFormat("%04d", $i)
    ConsoleWrite($f & @CRLF)
    Next

    [/autoit]

    Gruß,
    UEZ

  • Skripte als 32bit und 64bit kompilieren

    • UEZ
    • 4. November 2010 um 19:24
    Zitat von Tweaky

    Steh grad aufm Schlauch :S
    Was soll ich wie testen?

    Wenn du F7 drückst, werden doch die Befehle im unteren Fenster von SciTE ausgegeben. Dort kannst du auch die Fehler beim Erstellen der Exe sehen.

    Gruß,
    UEZ

  • Bestimmten Text aus einer Datei auslesen und in einer zweiten Datei speichern

    • UEZ
    • 4. November 2010 um 17:22

    Hier eine schnell erstellte Variante:

    [autoit]


    #include <File.au3>

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

    Check1("Test1.txt", "Test1_new.log")

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

    Func Check1($file, $newlog)
    Local $aTxt, $i, $sNew
    _FileReadToArray($file, $aTxt)
    For $i = 1 To $aTxt[0]
    If StringInStr($aTxt[$i], " Logging o") Then $sNew &= $aTxt[$i] & @CRLF
    Next
    Local $hFile = FileOpen($newlog, 2)
    FileWrite($newlog, $sNew)
    FileClose($hFile)
    Return 1
    EndFunc

    [/autoit]

    Gruß,
    UEZ

  • Array-Sortierung: 51 vor 509

    • UEZ
    • 4. November 2010 um 12:49

    Schaue dir mal den Beitrag im engl. Forum an: Natural Order String Comparison

    Gruß,
    UEZ

  • Skripte als 32bit und 64bit kompilieren

    • UEZ
    • 3. November 2010 um 22:34

    Dann sieht es so aus, dass die Zeile
    #AutoIt3Wrapper_Run_Before="%autoitdir%\aut2exe\aut2exe.exe" /in "%in%" /out "%scriptfile%_64bit.exe" /nopack /x64
    nicht ausgeführt wird.

    Was sagt denn die Console von SciTE?

    Gruß,
    UEZ

  • Bestimmten Text aus einer Datei auslesen und in einer zweiten Datei speichern

    • UEZ
    • 3. November 2010 um 11:00

    Die Datei zeilenweise einlesen, nach dem Zeichen suchen und falls vorhanden die Zeile in eine neue Datei schreiben.

    Befehle dazu:
    FileOpen()
    FileReadLine()
    StringInStr() oder StringRegExp()
    FileWriteLine()
    FileClose()

    Gruß,
    UEZ

  • Scrollbares Label ?

    • UEZ
    • 2. November 2010 um 17:37

    Ich habe auch den Code von Post #5 angepasst!

    Da bewegt sich nur das Label und der Rest bleibt "stehen"!

    Natürlich kann man auch "Child" GUIs nehmen, wie im Beispiel von Großvater und den Scrollbalken direkt darunter plazieren - ist anwendungsspezifisch!

    Gruß,
    UEZ

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™