Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- id = os.getComputerID()
- if id == 1 then
- mon = peripheral.wrap("monitor_0")
- elseif id == 2 then
- mon = peripheral.wrap("monitor_1")
- end
- mon.setTextScale(0.5)
- shell.run("clear")
- print("IndustrieOS | Notizbuch")
- print("")
- print("Was möchten Sie tun?")
- print("schreiben|lesen|löschen")
- print("")
- print("")
- los = io.read()
- if los == "schreiben" then
- shell.run("clear")
- print("IndustrieOS | Notizbuch | Schreiben")
- elseif los == "lesen" then
- shell.run("clear")
- print("IndustrieOS | Notizbuch | Lesen")
- elseif los == "löschen" then
- shell.run("clear")
- print("IndustrieOS | Notizbuch | Löschen")
- elseif los == "Desktop" then
- shell.run("Desktop")
- else
- print("Eingabe ungültig!")
- sleep(2.0)
- shell.run("Notizbuch")
- return
- end
- print("Geben Sie einen Dateinamen an!")
- print("")
- if los == "lesen" then
- local list = fs.list("Notizen/")
- for i = 1,1000,1 do
- if list[i] == nil then
- break
- end
- print(list[i])
- end
- elseif los == "löschen" then
- local list = fs.list("Notizen/")
- for i = 1,1000,1 do
- if list[i] == nil then
- break
- end
- print(list[i])
- end
- end
- print("")
- local dn = read()
- if los == "schreiben" then
- fs.makeDir("Notizen")
- local ex = fs.exists("Notizen/"..dn)
- if ex == true then
- print("Die Datei existiert bereits!")
- sleep(3.0)
- shell.run("Notizbuch")
- return
- end
- local file = fs.open("Notizen/"..dn,"a")
- elseif los == "lesen" then
- file = fs.open("Notizen/"..dn,"r")
- local ex = fs.exists("Notizen/"..dn)
- if ex == false then
- print("Die Datei existiert nicht!")
- sleep(3.0)
- shell.run("Notizbuch")
- return
- end
- elseif los == "löschen" then
- local ex = fs.exists("Notizen/"..dn)
- if ex == false then
- print("Die Datei existiert nicht!")
- sleep(3.0)
- shell.run("Notizbuch")
- return
- end
- end
- cursor = 2
- function schreib()
- zeile = io.read()
- if zeile == "ENDE" then
- local file = fs.open("Notizen/"..dn,"a")
- file.close()
- print("Notiz erfolgreich gespeichert")
- sleep(3.0)
- shell.run("Desktop")
- stop = 3
- else
- local file = fs.open("Notizen/"..dn,"a")
- file.writeLine(zeile)
- mon.setCursorPos(1,cursor)
- mon.write(zeile)
- cursor = cursor+1
- end
- end
- function les()
- file = fs.open("Notizen/"..dn,"r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- for i = 1,1000,1 do
- if fileData[i] == nil then
- break
- end
- local wert = fileData[i]
- print(wert)
- mon.setCursorPos(1,cursor)
- mon.write(wert)
- cursor = cursor+1
- end
- end
- if los == "schreiben" then
- shell.run("clear")
- print("IndustrieOS | Notizbuch | Schreiben")
- print("Schreiben Sie und bestätigen Sie die Zeile mit ENTER")
- print("Geben Sie 'ENDE' ein um zu Speichern und zu Beenden")
- sleep(6.0)
- shell.run("clear")
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("IndustrieOS | Notizbuch | Schreiben")
- print("IndustrieOS | Notizbuch | Schreiben")
- stop = 1
- while stop<2 do
- schreib()
- end
- elseif los == "lesen" then
- shell.run("clear")
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("IndustrieOS | Notizbuch | Lesen")
- print("IndustrieOS | Notizbuch | Lesen")
- print("")
- les()
- end
- if los == "löschen" then
- fs.delete("Notizen/"..dn)
- print("Datei erfolgreich gelöscht!")
- sleep(3.0)
- shell.run("Desktop")
- end
Advertisement
Add Comment
Please, Sign In to add comment