hallo leute
hab da ein script geschrieben (ist noch nicht ganz fertig), der die dateiendungen ändert, da ich in nächster zeit viele dateien umbenennen muss.
habe eine kosmetik frage, wie kann ich die graue schattierung bei den texten entfernen?
Spoiler anzeigen
#include <File.au3>
#include <Array.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiMenu.au3>
#include <ButtonConstants.au3>
#include <GuiComboBox.au3>
#include <StaticConstants.au3>
#cs ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]AutoIt Version: 3.3.6.1
Author: Gianni
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
HotKeySet("{ESC}", "_exit")
Dim $szDrive, $szDir, $szFName, $szExt
Global Const $AC_SRC_ALPHA = 1
; Script Start - Add your code below here
[/autoit] [autoit][/autoit] [autoit];------------------------------- extRename ---------------------------------------------
_GDIPlus_Startup()
$pngSrc = @ScriptDir & "\gui\gui.png"
$hImage = _GDIPlus_ImageLoadFromFile($pngSrc)
$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)
$GUI = GUICreate("Ascii-Hex-Converter", $width, $height, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU), $WS_EX_LAYERED)
[/autoit] [autoit][/autoit] [autoit]SetBitmap($GUI, $hImage, 0)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()
For $i = 0 To 255 Step 40
Sleep(5)
SetBitmap($GUI, $hImage, $i)
Next
SetBitmap($GUI, $hImage, 255)
$WinPos = WinGetPos($GUI)
[/autoit] [autoit][/autoit] [autoit]$_X = GUICreate("", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_TOOLWINDOW, $WS_EX_LAYERED), $GUI)
GUICtrlCreatePic(@ScriptDir & "\gui\grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)
$labelBeschreibung = GUICtrlCreateLabel("Bitte die Dateiendungen ohne Punkt ('.') angeben (z.B. zip, exe oder jpg)", 40, 40, 310, 35)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$btnDurchsuchen = GUICtrlCreateButton("Durchsuchen..", 260, 90, 91, 25, $BS_FLAT)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$inputDirectory = GUICtrlCreateInput("", 40, 90, 201, 21)
$ext = GUICtrlCreateInput("", 40, 130, 201, 21)
$labelInputOldExt = GUICtrlCreateLabel("alte Dateiendung", 260, 130, 90, 17)
GUICtrlSetFont(-1, 8, 500, 0, "MS Sans Serif")
$newExt = GUICtrlCreateInput("", 40, 170, 201, 21)
$labelInputNewExt = GUICtrlCreateLabel("neue Dateiendung", 260, 170, 90, 17)
GUICtrlSetFont(-1, 8, 500, 0, "MS Sans Serif")
$btnOK = GUICtrlCreateButton("OK", 40, 210, 70, 25, $BS_FLAT)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
$btnAbbrechen = GUICtrlCreateButton("Abbrechen", 170, 210, 70, 25, $BS_FLAT)
GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
GUISetState()
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $btnDurchsuchen
$fileFolder = FileSelectFolder("Ordner angeben", "C:\", 5)
GUICtrlSetData($inputDirectory, $fileFolder)
Case $btnOK
$readDirectory = GUICtrlRead($inputDirectory)
$readExt = GUICtrlRead($ext)
$readNewExt = GUICtrlRead($newExt)
If $readDirectory <> "" Then
If StringRight($readDirectory, 1) = "\" Then $readDirectory = StringTrimRight($readDirectory, 1)
Else
MsgBox(48, "Ordner", "Bitte einen Ordner angeben!")
ContinueLoop
EndIf
If $readExt <> "" And $readNewExt <> "" Then
If StringLen($readExt) == 3 And StringLen($readNewExt) == 3 Then
$extRename = _extRename($readDirectory, $readExt, $readNewExt)
If $extRename = 1 Then MsgBox(64, "Erfolgreich", "Datei(en) erfolgreich unbenannt!")
Else
MsgBox(48, "Dateiendung", "Bitte die Dateiendungen korrekt eingeben!")
EndIf
EndIf
Case $btnAbbrechen
Exit
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
For $i = 200 To 0 Step -40
SetBitmap($GUI, $hImage, $i)
Next
_WinAPI_DeleteObject($hImage)
_GDIPlus_Shutdown()
;------------------------------- Functions ---------------------------------------------
Func _extRename($folder, $extension, $newExtension)
$firstFile = FileFindFirstFile($folder & "\*." & $extension)
If $firstFile = -1 Then
MsgBox(0, "Fehler", "Keine Dateien gefunden")
Exit
EndIf
While 1
$file = FileFindNextFile($firstFile)
If @error Then ExitLoop
$fileExt = StringRight($firstFile, 3)
$fileExt = $newExtension
$fileSplit = _PathSplit($file, $szDrive, $szDir, $szFName, $szExt)
$fileMove = $szDrive & $szDir & $szFName & "." & $newExtension
$success = FileMove($folder & "\" & $file, $folder & "\" & $fileMove)
WEnd
If $success = 1 Then Return 1
EndFunc ;==>_extRename
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc ;==>WM_NCHITTEST
Func SetBitmap($hGUI, $hImage, $iOpacity)
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
$hScrDC = _WinAPI_GetDC(0)
$hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", $iOpacity)
DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
_WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hMemDC)
EndFunc ;==>SetBitmap
Func _exit()
Exit
EndFunc ;==>_exit
danke für die hilfe.
grüsse
gianni