Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Lua printer question, lua, how does it work?< Next Oldest | Next Newest >
Uta Offline





Group: Members
Posts: 13
Joined: June 2006
Posted: Mar. 26 2008,20:38 QUOTE

I have installed DSL 4.2.5 on my HD, I have wifi working, sound working and printing working. My question concerns "Lua". I placed it's icon on my desktop (it's linked to /usr/local/bin/printing.lua) when I drop a text file on it nothing happens. As I said before printing is working from app menus (Ted,Firefox, etc...). My printer is a network printer that was configured via Apsfilter (gimp 4.x) and works great.
Any ideas? Thanks!
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Mar. 26 2008,21:07 QUOTE

Likely that I used the Apsfilter default printer name of "lp" and yours is not.

/usr/local/bin/printing.lua is a script that I use everyday. If you can print from the command line then you can drag-n-drop text or postscript files to print. I always print to file from each application. Then when I am ready to actually print, I drag the .txt or .ps onto the printing desktop icon.

I suggest to look at the script and look at the second to last line.
Code Sample

#!/bin/lua
-- (c) 2007 Robert Shingledecker
-- Lua script to support printing via dfm printing icon.

function checkPrintcap()
  printcap,err = io.popen("ls -s /opt/printcap|awk '{print $1}'")
  printcapSize = printcap:read("*l")
  printcap:close()
  return printcapSize
end

if checkPrintcap() == "0" then
  response = fltk.fl_choice("No printer found!\nSetup Printer Now?","No","Yes",NULL)
  if response == 1 then
     os.execute('aterm -T "apsfilter" -e sudo /usr/share/apsfilter/SETUP')
     if checkPrintcap() == "0" then
        os.exit(1)
     else
        os.execute('touch /tmp/printer.flag')
     end
  else
     os.exit(1)
  end
end

lprTest = io.popen("ps | grep lpd | grep -v 'grep lpd'")
lprCheck = lprTest:read("*l")
lprTest:close()
if lprCheck == nil then
  print("Starting lpd...")
  os.execute("sudo /usr/sbin/lpd")
end
if #arg == 1 then
  os.execute("lpr -h -Plp "..arg[1])
end


Change the os.execute to your specific needs.
Back to top
Profile PM WEB 
Uta Offline





Group: Members
Posts: 13
Joined: June 2006
Posted: Mar. 26 2008,22:08 QUOTE

Thanks for your quick reply.
I edited in my printer's name and it works great.
Thank You!
Back to top
Profile PM 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: Mar. 27 2008,00:00 QUOTE

I wonder if checking for the PRINTER env var would be useful? (and use something like os.getenv I suppose)
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Mar. 27 2008,00:36 QUOTE

Is it only the printer name that differs for a:

1. Unix network printer?
2. A USB printer?
3. A samba printer?

I write script using mainly defaults (parallell and lp) especially when I do not own or cannot setup all supported situations.

Perhaps those who use apsfilter in each supported protocol/printer style can post or verify that only a printer name is variable. It is of course then easy to implement an environment variable. However by default setup of apsfilter no such environment variable is created.
Back to top
Profile PM WEB 
4 replies since Mar. 26 2008,20:38 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: Lua printer question

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code