• hey leute....
    ich wollte einfach mal ein paar udfs hoch laden, die ich teilweiße selber geschrieben habe und sehr oft gebrauche :) wenn jemand diese udfs benötigen kann, könnt ihr sie einfach weiter verwenden ;)
    wenn ihr irgendwelche fehler findet oder verbesserungsvorschläge habt einfach melden ;)

    Update: 1.1.2
    -kleine änderungen und verbesserungen (dank der hilfe von Oscar und Marsi)

    Update: 1.1.3
    -ein paar funktion, die ich auf meinem rechner gefunden habe, sind dazu gekommen. ich weiß allerdings nicht mehr ob die von mir stammen oder nicht...

    Update: 1.2.1
    -ein paar funktion, die ich auf meinem rechner
    gefunden habe, sind dazu gekommen. ich weiß allerdings nicht mehr ob die
    von mir stammen oder nicht...
    -ein paar funktionen von mir, die, wenn sie in einer schleife laufen,
    dafür sorgen das von UBS-Sticks, Festplatten, DVDs etc. sofort eine
    Verknüpfung auf den Desktop erstellt werden, sobald diese angeschlossen
    werden
    -eine lustige Funktion von Smincke die dafür sorgt, das man auf das GUI - Fenster nicht mehr klicken kann :D

    Update: 1.2.3
    -ein paar neue funktionen
    -fehlendes fileclose bei der funktion _filefindall() hinzugefügt


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

    Func _KillProcesslist($a_Blacklist, $f_PID = False)
    Local $a_processlist = ProcessList()
    If (@error Or (Not IsArray($a_Blacklist)) Or (Not IsBool($f_PID))) Then Return SetError(-1)
    If Not $f_PID Then
    For $i = 1 To $a_processlist[0][0]
    For $x = 0 To UBound($a_Blacklist, 1) - 1
    If $a_processlist[$i][0] = $a_Blacklist[$x] Then ProcessClose($a_processlist[$i][0])
    Next
    Next
    Else
    For $i = 1 To $a_processlist[0][0]
    For $x = 0 To UBound($a_Blacklist, 1) - 1
    If $a_processlist[$i][1] = $a_Blacklist[$x] Then ProcessClose($a_processlist[$i][1])
    Next
    Next
    EndIf
    Return True
    EndFunc

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

    Func _Battery_StartUp()
    Local $o_WMIService = ObjGet("winmgmts:\\localhost\root\CIMV2")
    Return $o_WMIService.ExecQuery("SELECT * FROM Win32_Battery", "WQL", 48)
    EndFunc

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

    Func _Battery_IsCharging()
    Local $o_item, $_state = Default, $o_object = _Battery_StartUp()
    If IsObj($o_object) Then
    For $o_item in $o_object
    $_state = $o_item.BatteryStatus
    next
    If $_state < 0 Or $_state > 7 Then
    Return SetError(-2)
    Else
    If $_state = 2 Then
    Return True
    Else
    Return False
    EndIf
    EndIf
    Else
    Return SetError(-1)
    EndIf
    EndFunc

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

    Func _Battery_GetID()
    Local $o_item, $o_object = _Battery_StartUp()
    If IsObj($o_object) Then
    For $o_item in $o_object
    Return $o_item.DeviceID
    Next
    Else
    Return SetError(-1)
    EndIf
    EndFunc

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

    Func _Battery_GetCharge()
    Local $o_item, $o_object = _Battery_StartUp()
    If IsObj($o_object) Then
    For $o_item in $o_object
    Return $o_item.EstimatedChargeRemaining
    Next
    Else
    Return SetError(-1)
    EndIf
    EndFunc

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

    Func _Battery_GetVoltage()
    Local $o_item, $o_object = _Battery_StartUp()
    If IsObj($o_object) Then
    For $o_item in $o_object
    Return ($o_item.DesignVoltage/1000)
    Next
    Else
    Return SetError(-1)
    EndIf
    EndFunc

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

    Func _LockIt()
    Run("rundll32.exe user32.dll,LockWorkStation")
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _IsAlreadyRunning($s_process = @ScriptName)
    ; Description: überprüft ob ein Prozess breits läuft
    ; Parameters: $s_process = Name des Prozesses
    ; Version: v0.0.2 Build 2012-09-06
    ; Author(s): RedHead
    ;=================================================================================================================================
    Func _IsAlreadyRunning($s_process = @ScriptName)
    Local $a_process = ProcessList($s_process)
    If @error Or $a_process[0][0] = 0 Then
    Return False
    ElseIf $a_process[0][0] >= 2 Then
    Return True
    EndIf
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _CreateDriveInkOnDesktop()
    ; Version: v0.1.3 Build 2013-05-18
    ; Author(s): RedHead
    ;=================================================================================================================================
    Func _CreateDriveInkOnDesktop()
    Local $a_drive = DriveGetDrive("ALL")
    Local $a_driveondesktop = _GetDriveInkOnDesktop()
    Local $f_notfound = True, $s_drivelabel = "", $f_delete = True, $f_nichtidentisch = True

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

    If $a_drive[0] > $a_driveondesktop[0] Then
    For $i = 1 To $a_drive[0]
    $a_drive[$i] = StringUpper(StringLeft($a_drive[$i], 1)) & ":"
    $f_notfound = True
    For $x = 1 To $a_driveondesktop[0]
    If StringLeft($a_drive[$i], 1) = StringMid($a_driveondesktop[$x], 2, 1) Then $f_notfound = False
    Next
    If $f_notfound Then
    $s_drivelabel = DriveGetLabel($a_drive[$i])
    If @error Then $s_drivelabel = "UNKNOWN"
    FileCreateShortcut($a_drive[$i] & "\", @DesktopDir & "\(" & StringLeft($a_drive[$i], 1) & ") - " & $s_drivelabel)
    EndIf
    Next
    ElseIf $a_drive[0] < $a_driveondesktop[0] Then
    For $i = 1 To $a_driveondesktop[0]
    $f_delete = True
    For $x = 1 To $a_drive[0]
    If StringMid($a_driveondesktop[$i], 2, 1) = StringLeft($a_drive[$x], 1) Then $f_delete = False
    Next
    If $f_delete Then FileDelete(@DesktopDir & "\" & $a_driveondesktop[$i])
    Next
    EndIf
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _GetDriveInkOnDesktop()
    ; Version: v0.1.3 Build 2012-08-18
    ; Author(s): RedHead
    ;=================================================================================================================================
    Func _GetDriveInkOnDesktop()
    Local $h_search = FileFindFirstFile(@DesktopDir & "\*")
    Local $s_inkfiles = "", $a_array[1] = [0]

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

    While 1
    $s_file = FileFindNextFile($h_search)
    If @error Then ExitLoop
    If StringLeft($s_file, 1) = "(" And StringRegExp(StringMid($s_file, 2, 1), "[a-zA-Z]") And StringMid($s_file, 3, 1) = ")" Then $s_inkfiles &= $s_file & "|"
    WEnd

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

    FileClose($h_search)

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

    If $s_inkfiles = "" Then
    Return $a_array
    Else
    Return StringSplit(StringTrimRight($s_inkfiles, 1), "|")
    EndIf
    EndFunc

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

    Func _GetCPUUsed()
    ;by.......ich weiß es nicht mehr :D
    Local $wbemFlags = 0x10 + 0x20

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

    Local $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2")
    Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlags)

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

    Local $c = 0
    Local $sMsg = ""

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

    For $objItem In $colItems
    $sMsg &= "cpu%" & $objItem.LoadPercentage
    Next

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

    $CpuAuslastung = StringSplit($sMsg, "cpu%", 1)

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

    For $n = "0" To $CpuAuslastung[0]
    $c += $CpuAuslastung[$n]
    Next

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

    Return (Round($c / $CpuAuslastung[0], 0))
    EndFunc

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

    Func _Get_Standardbrowser($user = True)
    ;by.......ich weiß es nicht mehr :D
    If $user Then
    $key = RegRead("HKEY_CURRENT_USER\Software\Classes\http\shell\open\command","")
    Else
    $key = RegRead("HKEY_CLASSES_ROOT\http\shell\open\command","")
    EndIf
    If StringLeft($key, 1) = '"' Then
    $key = StringMid($key, 2, StringInStr($key, '"', 0, 2) - 2)
    Else
    If StringInStr($key, " ") > 0 Then $key = StringLeft($key, StringInStr($key, " ") - 1)
    EndIf
    If StringLen($key) > 0 Then Return $key
    Return 0
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _GUInotklickable($h_GUI)
    ; Author(s): Smincke
    ;=================================================================================================================================
    Func _GUInotklickable($h_GUI)
    ;by Smincke
    If (Not IsHWnd($h_GUI)) Then Return SetError(-1)
    $a_Pos = GUIGetCursorInfo($h_GUI)
    $a_Region1 = DllCall('gdi32.dll', 'handle', 'CreateRectRgn', 'int', 0, 'int', 0, 'int', 640, 'int', 480)
    $a_Region2 = DllCall('gdi32.dll', 'handle', 'CreateEllipticRgn', 'int', $a_Pos[0] - 17, 'int', $a_Pos[1] + 5, 'int', $a_Pos[0] + 23, 'int', $a_Pos[1] + 45)
    DllCall('gdi32.dll', 'int', 'CombineRgn', 'handle', $a_Region1[0], 'handle', $a_Region1[0], 'handle', $a_Region2[0], 'int', 3)
    DllCall('user32.dll', 'int', 'SetWindowRgn', 'hwnd', $h_GUI, 'handle', $a_Region1[0], 'bool', True)
    DllCall('gdi32.dll', 'bool', 'DeleteObject', 'handle', $a_Region1[0])
    DllCall('gdi32.dll', 'bool', 'DeleteObject', 'handle', $a_Region2[0])
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _VertikaleSchrift($s_text, $i_left = 10, $i_top = -1, $i_abstand = 15, $i_width = -1, $i_height = -1, $style = -1, $exstyle = -1)
    ; Description: write the text in vertical form
    ; Parameter(s): $s_text string to write
    ; Version: v1.1.2 Build 2012-01-18
    ; Author(s): RedHead
    ;=================================================================================================================================

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

    Func _VertikaleSchrift($s_text, $i_left = 10, $i_top = -1, $i_abstand = 15, $i_width = -1, $i_height = -1, $style = -1, $exstyle = -1)
    Local $s_letter
    Local $h_vertikale_schrift[StringLen($s_text)]

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

    If StringStripWS($s_text, 8) = "" Then Return SetError(-1, -1, -1)

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

    For $i = 0 To StringLen($s_text) - 1
    $s_letter = StringLeft($s_text, 1)
    $h_vertikale_schrift[$i] = GUICtrlCreateLabel($s_letter, $i_left, $i_top + ($i * $i_abstand), $i_width, $i_height, $style, $exstyle)
    $s_text = StringTrimLeft($s_text, 1)
    Next
    Return $h_vertikale_schrift
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _Wic($text)
    ; Description: write the text to console
    ; Parameter(s): $text string or array (max. 3 dimensions)
    ; Version: v1.1.2 Build 2012-03-17
    ; Author(s): RedHead
    ;=================================================================================================================================

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

    Func _Wic($text)
    If IsArray($text) Then
    Switch UBound($text, 0)
    Case 1
    For $i = 0 To UBound($text, 1) - 1
    ConsoleWrite($text[$i] & @CRLF)
    Next
    Case 2
    For $i = 0 To UBound($text, 1) - 1
    For $m = 0 To UBound($text, 2) - 1
    ConsoleWrite($text[$i][$m] & @CRLF)
    Next
    Next
    Case 3
    For $i = 0 To UBound($text, 1) - 1
    For $m = 0 To UBound($text, 2) - 1
    For $k = 0 To UBound($text, 3) - 1
    ConsoleWrite($text[$i][$m][$k] & @CRLF)
    Next
    Next
    Next
    EndSwitch
    Else
    ConsoleWrite($text & @CRLF)
    EndIf
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _IsFolder($s_pfad)
    ; Description: check the file, if it's a file or a folder
    ; Parameter(s): $s_pfad path of the file
    ; Return Value(s): True = Folder
    ; False = File
    ; Version: v1.1 Build 2012-05-28
    ; Author(s): Oscar
    ;=================================================================================================================================

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

    Func _IsFolder($s_Path)
    Return StringInStr(FileGetAttrib($s_Path), 'D') = 1
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _FileDeleteSave($s_pfad)
    ; Description: delete a file on a safty way
    ; Parameter(s): $s_pfad path of the file
    ; Version: v09.2 Build 2012-05-30
    ; Author(s): RedHead
    ;=================================================================================================================================
    Func _FileDeleteSave($s_pfad, $i_deletelevel)
    If ($i_deletelevel > 1) Or ($i_deletelevel < 0) Then Return SetError(-1)
    If (Not StringRegExp(StringLeft($s_pfad, 1), "[a-zA-Z]")) Or (Not StringMid($s_pfad, 2, 1) == ":") Then Return SetError(-2)
    Local $i_filesize_origin = FileGetSize($s_pfad) * $i_deletelevel, $i_filesize_work = 0, $s_rubbish
    Local $h_file_open = FileOpen($s_pfad, 2)

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

    While $i_filesize_origin >= $i_filesize_work
    $s_rubbish = ""
    For $i = 0 To 50
    $s_rubbish &= Random(1000000, 9999999999) & Chr(Random(97, 122, 1))
    Next
    $s_rubbish &= @CRLF
    FileWrite($h_file_open, $s_rubbish)
    $i_filesize_work = FileGetSize($s_pfad)
    WEnd
    FileClose($h_file_open)
    FileDelete($s_pfad)
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _FileToBinary()
    ; Description: transform a file to binary-code
    ;=================================================================================================================================

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

    Func _FileToBinary()
    Local $i_linelen = 1024
    Local $s_name = StringStripWS(InputBox("_FileToBinary", "Bitte geben sie einen Namen für die Datei in Binärform ein!", "File", "", 120, 150), 8)
    Local $s_file = FileOpenDialog("Open a file", @ScriptDir, "All (*.*)")
    If ($s_name == "") Or ($s_file == "") Or (Int(FileGetSize($s_file)) == 0) Then Exit

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

    Local $h_open = FileOpen($s_file, 16)
    Local $s_binary_string = String(FileRead($h_open))
    FileClose($h_open)

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

    Local $s_string = "Func " & $s_name & "()" & @CRLF & @TAB & "Local _" & @CRLF & @TAB & "$" & $s_name & ' = "' & StringLeft($s_binary_string, $i_linelen) & '"' & @CRLF
    $s_binary_string = StringTrimLeft($s_binary_string, $i_linelen)

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

    While StringLen($s_binary_string) > $i_linelen
    $s_string &= " $" & $s_name & ' &= "' & StringLeft($s_binary_string, $i_linelen) & '"' & @CRLF
    $s_binary_string = StringTrimLeft($s_binary_string, $i_linelen)
    WEnd

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

    If StringLen($s_binary_string) <> 0 Then $s_string &= " $" & $s_name & ' &= "' & $s_binary_string& '"' & @CRLF
    $s_string &= @TAB & "Return Binary($" & $s_name & ")" & @CRLF & "EndFunc"
    ClipPut($s_string)

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

    MsgBox(64, "Info", "Erfolg!")
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _FileCreateTemp($s_file_name, $s_func)
    ; Description: create a temporary file
    ; Parameter(s): $s_file_name name of the temporary file
    ; $s_func function or variable of the binary code
    ; Version: v1.1 Build 2012-04-15
    ; Author(s): RedHead
    ;=================================================================================================================================

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

    Func _FileCreateTemp($s_file_name, $s_func)
    Local $s_temp_file = @TempDir & "\" & $s_file_name
    Local $h_file = FileOpen($s_temp_file, 18)
    FileWrite($h_file, Binary($s_func))
    FileClose($h_file)
    Return $s_temp_file
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _FileDeleteAll($s_path, $s_title = "_FileDeleteAll()", $s_filetype = False , $s_filename = False)
    ; Description: Delete all files
    ; Parameter(s): $a_path path where to search
    ; $s_title title of the window
    ; $s_filetype search and delete just one filetype e.g. .mp3
    ; $s_filename seach and delete just files with this name
    ; Version: v0.83 Build 2012-05-30
    ; Author(s): RedHead
    ;=================================================================================================================================

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

    Func _FileDeleteAll($s_path, $s_title = "_FileDeleteAll()", $s_filetype = False , $s_filename = False)
    Local $a_ergebnis[1] = [0], $i_percent = 0, $a_folder[1]
    $a_ergebnis = _FileFindAll($s_path, $a_ergebnis, $s_filetype, $s_filename)
    If Not @error Then
    If Int($a_ergebnis[0]) <> 0 Then
    Local $h_file_open, $i_counter = 0
    Local $style_sizebox = 0x00040000
    Local $style_minimizebox = 0x00020000
    Local $i_onepercent = Round(Int($a_ergebnis[0])/100)
    Local $h_gui_delete = GUICreate($s_title, 600, 135, -1, -1, BitOR($style_sizebox, $style_minimizebox))
    Local $h_progress_file = GUICtrlCreateProgress(10, 10, 580, 20)
    GUICtrlSetResizing($h_progress_file, 2 + 32 + 4)
    Local $h_label_file = GUICtrlCreateLabel("", 10, 38, 580, 20)
    GUICtrlSetResizing($h_label_file, 2 + 4)
    Local $h_progress_all = GUICtrlCreateProgress(10, 60, 580, 20)
    GUICtrlSetResizing($h_progress_all, 2 + 4)
    Local $h_label_all = GUICtrlCreateLabel("0%", 10, 88, 580, 20)
    GUICtrlSetResizing($h_label_all, 2 + 64 + 4)
    GUISetState(@SW_SHOW, $h_gui_delete)
    For $i = 1 To Int($a_ergebnis[0])
    If Not _IsFolder($a_ergebnis[$i]) Then
    GUICtrlSetData($h_label_file, $a_ergebnis[$i])
    $i_counter = 0
    $h_file_open = FileOpen($a_ergebnis[$i], 2)

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

    For $x = 0 To 100000
    FileWrite($h_file_open, Random(100000, 9999999999) & Chr(Random(97, 122, 1)))
    If Mod($x, 1000) == 0 Then
    $i_counter += 1
    GUICtrlSetData($h_progress_file, $i_counter)
    EndIf
    Next
    FileClose($h_file_open)
    FileDelete($a_ergebnis[$i])
    EndIf
    For $m = 1 To 100
    If ($m * $i_onepercent) == $i Then
    GUICtrlSetData($h_progress_all, ($m * 1))
    GUICtrlSetData($h_label_all, ($m * 1) & " %")
    EndIf
    Next
    Next
    Sleep(500)
    GUIDelete($h_gui_delete)
    Else
    Return SetError(-3)
    EndIf
    Else
    Return SetError(-4)
    EndIf
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _FileFindAll($s_path, ByRef $a_found, $s_filetype = False, $s_filename = False)
    ; Description: search for files and return in filenames as an array
    ; Parameter(s): $s_path path where to search
    ; $a_found array to save the filenames
    ; $s_filetype search just one filetype e.g. .mp3
    ; $s_filename seach just files with this name
    ;
    ; Return: $a_found[0] = Anzahl der Elemente
    ; Version: v0.85 Build 2012-05-02
    ; Author(s): RedHead
    ;=================================================================================================================================

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

    Func _FileFindAll($s_path, ByRef $a_found, $s_filetype = False, $s_filename = False)
    If $s_path = "" Or Not IsArray($a_found) Then Return SetError(-1)
    If StringRegExp(StringLeft($s_path, 1), "[a-zA-Z]") And StringMid($s_path, 2, 1) = ":" Then
    If StringRight($s_path, 1) <> "\" Then $s_path &= "\"
    Local $s_suchen, $s_weitersuchen, $i_ubound
    If $s_filetype And StringLeft($s_filetype, 1) <> "*" Then $s_filetype = "*" & $s_filetype
    $s_suchen = FileFindFirstFile($s_path & "*")
    If $s_suchen = -1 Then Return SetError(-2)
    While 1
    $s_weitersuchen = FileFindNextFile($s_suchen)
    If @error Then ExitLoop
    If @extended Then _FileFindAll($s_path & $s_weitersuchen & "\", $a_found, $s_filetype, $s_filename)
    If $s_filetype And Not $s_filename Then
    If StringRight($s_weitersuchen, StringLen($s_filetype) - 1) = StringTrimLeft($s_filetype, 1) Then
    $i_ubound = UBound($a_found, 1)
    ReDim $a_found[$i_ubound + 1]
    $a_found[$i_ubound] = $s_path & $s_weitersuchen
    EndIf
    ElseIf $s_filename And Not $s_filetype Then
    If StringLeft($s_weitersuchen, StringLen($s_filename)) = $s_filename Then
    $i_ubound = UBound($a_found, 1)
    ReDim $a_found[$i_ubound + 1]
    $a_found[$i_ubound] = $s_path & $s_weitersuchen
    EndIf
    ElseIf $s_filename And $s_filetype Then
    If (StringRight($s_weitersuchen, StringLen($s_filetype) - 1) = StringTrimLeft($s_filetype, 1)) And (StringLeft($s_weitersuchen, StringLen($s_filename)) = $s_filename) Then
    $i_ubound = UBound($a_found, 1)
    ReDim $a_found[$i_ubound + 1]
    $a_found[$i_ubound] = $s_path & $s_weitersuchen
    EndIf
    Else
    $i_ubound = UBound($a_found, 1)
    ReDim $a_found[$i_ubound + 1]
    $a_found[$i_ubound] = $s_path & $s_weitersuchen
    EndIf
    WEnd
    FileClose($s_suchen)
    $a_found[0] = UBound($a_found) - 1
    Return $a_found
    Else
    Return SetError(-1)
    EndIf
    EndFunc

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

    ;================================================================================================================================
    ; Function Name: _GUIFadeInOut($hGUI, $bFadeIn = True, $iSpeed = 1)
    ; Description: fading of a gui-window
    ; Parameter(s): $hGUI handle or title of the window
    ; $bFadeIn True = visible
    ; False = invisible
    ; $iSpeed speed of the fade in/out effect
    ; Version: v0.92 Build 2012-05-28
    ; Author(s): Marsi
    ;=================================================================================================================================

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

    Func _GUIFadeInOut($hGUI, $bFadeIn = True, $iSpeed = 12)
    If Not (IsHWnd($hGUI) And IsBool($bFadeIn) And ($iSpeed > 0)) Then Return SetError(-1 * (Not IsHWnd($hGUI)) - 2 * (Not IsBool($bFadeIn)) - 4 * (Not ($iSpeed > 0)))
    If $bFadeIn Then GUISetState(@SW_SHOW + 0 * WinSetTrans($hGUI, "", 255 * (Not $bFadeIn)), $hGUI)
    For $i = 0 To 255 Step $iSpeed
    WinSetTrans($hGUI, "", (2 * $i - 255) * $bFadeIn + (255 - $i) + 0 * Sleep(10))
    Next
    WinSetTrans($hGUI, "", 255 * $bFadeIn) ; Korrigiert Fehler, wenn die Schleife nicht bei 0 oder 255 endet.
    If Not $bFadeIn Then GUISetState(@SW_HIDE, $hGUI)
    EndFunc ;==>_GUIFadeInOut

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

    ;================================================================================================================================
    ; Function Name: _FileGetType($s_path = @ScriptFullPath)
    ; Description: return fileytpe and filename
    ; Parameter(s): $s_path path of file
    ; Return Value(s): $a_file[0] = name
    ; $a_file[1] = type
    ; Version: v0.22 Build 2012-06-02
    ; Author(s): RedHead
    ;=================================================================================================================================

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

    Func _FileGetType($s_path = @ScriptFullPath)
    If StringRegExp(StringLeft($s_path, 1), "[a-zA-Z]") And StringMid($s_path, 2, 1) = ":" Then
    Local $a_path = StringSplit($s_path, ".")
    Return $a_path[$a_path[0]]
    Else
    Return SetError(-1)
    EndIf
    EndFunc

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

    Func _GetDataName($s_data)
    Local $a_data = StringSplit($s_data, "\")
    Return $a_data[$a_data[0]]
    EndFunc

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

    Func _CaesarVerschluesselung($s_code, $s_key, $f_encrypt = True, $a_keys = False)
    If Not IsString($s_code) Or (Not IsString($s_key) And Not IsInt($s_key)) Then Return SetError(-1)
    If Not IsBool($f_encrypt) Then Return SetError(-2)
    If Not IsBool($a_keys) And Not IsArray($a_keys) Then Return SetError(-3)

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

    Local $s_text = ""
    If Not $a_keys Then
    Local $a_stabdardkeys[36] = ["a", "b", "c", "d", "e", "f", _
    "g", "h", "i", "j", "k", "l", "m", _
    "n", "o", "p", "q", "r", "s", "t", "u", _
    "v", "w", "x", "y", "z", "0", "1", "2", "3", _
    "4", "5", "6", "7", "8", "9"]
    $a_keys = $a_stabdardkeys
    EndIf

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

    For $i = 0 To UBound($a_keys, 1) - 1
    If $s_key = $a_keys[$i] Then
    Local Const $i_key = $i
    ExitLoop
    EndIf
    Next

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

    Local $a_string = StringSplit(StringStripWS($s_code, 8), ""), $i_key_work

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

    If $f_encrypt Then
    For $i = 1 To $a_string[0]
    $i_key_work = $i_key
    For $x = 0 To UBound($a_keys, 1) - 1
    If $a_string[$i] = $a_keys[$x] Then
    If ($x + $i_key_work) > UBound($a_keys, 1) - 1 Then $i_key_work -= UBound($a_keys, 1)
    $s_text &= $a_keys[$x + $i_key_work]
    ExitLoop 1
    EndIf
    Next
    Next
    Else
    For $i = 1 To $a_string[0]
    $i_key_work = $i_key
    For $x = 0 To UBound($a_keys, 1) - 1
    If $a_string[$i] = $a_keys[$x] Then
    If ($x - $i_key_work) < 0 Then $i_key_work -= UBound($a_keys, 1)
    $s_text &= $a_keys[$x - $i_key_work]
    ExitLoop 1
    EndIf
    Next
    Next
    EndIf
    Return $s_text
    EndFunc

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

    Func _Datenabgleich($s_source_one, $s_source_two, $f_name = True, $f_date = False, $f_size = False)
    If (Not IsString($s_source_one)) Or (Not IsString($s_source_two)) Or Not IsBool($f_name) Or Not IsBool($f_date) Or Not IsBool($f_size) Then
    Return SetError(-1)
    ElseIf Not StringRegExp(StringLeft($s_source_one, 1), "[a-zA-Z]") Or StringMid($s_source_one, 2, 1) <> ":" Then
    Return SetError(-2)
    ElseIf Not StringRegExp(StringLeft($s_source_two, 1), "[a-zA-Z]") Or StringMid($s_source_two, 2, 1) <> ":" Then
    Return SetError(-3)
    EndIf
    Local $a_source_one[1] = [0], $a_source_two[1] = [0], $f_notfound = True, $a_notfound[1] = [0]

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

    _FileFindAll($s_source_one, $a_source_one)
    _FileFindAll($s_source_two, $a_source_two)

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

    For $i = 1 To $a_source_one[0]
    $f_notfound = True
    For $x = $a_source_two[0] To 1 Step - 1
    If $f_name and Not $f_date And Not $f_size Then
    If _GetDataName($a_source_one[$i]) = _GetDataName($a_source_two[$x]) Then
    $f_notfound = False
    ExitLoop 1
    EndIf
    ElseIf $f_date And Not $f_name And Not $f_size Then
    If FileGetTime($a_source_one[$i], 0, 1) = FileGetTime($a_source_two[$x], 0, 1) Then
    $f_notfound = False
    ExitLoop 1
    EndIf
    ElseIf $f_size And Not $f_name And Not $f_date Then
    If FileGetSize($a_source_one[$i]) = FileGetSize($a_source_two[$x]) Then
    $f_notfound = False
    ExitLoop 1
    EndIf
    ElseIf $f_name And $f_date And Not $f_size Then
    If _GetDataName($a_source_one[$i]) = _GetDataName($a_source_two[$x]) And FileGetTime($a_source_one[$i], 0, 1) = FileGetTime($a_source_two[$x], 0, 1) Then
    $f_notfound = False
    ExitLoop 1
    EndIf
    ElseIf $f_name And $f_size And Not $f_date Then
    If _GetDataName($a_source_one[$i]) = _GetDataName($a_source_two[$x]) And FileGetSize($a_source_one[$i]) = FileGetSize($a_source_two[$x]) Then
    $f_notfound = False
    ExitLoop 1
    EndIf
    ElseIf $f_date And $f_size And Not $f_name Then
    If FileGetTime($a_source_one[$i], 0, 1) = FileGetTime($a_source_two[$x], 0, 1) And FileGetSize($a_source_one[$i]) = FileGetSize($a_source_two[$x]) Then
    $f_notfound = False
    ExitLoop 1
    EndIf
    ElseIf $f_name And $f_date And $f_size Then
    If _GetDataName($a_source_one[$i]) = _GetDataName($a_source_two[$x]) And FileGetSize($a_source_one[$i]) = FileGetSize($a_source_two[$x]) And FileGetTime($a_source_one[$i], 0, 1) = FileGetTime($a_source_two[$x], 0, 1) Then
    $f_notfound = False
    ExitLoop 1
    EndIf
    EndIf
    Next
    If $f_notfound Then
    $i_ubound = UBound($a_notfound, 1)
    ReDim $a_notfound[$i_ubound + 1]
    $a_notfound[$i_ubound] = $a_source_one[$i]
    $a_notfound[0] += 1
    EndIf
    Next
    Return $a_notfound
    EndFunc

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

    Func _Datenabgleich_kopieren($a_source, $a_destination)
    Local $a_data

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

    For $i = 1 To $a_source[0]
    $a_data = _Datenabgleich($a_source[$i], $a_destination[$i])
    For $x = 1 To $a_data[0]
    ToolTip($a_data[$x], Default, Default, "Datenabgleich " & $i & " von " & $a_source[0], 1)
    FileCopy($a_data[$x], $a_destination[$i], 8)
    Next
    Next
    ToolTip("")
    EndFunc

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

    Func _IntegerToBinary($v_number)
    Local $b_binary = ""
    Do
    $b_binary = Mod($v_number, 2) & $b_binary
    $v_number = Floor($v_number/2)
    Until $v_number = 0
    Return $b_binary
    EndFunc

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

    Func _BmpToJpg($s_path)
    Local $h_image

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

    _GDIPlus_Startup()
    If _IsFolder($s_path) Then
    Local $a_files[1]

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

    _FileFindAll($s_path, $a_files, "*.bmp")

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

    For $i = 1 To $a_files[0]
    $h_image = _GDIPlus_ImageLoadFromFile($a_files[$i])
    _GDIPlus_ImageSaveToFile($h_image, StringTrimRight($a_files[$i], 3) & "jpg")
    _GDIPlus_ImageDispose($h_image)
    Next
    Else
    $h_image = _GDIPlus_ImageLoadFromFile($s_path)
    _GDIPlus_ImageSaveToFile($h_image, StringTrimRight($s_path, 3) & "jpg")
    _GDIPlus_ImageDispose($h_image)
    EndIf
    _GDIPlus_Shutdown()
    EndFunc

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _PlayDefaultSystemSound()
    ; Description ...: Spielt einen Systemklang, welcher in der Registry definiert ist.
    ; Syntax.........: _PlayDefaultSystemSound($sSoundName, $iWait = 0)
    ; Parameters ....: $sSoundName - Name des SystemSound's
    ; | Default - Standardton Warnsignal / Default Beep
    ; | CriticalBatteryAlarm - Alarm bei kritischem Batteriestand / when battery is critical
    ; | DeviceConnect - Geräteanschluß / when a device is connect
    ; | DeviceDisconnect - Gerätetrennung / when a device is disconnect
    ; | DeviceFail - Geräteanschluß fehlgeschlagen / when a deviceconnect is fail
    ; | LowBatteryAlarm - Alarm bei niedrigem Batteriestand / when battery is low
    ; | MailBeep - Posteingangsbenachrichtigung / when email is received
    ; | SystemAsterisk - Stern / Asterisk
    ; | SystemExclamation - Hinweis / when windows shows a warning
    ; | SystemExit - Windows beenden / when Windows shuts down
    ; | SystemHand - Kritischer Abbruch / when a critical stop occurs
    ; | SystemNotification - Sprechblase / when a critical stop occurs
    ; | SystemStart - Windows starten / when Windows starts up
    ; | WindowsLogoff - beim Windows abmelden / when logging off Windows
    ; | WindowsLogon - beim Windows anmelden / when logging on Windows
    ; | EmptyRecycleBin - Löschen des Papierkorbs / when recycle bin is emptied
    ; | Navigating - Browser Klick / navigating in browser
    ;
    ; $iWait - Warten bis SoundPlay beendet? (0 = nein / 1 = ja)
    ; Return values .: -----
    ; Author ........: funkey (AutoIt.de)
    ; ===============================================================================================================================

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

    Func _PlayDefaultSystemSound($sSoundName, $iWait = 0) ; funkey
    Local $sKey = 'HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default'
    If $sSoundName = 'EmptyRecycleBin' Or $sSoundName = 'Navigating' Then $sKey = 'HKEY_CURRENT_USER\AppEvents\Schemes\Apps\Explorer'
    Local $sFile = StringReplace(RegRead($sKey & '\' & $sSoundName & '\.Default', ''), '%SystemRoot%', @WindowsDir)
    If $sFile = "" Then
    SoundPlay(StringReplace(RegRead($sKey & '\.Default\.Default', ''), '%SystemRoot%', @WindowsDir), $iWait)
    Else
    SoundPlay($sFile, $iWait)
    EndIf
    EndFunc ;==>_PlayDefaultSystemSound

    [/autoit]
  • Nett :)
    Ich habe die meisten der Funktionen auch mal umgesetzt und daran errinere ich mich auch, nur gammeln die in irgendwelchen Scripten rum, die ich warscheinlich schon gelöscht habe, von daher: Schön, dass jemand solchle nützlchen Funktinen sammelt.

  • Da sind ein paar praktische Funktionen dabei.
    Ich muss meine Sammlung auch mal wieder organisieren. Alles ist auf 2 Rechnern in mindestens 3 Ordnern + Unterordner verstruet.

  • Fade In und Fade Out würde ich so schreiben.

    Spoiler anzeigen
    [autoit]

    Func _GUIFadeInOut($h_GUI, $x_InOut = False, $i_Speed = 1)
    If Not IsHWnd($h_GUI) Then Return SetError(-1)
    If Not IsBool($x_InOut) Then Return SetError(-2)
    If $i_Speed <= 0 then Return SetError(-3)

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

    If Not $x_InOut Then ;sichtbar
    WinSetTrans($h_GUI, "", 0)
    GUISetState(@SW_SHOW, $h_GUI)
    For $i = 0 To 255 Step 5
    WinSetTrans($h_GUI, "", $i)
    Sleep($i_Speed)
    Next
    Else ;unsichtbar
    For $i = 255 To 0 Step -5
    WinSetTrans($h_GUI, "", $i)
    Sleep($i_Speed)
    Next
    GUISetState(@SW_HIDE, $h_GUI)
    EndIf
    EndFunc

    [/autoit]


    Bei deiner ist es so, wenn du bestimmte Step-Werte schreibst, erreicht er nicht 255 bzw. 0.

  • Alle Varianten in denen Sleep genutzt wird sind schwierig zu handhaben.
    Sleep funktinoiert nur in 10er Schritten.
    Man kann aber am Ende Die Transparenz auf 255 oder 0 setzen je nach Input um Probleme mit der Schleife zu beheben.

    Hier mal meine Version.
    - Funktioniert mit Kommazahlen > 0 für die Geschwindigkeitseinstellung
    - Der Error zeigt nicht nur den ersten Fehler, sondern alle. (konbinierbar, da -1, -2, -4)
    - Kompakt :P

    Spoiler anzeigen
    [autoit]


    Global $hGUI = GUICreate('Blubb', 300, 300)

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

    _GUIFadeInOut($hGUI, True, 0.75)
    ConsoleWrite(@error & @CRLF)

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

    Sleep(1000)

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

    _GUIFadeInOut($hGUI, False, 1.58345)
    ConsoleWrite(@error & @CRLF)

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

    Sleep(1000)

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

    ;~ @error
    ; -1 - $hGUI ist kein hWnd
    ; -2 - $bFadeIn ist kein True/False Wert
    ; -4 - $iSpeed ist kleiner gleich 0
    ; Alle kombinationen dieser Errors sind möglich.

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

    Func _GUIFadeInOut($hGUI, $bFadeIn = True, $iSpeed = 1)
    If Not (IsHWnd($hGUI) And IsBool($bFadeIn) And ($iSpeed > 0)) Then Return SetError(-1 * (Not IsHWnd($hGUI)) - 2 * (Not IsBool($bFadeIn)) - 4 * (Not ($iSpeed > 0)))
    If $bFadeIn Then GUISetState(@SW_SHOW + 0 * WinSetTrans($hGUI, '', 255 * (Not $bFadeIn)), $hGUI)
    For $i = 0 To 255 Step $iSpeed
    WinSetTrans($hGUI, '', (2 * $i - 255) * $bFadeIn + (255 - $i) + 0 * Sleep(10))
    Next
    WinSetTrans($hGUI, '', 255 * $bFadeIn) ; Korrigiert Fehler, wenn die Schleife nicht bei 0 oder 255 endet.
    If Not $bFadeIn Then GUISetState(@SW_HIDE, $hGUI)
    EndFunc ;==>_GUIFadeInOut

    [/autoit]
  • Update: 1.2.1

    -ein paar funktion, die ich auf meinem rechner

    gefunden habe, sind dazu gekommen. ich weiß allerdings nicht mehr ob die

    von mir stammen oder nicht...

    -ein paar funktionen von mir, die, wenn sie in einer schleife laufen,
    dafür sorgen das von UBS-Sticks, Festplatten, DVDs etc. sofort eine
    Verknüpfung auf den Desktop erstellt werden, sobald diese angeschlossen
    werden

    -eine lustige Funktion von Smincke die dafür sorgt, das man auf das GUI - Fenster nicht mehr klicken kann :D

  • Nette Funktionen,
    Noch ein kleiner Tipp zur _Datenabgleich() Funktion,
    Man kann auch den Hashwert der Dateien überprüfen lassen, dadurch kann man schnell den Inhalt einer (großen) Datei überprüfen lassen.

    [autoit]

    #include <Crypt.au3>
    _Crypt_HashFile($sFile, $iALG_ID)

    [/autoit]

    Sind TV-Quizfragen zu einfach? A) Ja B) Harry Potter

    Spoiler anzeigen

    Ich gebe zu dieser Post hat wahrscheinlich nicht viel geholfen,
    aber ich versuche wenigstens zu helfen :rolleyes:

  • danke für den hinweis ;) werde ich einbauen sobald ich zeit dafür habe :)
    noch ein kleine frage...wird bei der hashfunktion nur der inhalt der datei berücksichtig oder auch dateiname und endung? würde ich also 2 verschiedene hashstrings bekommen wenn ich nur einen buchstaben im dateinamen veränder, obwohl die datei die selbe geblieben ist?