Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables
- os.loadAPI("maxintosh/mAPI")
- --Desgin
- file=fs.open("maxintosh/"..currentUser.."/color","r")
- col=file.readLine()
- colWind=file.readLine()
- colText=file.readLine()
- file.close()
- term.setBackgroundColor(colors[col])
- term.clear()
- p=paintutils.loadImage("maxintosh/"..currentUser.."/desktopBackground")
- paintutils.drawImage(p,2,1)
- term.setCursorPos(7,1)
- term.setTextColor(colors.orange)
- write(" Apps ")
- term.setCursorPos(44,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors[colText])
- term.write("Settings")
- paintutils.drawBox(18,1,18,20,colors[colWind])
- term.setCursorPos(51,19)
- term.setBackgroundColor(colors[colWind])
- term.setTextColor(colors[colText])
- write("M")
- --Loading Apps
- for x=1,18 do
- for y=2,20 do
- if fs.exists("maxintosh/"..currentUser.."/apps/"..x..","..y) then
- file=fs.open("maxintosh/"..currentUser.."/apps/"..x..","..y,"r")
- appProgram=file.readLine()
- appName=file.readLine()
- appColor=file.readLine()
- file.close()
- l=string.len(appName)
- paintutils.drawPixel(x,y,colors[appColor])
- term.setTextColor(colors[appColor])
- term.setBackgroundColor(colors[col])
- term.setCursorPos((x-(math.floor(l/2))),y-1)
- write(appName)
- end
- end
- end
- --Click
- while true do
- event,n,x,y=os.pullEvent("mouse_click")
- if x>43 and y==1 then
- shell.run("maxintosh/settings")
- error()
- end
- if x==51 and y==19 then
- term.setBackgroundColor(colors[colWind])
- term.setTextColor(colors[colText])
- paintutils.drawFilledBox(44,16,51,19,colors[colWind])
- term.setBackgroundColor(colors.purple)
- term.setTextColor(colors.orange)
- term.setCursorPos(51,19)
- term.setBackgroundColor(colors[colWind])
- term.setTextColor(colors[colText])
- write("M")
- term.setCursorPos(44,16)
- write(" logout")
- term.setCursorPos(44,17)
- write(" reboot")
- term.setCursorPos(44,18)
- write("shutdown")
- while true do
- event,n,x,y=os.pullEvent("mouse_click")
- if x>43 and y==16 then
- shell.run("maxintosh/login")
- error()
- end
- if x>43 and y==17 then
- os.reboot()
- end
- if x>43 and y==18 then
- os.shutdown()
- end
- if x==51 and y==19 then
- shell.run("maxintosh/desktop")
- error()
- end
- end
- end
- if n==1 and not(x>43 and y==1) and x<18 then
- if fs.exists("maxintosh/"..currentUser.."/apps/"..x..","..y) then
- file=fs.open("maxintosh/"..currentUser.."/apps/"..x..","..y,"r")
- program=file.readLine()
- file.close()
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.clear()
- shell.run("maxintosh/"..currentUser.."/programs/"..program)
- shell.run("maxintosh/desktop")
- error()
- end
- end
- if n==2 and not(x>43 and y==1) and x<18 then
- if fs.exists("maxintosh/"..currentUser.."/apps/"..x..","..y) then
- oldX=x
- oldY=y
- appX=x
- appY=y
- mAPI.drawWindow(2,2,colWind)
- term.setTextColor(colors[colText])
- term.setBackgroundColor(colors[colWind])
- term.setCursorPos(4,5)
- write("change Color:")
- term.setCursorPos(4,8)
- write("change Name:")
- term.setCursorPos(4,11)
- write("new X-coord:")
- term.setCursorPos(4,14)
- write("new Y-coord:")
- term.setCursorPos(17,16)
- write("remove Application")
- term.setCursorPos(15,3)
- term.setBackgroundColor(colors[colWind])
- file=fs.open("maxintosh/"..currentUser.."/apps/"..oldX..","..oldY,"r")
- appProgram=file.readLine()
- file.close()
- write("App: ")
- write(appProgram)
- while true do
- event,n,x,y=os.pullEvent("mouse_click")
- if x==50 and y==2 then
- fs.delete("maxintosh/"..currentUser.."/apps/"..oldX..","..oldY)
- file=fs.open("maxintosh/"..currentUser.."/apps/"..(appX+0)..","..(appY+0),"w")
- file.writeLine(appProgram)
- file.writeLine(appName)
- file.writeLine(appColor)
- file.writeLine(appX)
- file.writeLine(appY)
- file.close()
- shell.run("maxintosh/desktop")
- error()
- end
- if y==16 then
- fs.delete("maxintosh/"..currentUser.."/apps/"..oldX..","..oldY)
- shell.run("maxintosh/desktop")
- error()
- end
- if y==3 or y==5 or y==8 or y==11 or y==14 then
- file=fs.open("maxintosh/"..currentUser.."/apps/"..oldX..","..oldY,"r")
- appProgram=file.readLine()
- appName=file.readLine()
- appColor=file.readLine()
- appX=file.readLine()
- appY=file.readLine()
- file.close()
- if y==3 then
- paintutils.drawBox(29,3,47,3,colors[colWind])
- term.setCursorPos(29,3)
- appProgram=read()
- end
- if y==5 then
- paintutils.drawBox(18,5,47,5,colors[colWind])
- term.setCursorPos(18,5)
- appColor=read()
- end
- if y==8 then
- paintutils.drawBox(17,8,47,8,colors[colWind])
- term.setCursorPos(17,8)
- appName=read()
- end
- if y==11 then
- paintutils.drawBox(17,11,47,11,colors[colWind])
- term.setCursorPos(17,11)
- appX=read()
- end
- if y==14 then
- paintutils.drawBox(17,14,47,14,colors[colWind])
- term.setCursorPos(17,14)
- appY=read()
- end
- end
- end
- else
- appX=tostring(x)
- appY=tostring(y)
- mAPI.drawWindow(2,2,colWind)
- term.setTextColor(colors[colText])
- term.setBackgroundColor(colors[colWind])
- term.setCursorPos(4,4)
- write("App-Color: ")
- term.setCursorPos(4,9)
- write("connected Program: ")
- term.setCursorPos(4,14)
- write("App-Name:")
- a=false
- b=false
- c=false
- while true do
- event,n,x,y=os.pullEvent("mouse_click")
- if x==50 and y==2 then
- if a==true and b==true and c==true then
- file=fs.open("maxintosh/"..currentUser.."/apps/"..appX..","..appY,"w")
- file.writeLine(appProgram)
- file.writeLine(appName)
- file.writeLine(appColor)
- file.writeLine(tonumber(appX))
- file.writeLine(tonumber(appY))
- file.close()
- shell.run("maxintosh/desktop")
- error()
- else
- shell.run("maxintosh/desktop")
- error()
- end
- end
- if y==4 then
- paintutils.drawBox(15,4,47,4,colors[colWind])
- term.setCursorPos(15,4)
- appColor=read()
- a=true
- end
- if y==9 then
- paintutils.drawBox(25,9,47,9,colors[colWind])
- term.setCursorPos(25,9)
- appProgram=read()
- b=true
- end
- if y==14 then
- paintutils.drawBox(31,14,47,14,colors[colWind])
- term.setCursorPos(16,14)
- appName=read()
- c=true
- end
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment