Easier Printer Printing Tool: Print words with a printer with ease!

Just tell it the side and the title, and it will give you a textarea to type. Don't worry about
linebreaks, it will insert them for you. Press enter after typing in what you want to print it.

The code: Pastebin

The code:

local args={...} -- get args
if args[1]==nil then
print('Dude! Use it like this: printer <side> <subject>') -- return if no args
else -- else for line 2

printer=peripheral.wrap(tostring(args[1])) -- wrap printer
paper=printer.getPaperLevel() -- get paper level
ink=printer.getInkLevel() -- get ink level

if paper>0 and ink>0 then
body=read() -- get the body
body=tostring(body) -- change it in to a string, if needed

if printer.newPage() then -- create a new page
printer.setPageTitle(tostring(args[2])) -- set the title
c=1
line=1
printer.setCursorPos(c,line)

for i=1,string.len(body) do
b=string.byte(body,i)
ch=string.char(B)/>/>
if c==25 then
c=1
line=line+1
printer.setCursorPos(c,line)
end -- ends line 23

printer.write(ch) -- write the stuff to the page
c=c+1
end -- ends line 20

if printer.endPage() then
print('Page Printed!')
else -- else for line 33
print('Error printing/ending page')
end -- ends line 33

else -- else for line 14
print('Error creating new page')
end -- end for line 13
else -- else for line 10
if ink==0 then
print('Dude! Add some ink.')
end -- ends line 43

if paper==0 then
print('Dude! Add some paper.')
end -- ends line 47

end -- ends line 10

end -- ends line 2

In-Game: pastebin get UQmUTpJ2 printer
NOTE: Must have HTTP-API enabled.

To me, it is not all-the-way 100% done. If you have suggestions or bugs, please tell me, I will be happy to hear!

Screenshots!