Jump to content

Printer Plugini Hakkında


fba44
 Share

Recommended Posts

  • Replies 56
  • Created
  • Last Reply

Top Posters In This Topic

hocam şöyle söyleyim yazdırılan belgenin üzerine tıklayıp duraklat demek ile yazıcı özelliklerinde eklediğim resimde görülüyor

yazıcı menusu altındaki yazdımayı duraklat işlevsel olarak aynı şey ama biri komple yazıcıyı duraklatıyor biri sadece o belgeyi duraklatıyor. Ben menunun altındaki yazdırmayı duraklattan bahsediyorum ve o seçenek seçili iken sizde bi deneyin program yadırma duraklatıldı uyarısı vermiyor. Sadece belge duraklatıldığı zaman veriyor ekran alıntımdada görülüyor

Link to comment
Share on other sites

  • Editor
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
    	 state = "Çalışıyor";
		 if (tostring(Escape(oItem:PrinterState())) == "1") then
		 	state = "Duraklatılmış";
		 end
        ComboBox.AddItem("ComboBox1",Escape(oItem:Caption()) .. " | Status : "..Escape(oItem:WorkOffline()).."| Durum : "..state, "");
		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
Link to comment
Share on other sites

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
    	 state = "Çalışıyor";
		 if (tostring(Escape(oItem:PrinterState())) == "1") then
		 	state = "Duraklatılmış";
		 end
        ComboBox.AddItem("ComboBox1",Escape(oItem:Caption()) .. " | Status : "..Escape(oItem:WorkOffline()).."| Durum : "..state, "");
		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

 

Sağol hocam bu oldu ellerine sağlık. Peki bu duraklatılmışı devam et olarak SET yapabilirmiyiz hocam "duraklat-devam et" şeklinde yine aynı kod şekliyle. Çünkü regeditten yapınca pc restart yapmak gerekiyor

Link to comment
Share on other sites

verdiğimiz capslerde olan ekran hocam hani yazıcıya sağ tıklayınca geliyorya yazdırılan öğeyi göster diye

ben yinede capste belirteyim

 

1. kırmızıyı aldğım pencere bu söylediğim pencere

ve 2. kırmızıyı aldığım yerde kaçtane yazdırma belgesi olduğunu söylüyor. Bunuda GET yapabilirmiyiz hocam

 

http://prntscr.com/1p3041

Link to comment
Share on other sites

  • Editor

Yazıcıları listelerken kullandıgın kodu bununla değiştir.

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
    	 state = "Çalışıyor";
		 if (tostring(Escape(oItem:PrinterState())) == "1") then
		 	state = "Duraklatılmış";
		 end
        ComboBox.AddItem("ComboBox1", Escape(oItem:Caption()) .. " | Status : "..Escape(oItem:WorkOffline()).."| Durum : "..state, Escape(oItem:Caption()));
		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

Daha sonrada son gösterdiğin ekranı açmak için bu kodu nereye istersen orada kullan.

selected = ComboBox.GetSelected("ComboBox1");
secilen = ComboBox.GetItemData("ComboBox1",selected);
result = File.Run("cmd.exe", "/C RUNDLL32 PRINTUI.DLL,PrintUIEntry /o /n \""..secilen.."\"",_WindowsFolder.."\\System32", SW_HIDE, false);

Link to comment
Share on other sites

 

Yazıcıları listelerken kullandıgın kodu bununla değiştir.

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
    	 state = "Çalışıyor";
		 if (tostring(Escape(oItem:PrinterState())) == "1") then
		 	state = "Duraklatılmış";
		 end
        ComboBox.AddItem("ComboBox1", Escape(oItem:Caption()) .. " | Status : "..Escape(oItem:WorkOffline()).."| Durum : "..state, Escape(oItem:Caption()));
		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

Daha sonrada son gösterdiğin ekranı açmak için bu kodu nereye istersen orada kullan.

selected = ComboBox.GetSelected("ComboBox1");
secilen = ComboBox.GetItemData("ComboBox1",selected);
result = File.Run("cmd.exe", "/C RUNDLL32 PRINTUI.DLL,PrintUIEntry /o /n \""..secilen.."\"",_WindowsFolder.."\\System32", SW_HIDE, false);

 

 

Hocam TŞK ederim güzel çalıştı. Peki kaç yazı beklediği hakkında bilgi verebilecekmiyiz resimde 2. olarak gösterdiğim yer gibi.

 

Ayrıca bunu CMD ile yapmanda beni şaşırttı. Perfect.....

Link to comment
Share on other sites

  • 2 hafta sonra ...
  • 3 hafta sonra ...
  • Editor

Ya işlerin yogunlugundan kendime bile vakit ayıramıyorum.O winspool dll ini kullanabilmek için pointer tanımlamak gerekiyor yani boş bi vaktimde bakıcam inş.

 

 

Edit : Yarın iş yogun olmazsa plugine ekleyeceğim kapatıp açmayı.

Edited by pairs
Link to comment
Share on other sites

hocam pluginle yapmadım benim programı sizin diğer verdiğiniz kodlarla yaptım şimdi plugin kullanırsam sil baştan yapmam gerekecek o yüzden bana o kodları verme imkanınız varmı ayrıca kuyrukta kaç belge olduğunuda çekebilirmiyiz şuan için en önemlisi o

Link to comment
Share on other sites

hm çok güzel hocam kolay gelsin

duraklat-devam et

çevrimiçi yap - çevrimdışı yap

kuyrukta x adet belge var - tüm belgeleri sil

eksiklikler bunlar hocam özelliklede dediğim gibi kuyrukta(sırada) kaç belge olduğunu göstermek şuan için en önemlisi

Link to comment
Share on other sites

  • Editor

Bu Dll i indir.

https://www.dropbox.com/s/vj1eau0qycu6b6n/PrinterSettings.dll

 

Kullanım Şekli.

result = DLL.CallFunction("AutoPlay\\Docs\\PrinterSettings.dll", "PausePrinter", "\"Kyocera\"", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
result = DLL.CallFunction("AutoPlay\\Docs\\PrinterSettings.dll", "ResumePrinter", "\"Kyocera\"", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
result = DLL.CallFunction("AutoPlay\\Docs\\PrinterSettings.dll", "DisablePrinter", "\"Kyocera\"", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
result = DLL.CallFunction("AutoPlay\\Docs\\PrinterSettings.dll", "EnablePrinter", "\"Kyocera\"", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);

Printerlardaki kuyrukta bekleyen yazı sayısı içinde bakıcam tekrar anca bunlara bakabildim.Dllde bir hata olacagını sanmıyorum olursada haber edersin bakarım kodlarına.

Edited by pairs
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...