djonur007 Posted September 6, 2010 Share Posted September 6, 2010 listbox'a C:\A klasörünün içindeki dosya ve klasörleri nasıl ekletiriz? Link to comment Share on other sites More sharing options...
KintaRo Posted September 6, 2010 Share Posted September 6, 2010 Page On Show kodu: nToplam = ListBox.GetCount("ListBox1") if nToplam ~= 0 then nSayi = 0 repeat ListBox.DeleteItem("ListBox1", 1) nSayi = nSayi+1 if nSayi == nToplam then break; end until nSayi == nToplam end tDosyalar = File.Find("c:\\a", "*.*", false, false, nil, nil) if tDosyalar ~= nil then for i in pairs(tDosyalar) do ListBox.AddItem("ListBox1", tDosyalar, "") end end Bu kodlar C:\a\dosya.exe seklinde tam yolu gösterek ekler sadece dosya adını eklemek isterseniz şunu kullanın: nToplam = ListBox.GetCount("ListBox1") if nToplam ~= 0 then nSayi = 0 repeat ListBox.DeleteItem("ListBox1", 1) nSayi = nSayi+1 if nSayi == nToplam then break; end until nSayi == nToplam end tDosyalar = File.Find("c:\\a", "*.*", false, false, nil, nil) if tDosyalar ~= nil then for i in pairs(tDosyalar) do tAyir = String.SplitPath(tDosyalar) ListBox.AddItem("ListBox1", tAyir.Filename, "") end end Link to comment Share on other sites More sharing options...
djonur007 Posted September 6, 2010 Author Share Posted September 6, 2010 Peki c:\a\b\c\d\.... şeklinde klasörler varsa ve bu klasörlerin için dosyalar varsa bunları yazdıramaz mıyız? Link to comment Share on other sites More sharing options...
KintaRo Posted September 6, 2010 Share Posted September 6, 2010 tabii ki ekletebilirsin. tDosyalar = File.Find("c:\\a", "*.*", false, false, nil, nil) yerine tDosyalar = File.Find("c:\\a", "*.*", true, false, nil, nil) kodunu kulalnırsan alt klasorlerdeki dosyalarıda arar ve ekler Eğer çok dosya varsa ve uzun sürüyorsa şu şekilde progressde gösterebilirsin: StatusDlg.Show()File.Find StatusDlg.Hide() Link to comment Share on other sites More sharing options...
KintaRo Posted September 6, 2010 Share Posted September 6, 2010 hatta ve hatta kodları şu şekilde düzenlersen normal progress de gösterebilirsin: nToplam = ListBox.GetCount("ListBox1") if nToplam ~= 0 then nSayi = 0 repeat ListBox.DeleteItem("ListBox1", 1) nSayi = nSayi+1 if nSayi == nToplam then break; end until nSayi == nToplam end tDosyalar = File.Find("c:\\Windows", "*.*", true, false, nil, nil) Progress.SetCurrentPos("Progress1", 0) nSay = Table.Count(tDosyalar) Progress.SetRange("Progress1", 1, nSay) if tDosyalar ~= nil then for i in pairs(tDosyalar) do tAyir = String.SplitPath(tDosyalar) ListBox.AddItem("ListBox1", tAyir.Filename, "") nPos = Progress.GetCurrentPos("Progress1") Progress.SetCurrentPos("Progress1", nPos+1) end end Link to comment Share on other sites More sharing options...
spydevil Posted September 11, 2010 Share Posted September 11, 2010 Peki c:\a\b\c\d\.... şeklinde klasörler varsa ve bu klasörlerin için dosyalar varsa bunları yazdıramaz mıyız? Kintaronun verdiğine ek olarak; tDosyaBul = File.Find("C:\\a", "*.*", true, false, nil, nil) if tDosyaBul then Progress.SetRange("Progress", 0, #tDosyaBul); --Menzil belirle StatusDlg.SetMeterRange(0, #tDosyaBul); --Menzil belirle StatusDlg.SetTitle("Aranıyor.."); StatusDlg.ShowCancelButton(true, "Durdur"); --İptal butonunu göster StatusDlg.Show(MB_ICONNONE, false); --Status penceresini göster Table.Sort(tDosyaBul, nil); --tDosyaBul tablosunu harf'e göre küçükten büyüğe sırala Progress.SetVisible("Progress", true); --Progress göster ListBox.SetUpdate("Bulunan", false);--Listbox ekleneceği sırada görünürlüğü kapat for a, t in pairs(tDosyaBul) do tYol = String.SplitPath(t); --Yolu parçala ListBox.AddItem("Bulunan", tYol.Filename .. tYol.Extension, ""); --Listboxa ekle Progress.SetCurrentPos("Progress", a); --Progress pozisyonunu belirle StatusDlg.SetMeterPos(a); --Status pozisyonunu belirle Progress.SetText("Progress", t); --Progress yazısını belirle StatusDlg.SetStatusText("Bulunan: " .. t); --Status yazısını belirle if StatusDlg.IsCancelled() == true then --Eğer durdura basılmışsa aşağıya geç if Dialog.Message("", "Arama işlemi durdurulsun mu?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1) == IDYES then --Evet denilirse aşağıya geç break; --Döngüyü durdur end end end ListBox.SetUpdate("Bulunan", true); --Listbox görünürlüğünü aç Progress.SetVisible("Progress", false);--Progress göster StatusDlg.Hide();--Status penceresini gizle end Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.