Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getOSVersion()
- readosversion = http.get("https://pastebin.com/raw/PaMrgmxM")
- osversion = readosversion.readLine()
- forceupdate = readosversion.readLine()
- if forceupdate == "true" then
- end
- end
- function appError(String)
- errormessage = window.create(term.current(),15,7,25,6)
- errormessage.setBackgroundColor(colors.white)
- errormessage.clear()
- errormessage.setCursorPos(1,1)
- errormessage.setBackgroundColor(colors.red)
- errormessage.write(" Error ")
- errormessage.setTextColor(colors.black)
- errormessage.setCursorPos(2,2)
- errormessage.setBackgroundColor(colors.white)
- errormessage.write("A error has occurred!")
- errormessage.setCursorPos(2,3)
- errormessage.write("Please check the log to")
- errormessage.setCursorPos(2,4)
- errormessage.write("find out more info.")
- errormessage.setCursorPos(10,5)
- errormessage.setBackgroundColor(colors.lightGray)
- errormessage.setTextColor(colors.white)
- errormessage.write(" Ok ")
- log("ERROR ==> "..String)
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if x >= 24 and x <= 27 and y == 11 then
- shell.run('OS/desktop.lua')
- break
- end
- end
- end
- ------------------------------------------
- function s(...) return sleep(...) end
- function w(...) return write(...) end
- function p(...) return print(...) end
- function tw(...) return term.write(...) end
- function scp(...) return term.setCursorPos(...) end
- function sbc(...) return term.setBackgroundColor(...) end
- function stc(...) return term.setTextColor(...) end
- function tc(...) return term.clear(...) end
- function tcl(...) return term.clearLine() end
- function scb(...) return term.setCursorBlink(...) end
- function ts(...) return term.scroll(...) end
- function r(...) return shell.run(...) end
- function para(...) return parallel.waitForAny(...) end
- function sw(...) return textutils.slowWrite(...) end
- function sp(...) return textutils.slowPrint(...) end
- -- OS VERSION
- getOSVersion()
- --------------
- -- Define the windows properties ----
- desktopproperties = {1,2,51,18,colors.white}
- taskbarproperties = {1,1,51,1,colors.lightGray}
- userinfoproperties = {3,15,20,4,colors.cyan}
- shell.run("OS/desktopconfig.lua")
- -- Create the windows ---------------
- desktop = window.create(term.current(), desktopproperties[1],desktopproperties[2],desktopproperties[3],desktopproperties[4])
- userinfo = window.create(term.current(), userinfoproperties[1],userinfoproperties[2],userinfoproperties[3],userinfoproperties[4])
- taskbar = window.create(term.current(), taskbarproperties[1],taskbarproperties[2],taskbarproperties[3],taskbarproperties[4])
- taskbar.setBackgroundColor(taskbarproperties[5])
- taskbar.clear()
- taskbar.setCursorPos(taskbarproperties[1],taskbarproperties[1])
- taskbar.write("Start Menu")
- desktop.setBackgroundColor(colors.white)
- desktop.clear()
- userinfo.setBackgroundColor(userinfoproperties[5])
- userinfo.clear()
- -------------------------------------
- desktop.setBackgroundColor(colors.white)
- path1 = iconproperties[1][2]
- path2 = iconproperties[2][2]
- path3 = iconproperties[3][2]
- path4 = iconproperties[4][2]
- path5 = iconproperties[5][2]
- icon1 = {path1,name1,2,13}
- icon2 = {path2,name2,17,27}
- icon3 = {path3,name3,30,41}
- icon4 = {path4,name4,2,13}
- icon5 = {path5,name5,17,27}
- -- Page Arrows
- desktop.setCursorPos(25,15)
- desktop.setBackgroundColor(colors.lightGray)
- desktop.write(" < ")
- desktop.setCursorPos(30,15)
- desktop.write(" > ")
- --- User info box
- checkCurrentUserId()
- if admin1 == "true" and userid == 1 then
- admin = "true"
- elseif admin2 == "true" and userid == 2 then
- admin = "true"
- elseif admin3 == "true" and userid == 3 then
- admin = "true"
- elseif admin4 == "true" and userid == 4 then
- admin = "true"
- end
- userinfo.setCursorPos(2,2)
- userinfo.write("User: "..CurrentUser)
- userinfo.setCursorPos(2,3)
- if admin == "true" then
- userinfo.write("Admin Privliages")
- end
- desktop.setBackgroundColor(colors.white)
- iconimage1 = paintutils.loadImage(icon1[1])
- iconimage2 = paintutils.loadImage(icon2[1])
- iconimage3 = paintutils.loadImage(icon3[1])
- iconimage4 = paintutils.loadImage(icon4[1])
- iconimage5 = paintutils.loadImage(icon5[1])
- paintutils.drawImage(iconimage1, 2, 3 )
- paintutils.drawImage(iconimage2,16, 3 )
- paintutils.drawImage(iconimage3,30, 3 )
- desktop.setCursorPos(4,12)
- desktop.setTextColor(colors.black)
- desktop.write(iconproperties[1][1])
- desktop.setCursorPos(18,12)
- desktop.write(iconproperties[2][1])
- desktop.setCursorPos(32,12)
- desktop.write(iconproperties[3][1])
- page = 1
- while true do
- if page == 2 then
- desktop.setCursorPos(2,12)
- desktop.setTextColor(colors.black)
- desktop.write(iconproperties[4][1])
- desktop.setTextColor(colors.black)
- desktop.setCursorPos(18,12)
- desktop.write(iconproperties[5][1])
- end
- event, button, x, y = os.pullEvent("mouse_click")
- ----------- DETECT ICON 1 ----------------
- if button == 1 and x >= icon1[3] and x <= icon1[4] and y >= 3 and y <= 10 then
- if iconproperties[1][1] == "Log Viewer" and page == iconproperties[1][3] then
- logviewer()
- elseif iconproperties[4][1] == "Log Viewer" and page == iconproperties[4][3] then
- logviewer()
- elseif iconproperties[1][1] == "Terminal" and page == iconproperties[1][3] then
- terminal()
- elseif iconproperties[4][1] == "Terminal" and page == iconproperties[4][3] then
- terminal()
- elseif iconproperties[1][1] == "Settings" and page == iconproperties[1][3] then
- settingsapp()
- elseif iconproperties[4][1] == "Settings" and page == iconproperties[4][3] then
- settingsapp()
- elseif iconproperties[1][1] == "Admin Control" and page == iconproperties[1][3] then
- adminControl()
- elseif iconproperties[4][1] == "Admin Control" and page == iconproperties[4][3] then
- adminControl()
- elseif iconproperties[4][1] == "Ink" and page == iconproperties[5][3] then
- ink()
- elseif iconproperties[4][1] == "Ink" and page == iconproperties[5][3] then
- ink()
- end
- appError("App exited unexpectedly, near LN 209 in desktop.lua")
- ----------- DETECT ICON 2 ----------------
- elseif button == 1 and x >= icon2[3] and x <= icon2[4] and y >= 3 and y <= 10 then
- if iconproperties[2][1] == "Log Viewer" and page == iconproperties[2][3] then
- logviewer()
- elseif iconproperties[2][1] == "Terminal" and page == iconproperties[2][3] then
- terminal()
- elseif iconproperties[2][1] == "Settings" and page == iconproperties[2][3] then
- settingsapp()
- elseif iconproperties[2][1] == "Admin Control" and page == iconproperties[2][3] then
- adminControl()
- elseif iconproperties[2][1] == "Admin Control" and page == iconproperties[2][3] then
- adminControl()
- elseif iconproperties[2][1] == "Ink" and page == iconproperties[2][3] then
- ink()
- elseif iconproperties[5][1] == "Ink" and page == iconproperties[5][3] then
- ink()
- end
- appError("App exited unexpectedly, near LN 130 in desktop.lua")
- ----------- DETECT ICON 3 ----------------
- elseif button == 1 and x >= icon3[3] and x <= icon3[4] and y >= 3 and y <= 10 then
- if iconproperties[3][1] == "Log Viewer" and page == iconproperties[3][3] then
- logviewer()
- elseif iconproperties[3][1] == "Terminal" and page == iconproperties[3][3] then
- terminal()
- elseif iconproperties[3][1] == "Settings" and page == iconproperties[3][3] then
- settingsapp()
- elseif iconproperties[4][1] == "Admin Control" and page == iconproperties[3][3] then
- adminControl()
- end
- appError("App exited unexpectedly, near LN 130 in desktop.lua")
- elseif button == 1 and x >= 25 and x <= 28 and y == 16 then
- shell.run('os/desktop.lua')
- elseif button == 1 and x >= 30 and x <= 33 and y == 16 then
- page = 2
- desktop.setBackgroundColor(colors.white)
- desktop.setCursorPos(1,1)
- desktop.write(" ")
- desktop.setCursorPos(1,2)
- desktop.write(" ")
- desktop.setCursorPos(1,3)
- desktop.write(" ")
- desktop.setCursorPos(1,4)
- desktop.write(" ")
- desktop.setCursorPos(1,5)
- desktop.write(" ")
- desktop.setCursorPos(1,6)
- desktop.write(" ")
- desktop.setCursorPos(1,7)
- desktop.write(" ")
- desktop.setCursorPos(1,8)
- desktop.write(" ")
- desktop.setCursorPos(1,9)
- desktop.write(" ")
- desktop.setCursorPos(1,10)
- desktop.write(" ")
- desktop.setCursorPos(1,11)
- desktop.write(" ")
- desktop.setCursorPos(1,12)
- desktop.write(" ")
- paintutils.drawImage(iconimage4, 2, 3 )
- paintutils.drawImage(iconimage5, 16, 3 )
- end
- end
- sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement