Jump to content

Masa Üstü Dosya Silici


FaİR
 Share

Recommended Posts

[img]http://i55.tinypic.com/2yki7i1.jpg[/img]
[codebox]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <GuiComboBoxEx.au3>
#include <File.au3>

Opt("GUICloseOnESC", 1)
Opt("GUIOnEventMode", 1)

Global $fTypes = "au3|doc|docx|txt|zip|rar|exe|lnk"

$Gui = GUICreate("Masa üstü Dosya Silici", 392, 185, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "Event", $Gui)

$LV = GUICtrlCreateListView("Desktop Files", 5, 10, 280, 140, -1, BitOR($LVS_EX_CHECKBOXES, $WS_EX_CLIENTEDGE))
FindDesktopFiles()

GUICtrlCreateGroup("Dosya Türleri", 290, 5, 90, 45)
$Combo = GUICtrlCreateCombo("Hepsi", 300, 20, 70, 20, $CBS_DROPDOWNLIST)
GUICtrlSetOnEvent(-1, "Event")
GUICtrlSetData(-1, $fTypes, "Hepsi")

$SelectAll = GUICtrlCreateButton("Tümünü seç", 290, 65, 100, 25)
GUICtrlSetOnEvent(-1, "Event")
$SelectNone = GUICtrlCreateButton("Hiçbirini Seçme", 290, 95, 100, 25)
GUICtrlSetOnEvent(-1, "Event")
$InvertSeleced = GUICtrlCreateButton("Seçili haricindekileri", 290, 125, 100, 25)
GUICtrlSetOnEvent(-1, "Event")

$SendToBin = GUICtrlCreateButton("Seçilen Dosyaları Geri Dönüşüm Kutusu gönder", 5, 155, 375, 25)
GUICtrlSetOnEvent(-1, "Event")
GUICtrlSetFont(-1, 10, 700)

GUISetState(@SW_SHOW, $Gui)

While 1
Sleep(100)
WEnd

Func Event()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Exit
Case $Combo
FindDesktopFiles(GUICtrlRead($Combo))
Case $SelectAll
For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1
_GUICtrlListView_SetItemChecked($LV, $s, True)
Next
Case $SelectNone
For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1
_GUICtrlListView_SetItemChecked($LV, $s, False)
Next
Case $InvertSeleced
For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1
If _GUICtrlListView_GetItemChecked($LV, $s) Then
_GUICtrlListView_SetItemChecked($LV, $s, False)
Else
_GUICtrlListView_SetItemChecked($LV, $s, True)
EndIf
Next
Case $SendToBin
For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1
If _GUICtrlListView_GetItemChecked($LV, $s) Then _
FileRecycle(@DesktopDir & "\" & _GUICtrlListView_GetItemText($LV, $s, 0))
Next
FindDesktopFiles(GUICtrlRead($Combo))
EndSwitch
EndFunc

Func FindDesktopFiles($sType = "All Types")
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($LV))
Local $ext = "*." & $sType, $FL2A
If $sType = "All Types" Then $ext = "*.*"
$FL2A = _FileListToArray(@DesktopDir, $ext, 1)
If Not @error Then
For $i = 1 To $FL2A[0]
If $sType = "All Types" Then
Local $SST = StringSplit($fTypes, "|")
For $j = 1 To $SST[0]
If $SST[$j] = StringMid($FL2A[$i], StringInStr($FL2A[$i], ".", 0, -1) + 1) Then _
GUICtrlCreateListViewItem($FL2A[$i], $LV)
Next
ElseIf $sType <> "All Types" Then
If $sType = StringMid($FL2A[$i], StringInStr($FL2A[$i], ".", 0, -1) + 1) Then _
GUICtrlCreateListViewItem($FL2A[$i], $LV)
EndIf
Next
_GUICtrlListView_SetColumnWidth($LV, 0, $LVSCW_AUTOSIZE)
EndIf
EndFunc
[/codebox]
Link to comment
Share on other sites

Siz yaptıysanız güzel bi örnek fakat autoit forumlarından aldıysanız belirtseniz iyi olurdu.Çünkü bazı yerler ingilizce kalmış ve bu yüzden FindDesktopFiles fonksiyonu düzgün çalışmayacaktır.Çünkü combodan hepsi diye seçtiğimizde ona gidecek olan komut Hepsi olacak fakat bu parametre fonksiyonda çalışmaz.Muhtemelen çevirmeden önce All Types yazıyodu fonksiyonda ona göre ayarlanmış.Fonksiyonun en başına

If $sType = "Hepsi" Then $sType = "All Types"

bunu eklersek sorun kalmaz.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...