Add files via upload
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
--Very Basic Print API
|
||||||
|
local printer = peripheral.find("printer")
|
||||||
|
print("Basic PhileOS Print API")
|
||||||
|
print("V 1.0")
|
||||||
|
print("")
|
||||||
|
print("Save file to \"/print this\" to print.")
|
||||||
|
|
||||||
|
while true do
|
||||||
|
if fs.exists("print this") then
|
||||||
|
local fh = fs.open("print this", "r")
|
||||||
|
printer.newPage()
|
||||||
|
local x, y = printer.getPageSize()
|
||||||
|
local line = fh.readLine()
|
||||||
|
local linenum = 1
|
||||||
|
while line ~= nil and linenum <= y do
|
||||||
|
printer.setCursorPos(1, linenum)
|
||||||
|
printer.write(line)
|
||||||
|
linenum = linenum + 1
|
||||||
|
line = fh.readLine()
|
||||||
|
end
|
||||||
|
printer.endPage()
|
||||||
|
fh.close()
|
||||||
|
fs.delete("print this")
|
||||||
|
end
|
||||||
|
os.sleep()
|
||||||
|
end
|
||||||
Binary file not shown.
@@ -0,0 +1,29 @@
|
|||||||
|
--Print API Installer
|
||||||
|
|
||||||
|
local diskDir = shell.getRunningProgram():sub(1, -12)
|
||||||
|
if not PhileOS then
|
||||||
|
error("Only for PhileOS Computers")
|
||||||
|
end
|
||||||
|
|
||||||
|
fs.copy(diskDir.."Print.lua", "PhileOS/SysPrograms/Print.lua")
|
||||||
|
fs.copy(diskDir.."icon.phimg", "PhileOS/Icons/Programs/PhileOS/SysPrograms/Print.lua.phimg")
|
||||||
|
|
||||||
|
local user = PhileOS.getUsername()
|
||||||
|
local file = 0
|
||||||
|
if user == "" then
|
||||||
|
file = fs.open("/PhileOS/Settings/desktop.set", "r")
|
||||||
|
else
|
||||||
|
file = fs.open("/PhileOS/Users/"..user.."/desktop.set", "r")
|
||||||
|
end
|
||||||
|
local pins = textutils.unserialise(file.readAll())
|
||||||
|
file.close()
|
||||||
|
local name = "Print"
|
||||||
|
table.insert(pins[1], {name, "PhileOS/SysPrograms/Print.lua"})
|
||||||
|
local file = 0
|
||||||
|
if user == "" then
|
||||||
|
file = fs.open("/PhileOS/Settings/desktop.set", "w")
|
||||||
|
else
|
||||||
|
file = fs.open("/PhileOS/Users/"..user.."/desktop.set", "w")
|
||||||
|
end
|
||||||
|
file.write(textutils.serialise(pins))
|
||||||
|
file.close()
|
||||||
Reference in New Issue
Block a user