fba44 Posted August 29, 2013 Share Posted August 29, 2013 Arkadaşlar printer pluginini biliyorsunuz yazdırmaya yarıyor. Ben bilgisayarda bulunan yazıcıları bir combobox yada listbox vs eklemek istiyorum bunu nasıl yapabilirim bu yada başka bir pluginde? Bu plugini baya kurcaladım ama bulamadım. Yardımcı olursanız sevinirim. Teşekkürler. Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted August 29, 2013 Editor Share Posted August 29, 2013 function Escape(v) if (v == nil) then return ""; end if (type(v) == "table") then return Table.Concat(v, ", "); end if (type(v) == "boolean") then if (v == true) then return "Yes"; else return "No"; end end return v; end local sOutput = ""; local oWMIService = luacom.GetObject("winmgmts:\\\\localhost\\root\\CIMV2"); local oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_Printer", "WQL", 48); if oColItems then local oEnum = luacom.GetEnumerator(oColItems); local oItem = oEnum:Next(); while oItem do ComboBox.AddItem("ComboBox1", Escape(oItem:Caption()), ""); oItem = oEnum:Next(); end else Dialog.Message("","Win32_Printer Kitaplığı bulunamadı"); end Quote Link to comment Share on other sites More sharing options...
fba44 Posted August 29, 2013 Author Share Posted August 29, 2013 function Escape(v) if (v == nil) then return ""; end if (type(v) == "table") then return Table.Concat(v, ", "); end if (type(v) == "boolean") then if (v == true) then return "Yes"; else return "No"; end end return v; end local sOutput = ""; local oWMIService = luacom.GetObject("winmgmts:\\\\localhost\\root\\CIMV2"); local oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_Printer", "WQL", 48); if oColItems then local oEnum = luacom.GetEnumerator(oColItems); local oItem = oEnum:Next(); while oItem do ComboBox.AddItem("ComboBox1", Escape(oItem:Caption()), ""); oItem = oEnum:Next(); end else Dialog.Message("","Win32_Printer Kitaplığı bulunamadı"); end way hocam on numarasınız ya bukadar çabuk yanıt geleceğini hiç beklemiyordum doğrusu. Bu konu ile alakalı ufak bi projem var takıldığım yerleri tekrar sorarım inş fazla sıkmam sizi. Ayrıca bir sorum olacak. Ben dün internette çok aradım ama böyle birşey bulamadım. Benim merak ettiğim şey siz nasıl buldunuz yada aklınızdan mı yazdınız bu sorumada cevap verirseniz bende bulma yönteminizi ve eksiğimi bi nebze olsun anlamış olacağım. Teşekkürler Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted August 30, 2013 Editor Share Posted August 30, 2013 Bir ara banada lazım olmuştu o yüzden ,tabi zamanında ben regeditten çekmiştim. Lazım olan çoğu bilgiyi windows kütüphanlerinden çekebilirsiniz. Quote Link to comment Share on other sites More sharing options...
fba44 Posted August 30, 2013 Author Share Posted August 30, 2013 Bir ara banada lazım olmuştu o yüzden ,tabi zamanında ben regeditten çekmiştim. Lazım olan çoğu bilgiyi windows kütüphanlerinden çekebilirsiniz. Evet hocam regeditte olabilirdi doğru bu aklıma gelmedi hiç. Peki hocam şimdi regettende baktım da bulamadım. Hani yazıcıların durum göstergesi var hazır, çevrimdışı,beklemede,duraklatıldı gibi. Bu yazıcıların durumlarınıda çekmek istiyorum onu nasıl yapabiliriz. Ayrıca yazıcıları verdiğiniz kodla çekerken default printer comboboxta seçili olarak gelmesini istiyorum. Bunun içinde printer plugini ile denedim ama malesef olmadı o sadece gösterdiğimizi default yapıyo hangisi default yani get diye bir komutu yok. Sizin kodlarla nasıl yapabilirim bununla da alakalı bilgi verirseniz yeterli hocam heralde daha da başınızı ağrıtmam :D default printer ile şöyle birşey buldum ama beceremedim _GetDefaultPrinter; Check to see which printer is the default. ConsoleWrite(_GetDefaultPrinter() & @CRLF) ; Get the default printer.Func _GetDefaultPrinter()Local $sResult = 'None', $oWMIService = ObjGet('winmgmts:\\' & '.' & '\root\cimv2')Local $oColItems = $oWMIService.ExecQuery('Select * From Win32_Printer Where Default = True')If IsObj($oColItems) ThenFor $oObjectItem In $oColItems$sResult = $oObjectItem.DeviceIDNextEndIfReturn $sResultEndFunc ;==>_GetDefaultPrinter Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted August 30, 2013 Editor Share Posted August 30, 2013 Verdiğin kodlar autoit ye ait autoit bilmiyorum.Autoit bölümüne sorarsan yardımcı olacaklardır. Quote Link to comment Share on other sites More sharing options...
fba44 Posted August 30, 2013 Author Share Posted August 30, 2013 Verdiğin kodlar autoit ye ait autoit bilmiyorum.Autoit bölümüne sorarsan yardımcı olacaklardır. Kodu zaten internette öyle ararken buldum ne dilde olduğunu bilmiyordum. Peki bu sorduğum soruları nasıl yapabiliriz bununla ilgili bir fikrin varmı hocam Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted August 30, 2013 Editor Share Posted August 30, 2013 (edited) function Escape(v) if (v == nil) then return ""; end if (type(v) == "table") then return Table.Concat(v, ", "); end if (type(v) == "boolean") then if (v == true) then return "Yes"; else return "No"; end end return v; end local sOutput = ""; local oWMIService = luacom.GetObject("winmgmts:\\\\localhost\\root\\CIMV2"); local oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_Printer", "WQL", 48); if oColItems then local oEnum = luacom.GetEnumerator(oColItems); local oItem = oEnum:Next(); while oItem do ComboBox.AddItem("ComboBox1",Escape(oItem:Caption()) .. " | Status : "..Escape(oItem:WorkOffline()), ""); if Escape(oItem:Default()) == "Yes" then ComboBox.SetSelected("ComboBox1",ComboBox.GetCount("ComboBox1")); end sOutput = ""; oItem = oEnum:Next(); end else Dialog.Message("", "Win32_Printer Kütüphanesi bulunamadı."); end Yazıcıları listeler Durumlarını Yanında Yazar Default olanıda seçer. Edited August 30, 2013 by pairs Quote Link to comment Share on other sites More sharing options...
fba44 Posted August 30, 2013 Author Share Posted August 30, 2013 function Escape(v) if (v == nil) then return ""; end if (type(v) == "table") then return Table.Concat(v, ", "); end if (type(v) == "boolean") then if (v == true) then return "Yes"; else return "No"; end end return v; end local sOutput = ""; local oWMIService = luacom.GetObject("winmgmts:\\\\localhost\\root\\CIMV2"); local oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_Printer", "WQL", 48); if oColItems then local oEnum = luacom.GetEnumerator(oColItems); local oItem = oEnum:Next(); while oItem do ComboBox.AddItem("ComboBox1",Escape(oItem:Caption()) .. " | Status : "..Escape(oItem:WorkOffline()), ""); if Escape(oItem:Default()) == "Yes" then ComboBox.SetSelected("ComboBox1",ComboBox.GetCount("ComboBox1")); end sOutput = ""; oItem = oEnum:Next(); end else Dialog.Message("", "Win32_Printer Kütüphanesi bulunamadı."); end Yazıcıları listeler Durumlarını Yanında Yazar Default olanıda seçer. hocam teşekkür ederim eve gidince hemen deneyeceğim. Bunu TreeList yada Listbox şeklinede dönüştürebilirim yine sorularım olacak hocam tekrar teşekkür ederim. Bu arada nasıl yaptınız bu kodları nasıl öğrenebilirim Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted August 30, 2013 Editor Share Posted August 30, 2013 ams eğitimlerini izlemen lazım yani ams nin kodlamasını bilmeden yapamazsınız. Quote Link to comment Share on other sites More sharing options...
fba44 Posted August 30, 2013 Author Share Posted August 30, 2013 hocam AMS kodlamasını biraz biliyorum zaten ufak tefek projelerde yaptım benim burda anlamadığım yerler unction Escape(v) if (v == nil) then return ""; end if (type(v) == "table") then return Table.Concat(v, ", "); end if (type(v) == "boolean") then if (v == true) then return "Yes"; else return "No"; end end return v; end local sOutput = ""; local oWMIService = luacom.GetObject("winmgmts:\\\\localhost\\root\\CIMV2"); local oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_Printer", "WQL", 48); burası yani ne bileyim baya farklı duruyor. Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted August 30, 2013 Editor Share Posted August 30, 2013 Orası ams nin içinde yok tabi üstteki kısım bi fonksiyon fonksiyonunu içindede if kullanılmış gelensonuca göre return ile geriye değer gönderiliyor. Alttaki kısımda ise luacom pluginini bilmen laızm onun içinde lua.org du bildiğim kadarı ile oradan dökümanlarını okuyarak ögrene bilirsiniz. Quote Link to comment Share on other sites More sharing options...
fba44 Posted August 30, 2013 Author Share Posted August 30, 2013 Hocam neyse kafayı şimdilik oraya takmayayım zamanla çözeriz inş. Madem durum ve default olayınıda çözdük ozaman ben combobox değil tree kullanıcam. Eve gittiğimde böyle yapıp sonucu bildiririm hocam ben gece uğraşıcam o yüzden artık yarın görüşmek üzere. Herşey için tşkler. Quote Link to comment Share on other sites More sharing options...
fba44 Posted August 31, 2013 Author Share Posted August 31, 2013 pairs hocam denedim çok güzel çalışıyor ellerine sağlık. Çok az kaldı bi soru daha ondan sonra sadece bi kısımda daha yadım isticem yani şimdilik öyle görünüyor hocam. Neyse daha fazla kafa şişirmeden soruma geleyim ComboBox.AddItem("ComboBox1",Escape(oItem:Caption()) .. " | Status : "..Escape(oItem:WorkOffline()), ""); Burdaki kod yazıcının offline olup olmadığını sorguluyor ya ben peki listedeki yazıcının butona tıkladığımda offline yapacak başka bir butona bastığımda offline ı kaldıracak. Siz sadece kodları söyleyin hocam yazıcı seçtirme vs kısmını ben ayarlıcam zaten. Hocam sayenizde proje düşündüğümden daha işlevsel olacak nekadar tşk etsem azdır. Bunu da bi halledelim sonra bir kısım daha var onu hallederiz. Teşekkürler ... Quote Link to comment Share on other sites More sharing options...
fba44 Posted September 1, 2013 Author Share Posted September 1, 2013 pairs hocam bu sorumla alakalı bir kod bulamadıysanız eğer diğer sorumu sorayım mı ?? Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted September 1, 2013 Editor Share Posted September 1, 2013 pairs hocam bu sorumla alakalı bir kod bulamadıysanız eğer diğer sorumu sorayım mı ?? O sorun la alakalı ams üzerinden herhangi bir müdahale olacagını sanmıyorum en azndan ben bilmiyorum. Ama regedit kayıtları ile yapılabilir diye düşünüyorum. Quote Link to comment Share on other sites More sharing options...
fba44 Posted September 1, 2013 Author Share Posted September 1, 2013 (edited) O sorun la alakalı ams üzerinden herhangi bir müdahale olacagını sanmıyorum en azndan ben bilmiyorum. Ama regedit kayıtları ile yapılabilir diye düşünüyorum. Evet Regedit olabilir Peki ozaman hocam aynı şekilde çevrim dışını bulduğunuz gibi yazdırma duraklatıldı yeri varya onuda get yapabilirmiyiz ?? Edit: ComboBox.AddItem("ComboBox1",Escape(oItem:Caption()) .. " | Status : "..Escape(oItem:WorkOffline()), ""); Burdaki kod gibi Edited September 1, 2013 by fba44 Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted September 2, 2013 Editor Share Posted September 2, 2013 (edited) function Escape(v) if (v == nil) then return ""; end if (type(v) == "table") then return Table.Concat(v, ", "); end if (type(v) == "boolean") then if (v == true) then return "Yes"; else return "No"; end end return v; end function WMIDateStringToDate(dtmDate) if dtmDate then dtmDate = tostring(dtmDate); return (String.Mid (dtmDate, 7, 2) .. "/" .. String.Mid (dtmDate, 5, 2) .. "/" .. String.Left(dtmDate, 4) .. " " .. String.Mid (dtmDate, 9, 2) .. ":" .. String.Mid (dtmDate, 11, 2) .. ":" .. String.Mid (dtmDate, 13, 2) ); else return ""; end end local sOutput = ""; local oWMIService = luacom.GetObject("winmgmts:\\\\localhost\\root\\CIMV2"); local oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_Printer", "WQL", 48); if oColItems then local oEnum = luacom.GetEnumerator(oColItems); local oItem = oEnum:Next(); while oItem do ComboBox.AddItem("ComboBox1",Escape(oItem:Caption()) .. " | Status : "..Escape(oItem:WorkOffline()), ""); if Escape(oItem:Default()) == "Yes" then ComboBox.SetSelected("ComboBox1",ComboBox.GetCount("ComboBox1")); end sOutput = ""; oItem = oEnum:Next(); end else Dialog.Message("", "Win32_Printer Kütüphanesi bulunamadı."); end local oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_PrintJob", "WQL", 48); if oColItems then local oEnum = luacom.GetEnumerator(oColItems); local oItem = oEnum:Next(); while oItem do Name = String.TrimRight(Escape(oItem:Caption()), " ,6"); sayi = ComboBox.GetCount("ComboBox1"); for i = 0,sayi do if (Name == String.Mid(ComboBox.GetItemText("ComboBox1", i), 1, String.Length(Name))) then ComboBox.SetItemText("ComboBox1", i,ComboBox.GetItemText("ComboBox1", i) .." | ".. Escape(oItem:JobStatus())); end end oItem = oEnum:Next(); end else Dialog.Message("", "Win32_PrintJob Kütüphanesi bulunamadı."); end Edited September 2, 2013 by pairs Quote Link to comment Share on other sites More sharing options...
fba44 Posted September 2, 2013 Author Share Posted September 2, 2013 function Escape(v) if (v == nil) then return ""; end if (type(v) == "table") then return Table.Concat(v, ", "); end if (type(v) == "boolean") then if (v == true) then return "Yes"; else return "No"; end end return v; end function WMIDateStringToDate(dtmDate) if dtmDate then dtmDate = tostring(dtmDate); return (String.Mid (dtmDate, 7, 2) .. "/" .. String.Mid (dtmDate, 5, 2) .. "/" .. String.Left(dtmDate, 4) .. " " .. String.Mid (dtmDate, 9, 2) .. ":" .. String.Mid (dtmDate, 11, 2) .. ":" .. String.Mid (dtmDate, 13, 2) ); else return ""; end end local sOutput = ""; local oWMIService = luacom.GetObject("winmgmts:\\\\localhost\\root\\CIMV2"); local oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_Printer", "WQL", 48); if oColItems then local oEnum = luacom.GetEnumerator(oColItems); local oItem = oEnum:Next(); while oItem do ComboBox.AddItem("ComboBox1",Escape(oItem:Caption()) .. " | Status : "..Escape(oItem:WorkOffline()), ""); if Escape(oItem:Default()) == "Yes" then ComboBox.SetSelected("ComboBox1",ComboBox.GetCount("ComboBox1")); end sOutput = ""; oItem = oEnum:Next(); end else Dialog.Message("", "Win32_Printer Kütüphanesi bulunamadı."); end local oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_PrintJob", "WQL", 48); if oColItems then local oEnum = luacom.GetEnumerator(oColItems); local oItem = oEnum:Next(); while oItem do Name = String.TrimRight(Escape(oItem:Caption()), " ,6"); sayi = ComboBox.GetCount("ComboBox1"); for i = 0,sayi do if (Name == String.Mid(ComboBox.GetItemText("ComboBox1", i), 1, String.Length(Name))) then ComboBox.SetItemText("ComboBox1", i,ComboBox.GetItemText("ComboBox1", i) .." | ".. Escape(oItem:JobStatus())); end end oItem = oEnum:Next(); end else Dialog.Message("", "Win32_PrintJob Kütüphanesi bulunamadı."); end Hocam tşk ederim. Şuan iş yerindeyim AMS olmadığı için deneyemiyorum. Bu eklenen kodlar sanırım duraklatıldı ibaresi için değilmi hocam. Ben duraklatmayı aktif ve pasif etmeyi regetitten buldum ama regedit kaydını değiştirince bilgisayarı yeniden başlatmadan değişiklikler aktif olmuyor bu yüzden bu şekilde kodlarla olması daha iyi olacak. Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted September 2, 2013 Editor Share Posted September 2, 2013 (edited) Verdiğim kodlar sadece bir yazı gönderipte sonra gönderdiğiniz yazıyı duraklatırsınız ya.Onu gösterir yani hangi yazıcıda duraklatılmış çıktı var. Yazıcıyı çevrim dışı felan etmek değil yani. Edited September 2, 2013 by pairs Quote Link to comment Share on other sites More sharing options...
fba44 Posted September 2, 2013 Author Share Posted September 2, 2013 (edited) function WMIDateStringToDate(dtmDate) if dtmDate then dtmDate = tostring(dtmDate); return (String.Mid (dtmDate, 7, 2) .. "/" .. String.Mid (dtmDate, 5, 2) .. "/" .. String.Left(dtmDate, 4) .. " " .. String.Mid (dtmDate, 9, 2) .. ":" .. String.Mid (dtmDate, 11, 2) .. ":" .. String.Mid (dtmDate, 13, 2) ); else return ""; end end bu tarih ile alakalı kod ne işe yarıyor hocam ve ayrıca local oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_PrintJob", "WQL", 48); bu tür kodları nasıl bulabilirim? Edit: Hocam şuan AMS kurup kodları denedim siz denediniz mi son eklediğiniz kodlar çalışmıyor yani benim yukarıya yazıp sorduğum kod çalışmıyor sanırım. çünkü if ten sonrası devamı gelmiyor dialog açtım oda gelmiyor ocal oColItems = oWMIService:ExecQuery("SELECT * FROM Win32_PrintJob", "WQL", 48); if oColItems then local oEnum = luacom.GetEnumerator(oColItems); local oItem = oEnum:Next(); while oItem do Name = String.TrimRight(Escape(oItem:Caption()), " ,6"); sayi = ComboBox.GetCount("ComboBox1"); for i = 0,sayi do if (Name == String.Mid(ComboBox.GetItemText("ComboBox1", i), 1, String.Length(Name))) then ComboBox.SetItemText("ComboBox1", i,ComboBox.GetItemText("ComboBox1", i) .." | ".. Escape(oItem:JobStatus())); Dialog.Message("", "", MB_OK) end end oItem = oEnum:Next(); end else Dialog.Message("", "Win32_PrintJob Kütüphanesi bulunamadı."); end böyle yaptım dialog bile açılmadı. Not: yazı duraklatma yaptım Edited September 2, 2013 by fba44 Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted September 2, 2013 Editor Share Posted September 2, 2013 lua.org sitesindenki gökümanları incelemen lazım. Yani o pluginle yapılıyor bunlar. Quote Link to comment Share on other sites More sharing options...
fba44 Posted September 2, 2013 Author Share Posted September 2, 2013 lua.org sitesindenki gökümanları incelemen lazım. Yani o pluginle yapılıyor bunlar. Hocam o dökümanlara biraz baktımda pek birşey bulamadım yani. Neyse hocam yukardaki postu güncelledim bi bakarmısınız Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted September 2, 2013 Editor Share Posted September 2, 2013 Kod Çalışıyor . http://prntscr.com/1ovw08 Quote Link to comment Share on other sites More sharing options...
fba44 Posted September 2, 2013 Author Share Posted September 2, 2013 hocam anladım yazı duraklatıldı olunca oluyor aslında yazıcının duraklatıldığı zaman olsa daha iyi olurdu. Yani JobStatus Değilde printerstatus gibi bişi yani. Daha açılça bende prntscrn koyuyorum http://prntscr.com/1ow2ur Yazıcı menusunun içinde check ticklenmiş olanlar varya ben onlarla ilgileniyorum. Varsyılan kısmı oldu. Hem get yapabiliyorum hemde set ÇevrimDışı kısmını Sadece sizin kodlarda Get Yapabiliyoruz SET halen yapamadım , Duraklatıldı kısmı ise GET yapamıyorum ama SET yapıyorum regeditten oda yeniden başlatmak gerekiyor o yüzden olmuyor. Bu konulara biraz çözüm bulabilirsek iyi olur hocam. 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.