Advertisement
DanielLaby99

LabyOS [XP] Desktop

Feb 9th, 2014
49,674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.38 KB | None | 0 0
  1. -- ########################## -- Funktionen -- ############################ --
  2. local function s(...) return sleep(...) end
  3. local function w(...) return write(...) end
  4. local function p(...) return print(...) end
  5. local function tw(...) return term.write(...) end
  6. local function scp(...) return term.setCursorPos(...) end
  7. local function sbc(...) return term.setBackgroundColor(...) end
  8. local function stc(...) return term.setTextColor(...) end
  9. local function tc(...) return term.clear(...) end
  10. local function tcl(...) return term.clearLine() end
  11. local function scb(...) return term.setCursorBlink(...) end
  12. local function ts(...) return term.scroll(...) end
  13. local function r(...) return shell.run(...) end
  14. local function para(...) return parallel.waitForAny(...) end
  15. local function sw(...) return textutils.slowWrite(...) end
  16. local function sp(...) return textutils.slowPrint(...) end
  17. -- ########################## -- Einstellungen -- ############################ --
  18. dataname = fs.open("LabyOS/Online/data", "r")
  19. if dataname then
  20. dataname1a = dataname.readLine()
  21. end
  22. dataname.close()
  23. fs.makeDir("LabyOS/Texture/Desktop/"..dataname1a)
  24. if not fs.exists("LabyOS/Texture/Desktop/"..dataname1a.."/1") then
  25. r("pastebin get 9EvMFZbV LabyOS/Texture/Desktop/"..dataname1a.."/1")
  26. end
  27. BreakPara = 0
  28. loopbreak2 = 0
  29. sbc(32768)
  30. stc(1)
  31. fs.makeDir("LabyOS/Task")
  32. writetask = fs.open("LabyOS/Task/task", "w")
  33. writetask.write([[]])
  34. writetask.close()
  35. -- ########################## -- BACKUP -- ############################ --
  36. if fs.exists("startup") then
  37. if fs.exists("LabyOS/Backup/startup") then
  38. fs.delete("startup")
  39. fs.copy("LabyOS/Backup/startup", "startup")
  40. end
  41. else
  42. r("clear")
  43. error("startup is not exists")
  44. end
  45. -- ########################## -- Run Desktop -- ############################ --
  46. function runDesktop1()
  47. function resetScreen()
  48. image = paintutils.loadImage("LabyOS/Texture/Desktop/"..dataname1a.."/1")
  49. paintutils.drawImage(image, 1, 1)
  50. stc(1)
  51. sbc(8192)
  52. scp(1,19)
  53. w([[ Start ]])
  54. sbc(2048)
  55. w([[ ]])
  56. -- TIMEOLD
  57. scp(8,19)
  58. sbc(8)
  59. r("LabyOS/Task/task")
  60. sbc(2048)
  61. end
  62.  
  63. function resetDesktop()
  64. -- ########################## -- Desktop Background -- ############################ --
  65. image = paintutils.loadImage("LabyOS/Texture/Desktop/"..dataname1a.."/1")
  66. paintutils.drawImage(image, 1, 1)
  67. -- ########################## -- Clock -- ############################ --
  68.  
  69. function GetTime()
  70.  
  71. if TimeAPI == "USA" then
  72. USATime = "00:00"
  73. -- USATime = http.get("http://www.timeapi.org/edt/now?format=%25k:%25M")
  74. -- USATime = USATime.readAll()
  75. scp(47,19)
  76. stc(1)
  77. sbc(2048)
  78. write(USATime)
  79. elseif TimeAPI == "DE" then
  80. DETime = "00:00"
  81. -- DETime = http.get("http://www.timeapi.org/cet/now?format=%25k:%25M")
  82. -- DETime = DETime.readAll()
  83. scp(47,19)
  84. stc(1)
  85. sbc(2048)
  86. write(DETime)
  87. elseif TimeAPI == "EN" then
  88. ENTime = "00:00"
  89. -- ENTime = http.get("http://www.timeapi.org/utc/now?format=%25k:%25M")
  90. -- ENTime = ENTime.readAll()
  91. scp(47,19)
  92. stc(1)
  93. sbc(2048)
  94. write(ENTime)
  95. elseif TimeAPI == "MC" then
  96. timeprint2 = os.time()
  97. timeprint2 = textutils.formatTime(timeprint2, true)
  98. sbc(1)
  99. stc(32768)
  100. scp(47,19)
  101. stc(1)
  102. sbc(2048)
  103. write(timeprint2.." ")
  104. sbc(1)
  105. stc(32768)
  106. end
  107. end
  108.  
  109.  
  110. function timeprint()
  111. sbc(1)
  112. stc(32768)
  113. BreakPara = 1
  114. DETime = "00:00" -- if you have a http error
  115. USATime = "00:00"
  116. ENTime = "00:00"
  117. TimeAPIR = fs.open("LabyOS/Config/TimeAPI", "r")
  118. TimeAPI = TimeAPIR.readLine()
  119. TimeAPIR.close()
  120. GetTime()
  121. stc(1)
  122. sbc(8192)
  123. scp(1,19)
  124. w([[ Start ]])
  125. sbc(2048)
  126. w([[ ]])
  127. scp(8,19)
  128. sbc(8)
  129. r("LabyOS/Task/task")
  130. sbc(2048)
  131. sbc(1)
  132. stc(32768)
  133. while true do
  134. sbc(1)
  135. stc(32768)
  136. GetTime()
  137. sbc(1)
  138. stc(32768)
  139. sleep(51) -- Time Update #### -- change to 1 for see the seconds in OS Time clock
  140. sbc(1)
  141. stc(32768)
  142. end
  143. end
  144.  
  145. function timeprint1()
  146. scp(47,19)
  147. stc(1)
  148. sbc(2048)
  149. if TimeAPI == "USA" then
  150. write(USATime)
  151. elseif TimeAPI == "DE" then
  152. write(DETime)
  153. elseif TimeAPI == "EN" then
  154. write(ENTime)
  155. elseif TimeAPI == "MC" then
  156. write(timeprint2.." ")
  157. end
  158.  
  159. end
  160. function runsystem()
  161. timeprint1()
  162. -- ########################## -- Run System -- ############################ --
  163. while true do
  164. event, button, X, Y = os.pullEvent("mouse_click")
  165. -- ########################## -- StartMenu -- ############################ --
  166. if X >= 8 and X <= 20 and Y == 19 and closetask1 == 0 then
  167. openrun()
  168. openrun2()
  169. end
  170. -- ############ -- Startlist-Design -- ############ --
  171. if X >= 1 and X <= 6 and Y == 19 then
  172.  
  173. function startmenu()
  174. breaktask1 = 1
  175.  
  176.  
  177.  
  178. scp(1,10)
  179. sbc(2048)
  180. w([[ ]])
  181. scp(2,10)
  182. stc(1)
  183. write(dataname1a)
  184. scp(14,10)
  185. sbc(16384)
  186. w([[X]])
  187. scp(13,10)
  188. sbc(2048)
  189. w([[ ]])
  190. sbc(1)
  191. stc(32768)
  192. scp(1,11)
  193. w([[:Documents ]])
  194. scp(1,12)
  195. w([[:Browser ]])
  196. scp(1,13)
  197. w([[:Explorer ]])
  198. scp(1,14)
  199. w([[ ]])
  200. scp(1,15)
  201. w([[:Programs >]])
  202. scp(1,16)
  203. w([[:Run ]])
  204. scp(1,17)
  205. w([[ ]])
  206. scp(1,18)
  207. w([[:Shutdown >]])
  208. -- TIMEOLD
  209. while true do
  210. event, button, X, Y = os.pullEvent("mouse_click")
  211. -- ############ -- Startfiles List -- ############ --
  212. if X >= 8 and X <= 20 and Y == 19 and closetask1 == 0 then
  213. openrun()
  214. openrun2()
  215. error("Terminated")
  216. end
  217. -- ############ -- EMPTY -- ############ --
  218. if X >= 1 and X <= 14 and Y == 14 then
  219. stc(1)
  220. end
  221. -- ############ -- Documents -- ############ --
  222. if X >= 1 and X <= 14 and Y == 11 then
  223. stc(1)
  224. r("LabyOS/Programme/Documents")
  225. error("Terminated")
  226. break
  227. end
  228. -- ############ -- Browser -- ############ --
  229. if X >= 1 and X <= 14 and Y == 12 then
  230. stc(1)
  231. r("LabyOS/Programme/Browser")
  232. break
  233. end
  234. -- ############ -- Explorer -- ############ --
  235. if X >= 1 and X <= 14 and Y == 13 then
  236. stc(1)
  237. r("LabyOS/Programme/System")
  238. error("Terminated")
  239. break
  240. end
  241. -- ############ -- Programs -- ############ --
  242. if X >= 1 and X <= 14 and Y == 15 then
  243. sbc(1)
  244. stc(32768)
  245. scp(15,14)
  246. sbc(16384)
  247. w([[:]])
  248. sbc(1)
  249. w([[Back ]])
  250. scp(15,15)
  251. sbc(8)
  252. w([[:]])
  253. sbc(1)
  254. w([[Task Manager ]])
  255. scp(15,16)
  256. sbc(8)
  257. w([[:]])
  258. sbc(1)
  259. w([[CraftOS ]])
  260. scp(15,17)
  261. sbc(8)
  262. w([[:]])
  263. sbc(1)
  264. w([[Settings ]])
  265. scp(15,18)
  266. sbc(8)
  267. w([[:]])
  268. sbc(1)
  269. w([[Editor ]])
  270. scp(14,15)
  271. stc(16384)
  272. w([[>]])
  273. while true do
  274. event, button, X, Y = os.pullEvent("mouse_click")
  275. stc(1)
  276. if X >= 15 and X <= 24 and Y == 14 then
  277. resetDesktop()
  278. error("Terminated")
  279. break
  280. end
  281. if X >= 15 and X <= 24 and Y == 15 then
  282. r("LabyOS/Programme/Manager")
  283. error("Terminated")
  284. break
  285. end
  286. if X >= 15 and X <= 24 and Y == 16 then
  287. r("LabyOS</Programme/Terminal")
  288. error("Terminated")
  289. break
  290. end
  291. if X >= 15 and X <= 24 and Y == 17 then
  292. r("LabyOS/Programme/Settings")
  293. error("Terminated")
  294. break
  295. end
  296. if X >= 15 and X <= 24 and Y == 18 then
  297. sbc(2048)
  298. stc(1)
  299. scp(15,5)
  300. w("Open File ")
  301. sbc(16384)
  302. w("X")
  303. sbc(1)
  304. stc(32768)
  305. scp(15,6)
  306. w(": Filename: :")
  307. scp(15,7)
  308. sbc(1)
  309. w(": ")
  310. sbc(258)
  311. w(" ")
  312. sbc(1)
  313. w(" :")
  314. sbc(1)
  315. scp(15,8)
  316. w(": :")
  317. scp(15,9)
  318. w("+-----------------+")
  319. scp(17,7)
  320. sbc(258)
  321. stc(128)
  322. w("")
  323. scp(17,7)
  324. stc(32768)
  325. fileaddL = read()
  326. if fileaddL == "" then
  327. r("LabyOS/Programme/Desktop")
  328. error("Terminated")
  329. elseif fs.exists(fileaddL) then
  330. sbc(1)
  331. scp(1,17)
  332. r("LabyOS/Programme/Editor "..fileaddL)
  333. r("LabyOS/Programme/Desktop")
  334. error("Terminated")
  335. elseif not fs.exists(fileaddL) then
  336. scp(17,7)
  337. stc(16384)
  338. w("Create file!")
  339. sleep(2)
  340. sbc(256)
  341. r("LabyOS/Programme/Editor "..fileaddL)
  342. error("Terminated")
  343. break
  344. end
  345.  
  346. r("LabyOS/Programme/Editor")
  347. error("Terminated")
  348. break
  349. end
  350. if X >= 1 and X <= 51 and Y == 19 then
  351. resetDesktop()
  352. -- TIMEOLD
  353. break
  354. end
  355. if X >= 14 and X <= 14 and Y == 10 then
  356. resetDesktop()
  357. -- TIMEOLD
  358. break
  359. end
  360. end
  361. break
  362. end -- end loop
  363. -- ############ -- Run -- ############ --
  364. if X >= 1 and X <= 14 and Y == 16 then
  365. r("LabyOS/Programme/Run")
  366. stc(1)
  367. error("Terminated")
  368. break
  369. end
  370. -- ############ -- Close -- ############ --
  371. if X >= 14 and X <= 14 and Y == 10 then
  372. stc(1)
  373. resetDesktop()
  374. error("Terminated")
  375. break
  376. end
  377. -- ############ -- Close -- ############ --
  378. if X >= 1 and X <= 6 and Y == 19 then
  379. stc(1)
  380. resetDesktop()
  381. error("Terminated")
  382. break
  383. end
  384. -- ############ -- Shutdown -- ############ --
  385. if X >= 1 and X <= 14 and Y == 18 then
  386. sbc(1)
  387. stc(32768)
  388. scp(15,14)
  389. sbc(16384)
  390. w([[:]])
  391. sbc(1)
  392. w([[Back ]])
  393. scp(15,15)
  394. sbc(8)
  395. w([[:]])
  396. sbc(1)
  397. w([[Logout ]])
  398. scp(15,16)
  399. sbc(8)
  400. w([[:]])
  401. sbc(1)
  402. w([[Shutdown ]])
  403. scp(15,17)
  404. sbc(8)
  405. w([[:]])
  406. sbc(1)
  407. w([[Reboot ]])
  408. scp(15,18)
  409. sbc(8)
  410. w([[:]])
  411. sbc(1)
  412. w([[Relog ]])
  413. scp(14,18)
  414. stc(16384)
  415. w([[>]])
  416. while true do
  417. event, button, X, Y = os.pullEvent("mouse_click")
  418. stc(1)
  419. if X >= 15 and X <= 24 and Y == 14 then
  420. resetDesktop()
  421. break
  422. end
  423. if X >= 15 and X <= 24 and Y == 15 then
  424.  
  425. saveS2 = fs.open("LabyOS/Config/SaveStart", "r")
  426. saveST = saveS2.readLine()
  427. saveS2.close()
  428. if saveST == "false" then
  429. saveS = fs.open("LabyOS/Config/SaveStart", "w")
  430. saveS.write("true")
  431. saveS.close()
  432. elseif saveST == "trueKeep" then
  433. end
  434. sbc(128)
  435. r("clear")
  436. s(0.1)
  437.  
  438. sbc(256)
  439. r("clear")
  440. s(0.1)
  441. sbc(1)
  442. r("clear")
  443. s(0.1)
  444. sbc(32768)
  445. r("clear")
  446. s(0.1)
  447. sbc(128)
  448. r("clear")
  449. s(0.1)
  450. sbc(256)
  451. r("clear")
  452. s(0.1)
  453. sbc(1)
  454. r("clear")
  455. r("startup")
  456. error("Terminated")
  457. break
  458. end
  459. if X >= 15 and X <= 24 and Y == 16 then
  460. r("LabyOS/Programme/Shutdown")
  461. error("Terminated")
  462. break
  463. end
  464. if X >= 15 and X <= 24 and Y == 17 then
  465. r("LabyOS</Programme/Reboot")
  466. error("Terminated")
  467. break
  468. end
  469. if X >= 15 and X <= 24 and Y == 18 then
  470. r("LabyOS/Programme/Relog")
  471. error("Terminated")
  472. break
  473. end
  474. if X >= 1 and X <= 51 and Y == 19 then
  475. resetDesktop()
  476. -- TIMEOLD
  477. error("Terminated")
  478. break
  479. end
  480. if X >= 14 and X <= 14 and Y == 10 then
  481. resetDesktop()
  482. -- TIMEOLD
  483. error("Terminated")
  484. break
  485. end -- if
  486. end -- loop extramenu
  487. end -- runsystem
  488. end -- startmenu
  489. end -- reset desktop
  490. if BreakPara == 0 then
  491. para(startmenu, timeprint)
  492. else
  493. startmenu()
  494. end
  495. end
  496. end
  497. error("Terminated")
  498. resetDesktop()
  499. end
  500. -- ########################## -- Draw Task Menu -- ############################ --
  501. stc(1)
  502. sbc(8192)
  503. scp(1,19)
  504. w([[ Start ]])
  505. sbc(2048)
  506. w([[ 00:00]])
  507. scp(8,19)
  508. sbc(8)
  509. r("LabyOS/Task/task")
  510. sbc(2048)
  511. -- ###############################################################################
  512. runsystem()
  513. end
  514. resetDesktop()
  515. end
  516.  
  517.  
  518. function terminate()
  519. while true do
  520. local events = os.pullEventRaw()
  521. if events == "terminate" then
  522. os.reboot()
  523. end
  524. end
  525. end
  526.  
  527.  
  528. para(terminate, runDesktop1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement