Yusuf-Yildiz Posted January 28, 2012 Share Posted January 28, 2012 (edited) [b]Selamun aleykum arkadaşlar. Benim yardım etmenizi istediğim konu şu;[/b] [b] [/b] [b]Bir tane input bir tane de butonumuz var. Şimdi butona tıkladığımızda inputa girilen yazıyı ini dosyasına kayıt edecek. Ancak, mesela ad1 girişi boş ise ad1'e, dolu ise ad2 ye; ad2 girişi dolu ise ad3'e, ad3 girişi dolu ise ad4'e... kayır edecek. 10-15 olsa yaparım kodları biliyorum ama en az 160 adet olacağı için biraz zorlandım. Bunları for ile veya başka bir yöntemle nasıl yazarım? Teşekkürler....[/b] [b] Edit: Aşağıdaki benim yazdığım kodlar düzgün çalışıyor, fakat sadece 3 adet için. Sınırsız ya da yüksek bir sayıda yapmamız lazım; [/b] [spoiler][code]ad = Input.GetText("Input1"); yer = Input.GetText("Input2"); ad1= INIFile.GetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "ad1"); yer1= INIFile.GetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "yer1"); ad2= INIFile.GetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "ad2"); yer2= INIFile.GetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "yer2"); ad3= INIFile.GetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "ad3"); yer3= INIFile.GetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "yer3"); if ad1=="" and yer1=="" then INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "ad1", ad); INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "yer1", yer); elseif ad2=="" and yer2=="" then INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "ad2", ad); INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "yer2", yer); elseif ad3=="" and yer3=="" then INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "ad3", ad); INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "yer3", yer); elseif ad4=="" and yer4=="" then INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "ad4", ad); INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "yer4", yer); else Dialog.Message("Uyarı!", "Yer kalmadı!", MB_OK, MB_ICONSTOP, MB_DEFBUTTON3); end[/code][/spoiler][b] [/b] Edited January 28, 2012 by severalnasty Quote Link to comment Share on other sites More sharing options...
Kral__ Posted January 28, 2012 Share Posted January 28, 2012 if else ile yapılabilir mesela ad1 = ınput.gettext.... ad2.. ....... kontrol = "" if ad1 == kontrol then ne yazılacaksa elseif ad2 == kontrol then ne yazılacaksa .... gibi olabilir Quote Link to comment Share on other sites More sharing options...
NotToday Posted January 28, 2012 Share Posted January 28, 2012 160 taneye Kral__sen yaz arkadaşa kodu Bu arada bentatildeyim.Yani sizde bu iş Quote Link to comment Share on other sites More sharing options...
Kral__ Posted January 28, 2012 Share Posted January 28, 2012 işimiz var :S Quote Link to comment Share on other sites More sharing options...
Yusuf-Yildiz Posted January 28, 2012 Author Share Posted January 28, 2012 (edited) [b]Çözüldü. [color="#ff0000"]Kazım[/color] abiye çook teşekkürler...[/b] [b] [/b] [spoiler][code]ad = Input.GetText("Input1"); yer = Input.GetText("Input2"); veriler = INIFile.GetValueNames("AutoPlay\\Docs\\Kullanici.ini", "bilgiler"); if veriler ~= nil then sVeriSayisi= Table.Count(veriler); else sVeriSayisi=2; end kontrol=1; for i=1,sVeriSayisi+1 do veri_ad = INIFile.GetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "ad"..i); veri_yer = INIFile.GetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "yer..i"); if veri_ad == "" and veri_yer == "" then INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "ad"..i, ad); INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "yer"..i, yer); kontrol=0; break end end if kontrol == 1 then value_new =(sVeriSayisi+2)/2; INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "ad"..value_new, ad); INIFile.SetValue("AutoPlay\\Docs\\Kullanici.ini", "bilgiler", "yer"..value_new, yer); end Dialog.Message(kontrol, "Başarılı", MB_OK, MB_ICONINFORMATION);[/code][/spoiler] Edited January 28, 2012 by severalnasty Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.