Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Folder = "files"
- local function PrintDoc(file,Name)
- local Doc = fs.open(file,"r")
- local I
- printer.newPage()
- printer.setTitle(Name)
- repeat
- I = Doc.readLine()
- if I ~= nil then printer.writeLine(I) end
- until I == nil
- Doc.close()
- printer.endPage()
- end
- local function openFile(File)
- local Path = fs.combine("Folder",File)
- local Add = "Copy"
- fs.copy(Path,Add)
- shell.run("edit",Add)
- PrintDoc(Add,File)
- fs.delete(Add)
- os.reboot()
- end
- local function Menu()
- term.clear()
- term.setCursorPos(1,1)
- print("==Government Property==")
- print("Public Document Access Terminal")
- local n = 1
- while true do
- for i = 1, #fs.list(Folder) do
- term.setCursorPos(3, i + 3)
- term.clearLine()
- if n == i then term.write(">> "..fs.list(Folder)[i]) else term.write(fs.list(Folder)[i]) end
- end
- local a, b = os.pullEvent("key")
- if b == keys.w and n > 1 then n = n - 1 end
- if b == keys.s and n < #fs.list(Folder) then n = n + 1 end
- if b == keys.enter then break end
- end
- openFile(fs.list(Folder)[n])
- end
- Menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement