Advertisement
DanielLaby99

LabyOS [XP] Documents

Feb 11th, 2014
49,468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.42 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. -- ##################################### Settings #################################### --
  18. dataname = fs.open("LabyOS/Online/data", "r")
  19. if dataname then
  20. dataname2a = dataname.readLine()
  21. end
  22. dataname.close()
  23.  
  24. fs.makeDir("LabyOS/Documents/"..dataname2a)
  25. fileRUN1 = "LabyOS/Documents/"..dataname2a.."/1"
  26. fileRUN2 = "LabyOS/Documents/"..dataname2a.."/2"
  27. fileRUN3 = "LabyOS/Documents/"..dataname2a.."/3"
  28. fileRUN4 = "LabyOS/Documents/"..dataname2a.."/4"
  29. fileRUN5 = "LabyOS/Documents/"..dataname2a.."/5"
  30. fileRUN6 = "LabyOS/Documents/"..dataname2a.."/6"
  31. fileRUN7 = "LabyOS/Documents/"..dataname2a.."/7"
  32. fileRUN8 = "LabyOS/Documents/"..dataname2a.."/8"
  33. fileRUN9 = "LabyOS/Documents/"..dataname2a.."/9"
  34. fileRUN10 = "LabyOS/Documents/"..dataname2a.."/10"
  35. -- ########################## -- Desktop Background -- ############################ --
  36. function resetScreenDoc()
  37. sbc(1)
  38. r("clear")
  39. sbc(2048)
  40. scp(1,1)
  41. write(" ")
  42. scp(1,1)
  43. stc(1)
  44. write("My Documents")
  45. scp(51,1)
  46. sbc(16384)
  47. write("X")
  48. stc(1)
  49. sbc(8192)
  50. scp(1,19)
  51. w([[ Start ]])
  52. sbc(2048)
  53. w([[ ]])
  54. timeprint1()
  55. scp(8,19)
  56. sbc(8)
  57. r("LabyOS/Task/task")
  58. sbc(1)
  59. stc(32768)
  60. scp(2,3)
  61. end
  62. resetScreenDoc()
  63. -- ################################## File counter ####################################### --
  64. sbc(1)
  65. stc(32768)
  66. scp(42,18)
  67. DiskGB = 0
  68. if fs.exists(fileRUN1) then
  69. DiskGB = DiskGB + 1
  70. end
  71. if fs.exists(fileRUN2) then
  72. DiskGB = DiskGB + 1
  73. end
  74. if fs.exists(fileRUN3) then
  75. DiskGB = DiskGB + 1
  76. end
  77. if fs.exists(fileRUN4) then
  78. DiskGB = DiskGB + 1
  79. end
  80. if fs.exists(fileRUN5) then
  81. DiskGB = DiskGB + 1
  82. end
  83. if fs.exists(fileRUN6) then
  84. DiskGB = DiskGB + 1
  85. end
  86. if fs.exists(fileRUN7) then
  87. DiskGB = DiskGB + 1
  88. end
  89. if fs.exists(fileRUN8) then
  90. DiskGB = DiskGB + 1
  91. end
  92. if fs.exists(fileRUN9) then
  93. DiskGB = DiskGB + 1
  94. end
  95. if fs.exists(fileRUN10) then
  96. DiskGB = DiskGB + 1
  97. end
  98. if DiskGB >= 10 then
  99. scp(41,18)
  100. end
  101. w(DiskGB.."/10 Files")
  102. -- ################################### Load Screen ###################################### --
  103. image = paintutils.loadImage("LabyOS/Texture/Documents")
  104. paintutils.drawImage(image, 4, 3)
  105. paintutils.drawImage(image, 4, 10)
  106. -- ###################################### Function ################################### --
  107. function namewindow()
  108. sbc(2048)
  109. stc(1)
  110. scp(15,5)
  111. w("Add File ")
  112. sbc(16384)
  113. w("X")
  114. sbc(1)
  115. stc(32768)
  116. scp(15,6)
  117. w(": Name: :")
  118. scp(15,7)
  119. sbc(1)
  120. w(": ")
  121. sbc(258)
  122. w(" ")
  123. sbc(1)
  124. w(" :")
  125. sbc(1)
  126. scp(15,8)
  127. w(": :")
  128. scp(15,9)
  129. w("+-----------------+")
  130. scp(17,7)
  131. sbc(258)
  132. stc(128)
  133. w("rom/programs/")
  134. scp(17,7)
  135. stc(32768)
  136. end
  137.  
  138. -- ########################### Logo 1 ########################## --
  139. if not fs.exists(fileRUN1) then
  140. stc(16384)
  141. sbc(256)
  142. scp(7,4)
  143. w([[\/]])
  144. scp(7,5)
  145. w([[/\]])
  146. else
  147. stc(16384)
  148. sbc(256)
  149. scp(7,4)
  150. w("#0")
  151. scp(6,5)
  152. w("Open")
  153. scp(10,3)
  154. stc(1)
  155. sbc(16384)
  156. w("X")
  157. end
  158. -- ########################### Logo 2 ########################## --
  159. if not fs.exists(fileRUN2) then
  160. stc(16384)
  161. sbc(256)
  162. scp(16,4)
  163. w([[\/]])
  164. scp(16,5)
  165. w([[/\]])
  166. else
  167. stc(16384)
  168. sbc(256)
  169. scp(16,4)
  170. w("#1")
  171. scp(15,5)
  172. w("Open")
  173. scp(19,3)
  174. stc(1)
  175. sbc(16384)
  176. w("X")
  177. end
  178. -- ########################### Logo 3 ########################## --
  179. if not fs.exists(fileRUN3) then
  180. stc(16384)
  181. sbc(256)
  182. scp(25,4)
  183. w([[\/]])
  184. scp(25,5)
  185. w([[/\]])
  186. else
  187. stc(16384)
  188. sbc(256)
  189. scp(25,4)
  190. w("#2")
  191. scp(24,5)
  192. w("Open")
  193. scp(28,3)
  194. stc(1)
  195. sbc(16384)
  196. w("X")
  197. end
  198. -- ########################### Logo 4 ########################## --
  199. if not fs.exists(fileRUN4) then
  200. stc(16384)
  201. sbc(256)
  202. scp(34,4)
  203. w([[\/]])
  204. scp(34,5)
  205. w([[/\]])
  206. else
  207. stc(16384)
  208. sbc(256)
  209. scp(34,4)
  210. w("#3")
  211. scp(33,5)
  212. w("Open")
  213. scp(37,3)
  214. stc(1)
  215. sbc(16384)
  216. w("X")
  217. end
  218. -- ########################### Logo 5 ########################## --
  219. if not fs.exists(fileRUN5) then
  220. stc(16384)
  221. sbc(256)
  222. scp(43,4)
  223. w([[\/]])
  224. scp(43,5)
  225. w([[/\]])
  226. else
  227. stc(16384)
  228. sbc(256)
  229. scp(43,4)
  230. w("#4")
  231. scp(42,5)
  232. w("Open")
  233. scp(46,3)
  234. stc(1)
  235. sbc(16384)
  236. w("X")
  237. end
  238. -- ########################### Logo 6 ########################## --
  239. if not fs.exists(fileRUN6) then
  240. stc(16384)
  241. sbc(256)
  242. scp(7,11)
  243. w([[\/]])
  244. scp(7,12)
  245. w([[/\]])
  246. else
  247. stc(16384)
  248. sbc(256)
  249. scp(7,11)
  250. w("#5")
  251. scp(6,12)
  252. w("Open")
  253. scp(10,10)
  254. stc(1)
  255. sbc(16384)
  256. w("X")
  257. end
  258. -- ########################### Logo 7 ########################## --
  259. if not fs.exists(fileRUN7) then
  260. stc(16384)
  261. sbc(256)
  262. scp(16,11)
  263. w([[\/]])
  264. scp(16,12)
  265. w([[/\]])
  266. else
  267. stc(16384)
  268. sbc(256)
  269. scp(16,11)
  270. w("#6")
  271. scp(15,12)
  272. w("Open")
  273. scp(19,10)
  274. stc(1)
  275. sbc(16384)
  276. w("X")
  277. end
  278. -- ########################### Logo 8 ########################## --
  279. if not fs.exists(fileRUN8) then
  280. stc(16384)
  281. sbc(256)
  282. scp(25,11)
  283. w([[\/]])
  284. scp(25,12)
  285. w([[/\]])
  286. else
  287. stc(16384)
  288. sbc(256)
  289. scp(25,11)
  290. w("#7")
  291. scp(24,12)
  292. w("Open")
  293. scp(28,10)
  294. stc(1)
  295. sbc(16384)
  296. w("X")
  297. end
  298. -- ########################### Logo 9 ########################## --
  299. if not fs.exists(fileRUN9) then
  300. stc(16384)
  301. sbc(256)
  302. scp(34,11)
  303. w([[\/]])
  304. scp(34,12)
  305. w([[/\]])
  306. else
  307. stc(16384)
  308. sbc(256)
  309. scp(34,11)
  310. w("#8")
  311. scp(33,12)
  312. w("Open")
  313. scp(37,10)
  314. stc(1)
  315. sbc(16384)
  316. w("X")
  317. end
  318. -- ########################### Logo 10 ########################## --
  319. if not fs.exists(fileRUN10) then
  320. stc(16384)
  321. sbc(256)
  322. scp(43,11)
  323. w([[\/]])
  324. scp(43,12)
  325. w([[/\]])
  326. else
  327. stc(16384)
  328. sbc(256)
  329. scp(43,11)
  330. w("#9")
  331. scp(42,12)
  332. w("Open")
  333. scp(46,10)
  334. stc(1)
  335. sbc(16384)
  336. w("X")
  337. end
  338. -- ############################################################# --
  339. while true do
  340. event, button, X, Y = os.pullEvent("mouse_click")
  341.  
  342. if X >= 1 and X <= 6 and Y == 19 then
  343. startmenu()
  344. error("Terminated")
  345. break
  346. end
  347.  
  348. if X >= 51 and X <= 51 and Y == 1 then
  349. resetDesktop()
  350. error("Terminated")
  351. break
  352. end
  353.  
  354. -- ############################ Slot 1 ############################# --
  355. if X >= 5 and X <= 9 and Y == 3 or X >= 5 and X <= 9 and Y == 4 or X >= 5 and X <= 9 and Y == 5 or X >= 5 and X <= 9 and Y == 6 then
  356. if fs.exists(fileRUN1) then
  357. resetScreenDoc()
  358. shell.run("clear")
  359. sbc(32768)
  360. r(fileRUN1)
  361. else
  362. namewindow()
  363. fileadd = read()
  364. if fileadd == "" then
  365. r("LabyOS/Programme/Documents")
  366. elseif fs.exists(fileadd) then
  367. sbc(1)
  368. scp(1,17)
  369. fs.copy(fileadd, fileRUN1)
  370. sbc(256)
  371. scp(17,7)
  372. stc(16384)
  373. w("File added! ")
  374. sleep(1)
  375. r("LabyOS/Programme/Documents")
  376. elseif not fs.exists(fileadd) then
  377. scp(17,7)
  378. stc(16384)
  379. w("File not found!")
  380. sleep(2)
  381. r("LabyOS/Programme/Documents")
  382. end
  383. break
  384. end
  385. elseif X >= 10 and X <= 10 and Y == 3 then
  386. fs.delete(fileRUN1)
  387. r("LabyOS/Programme/Documents")
  388. end
  389. -- ############################ Slot 2 ############################# --
  390. if X >= 14 and X <= 18 and Y == 3 or X >= 14 and X <= 18 and Y == 4 or X >= 14 and X <= 18 and Y == 5 or X >= 14 and X <= 18 and Y == 6 then
  391. if fs.exists(fileRUN2) then
  392. resetScreenDoc()
  393. shell.run("clear")
  394. sbc(32768)
  395. r(fileRUN2)
  396. else
  397. namewindow()
  398. fileadd2 = read()
  399. if fileadd2 == "" then
  400. r("LabyOS/Programme/Documents")
  401. elseif fs.exists(fileadd2) then
  402. sbc(1)
  403. scp(1,17)
  404. fs.copy(fileadd2, fileRUN2)
  405. sbc(256)
  406. scp(17,7)
  407. stc(16384)
  408. w("File added! ")
  409. sleep(1)
  410. r("LabyOS/Programme/Documents")
  411. elseif not fs.exists(fileadd2) then
  412. scp(17,7)
  413. stc(16384)
  414. w("File not found!")
  415. sleep(2)
  416. r("LabyOS/Programme/Documents")
  417. end
  418. break
  419. end
  420. elseif X >= 19 and X <= 19 and Y == 3 then
  421. fs.delete(fileRUN2)
  422. r("LabyOS/Programme/Documents")
  423. end
  424. -- ############################ Slot 3 ############################# --
  425. if X >= 23 and X <= 27 and Y == 3 or X >= 23 and X <= 27 and Y == 4 or X >= 23 and X <= 27 and Y == 5 or X >= 23 and X <= 27 and Y == 6 then
  426. if fs.exists(fileRUN3) then
  427. resetScreenDoc()
  428. shell.run("clear")
  429. sbc(32768)
  430. r(fileRUN3)
  431. else
  432. namewindow()
  433. fileadd3 = read()
  434. if fileadd3 == "" then
  435. r("LabyOS/Programme/Documents")
  436. elseif fs.exists(fileadd3) then
  437. sbc(1)
  438. scp(1,17)
  439. fs.copy(fileadd3, fileRUN3)
  440. sbc(256)
  441. scp(17,7)
  442. stc(16384)
  443. w("File added! ")
  444. sleep(1)
  445. r("LabyOS/Programme/Documents")
  446. elseif not fs.exists(fileadd3) then
  447. scp(17,7)
  448. stc(16384)
  449. w("File not found!")
  450. sleep(2)
  451. r("LabyOS/Programme/Documents")
  452. end
  453. break
  454. end
  455. elseif X >= 28 and X <= 28 and Y == 3 then
  456. fs.delete(fileRUN3)
  457. r("LabyOS/Programme/Documents")
  458. end
  459. -- ############################ Slot 4 ############################# --
  460. if X >= 32 and X <= 36 and Y == 3 or X >= 32 and X <= 36 and Y == 4 or X >= 32 and X <= 36 and Y == 5 or X >= 32 and X <= 36 and Y == 6 then
  461. if fs.exists(fileRUN4) then
  462. resetScreenDoc()
  463. shell.run("clear")
  464. sbc(32768)
  465. r(fileRUN4)
  466. else
  467. namewindow()
  468. fileadd4 = read()
  469. if fileadd4 == "" then
  470. r("LabyOS/Programme/Documents")
  471. elseif fs.exists(fileadd4) then
  472. sbc(1)
  473. scp(1,17)
  474. fs.copy(fileadd4, fileRUN4)
  475. sbc(256)
  476. scp(17,7)
  477. stc(16384)
  478. w("File added! ")
  479. sleep(1)
  480. r("LabyOS/Programme/Documents")
  481. elseif not fs.exists(fileadd4) then
  482. scp(17,7)
  483. stc(16384)
  484. w("File not found!")
  485. sleep(2)
  486. r("LabyOS/Programme/Documents")
  487. end
  488. break
  489. end
  490. elseif X >= 37 and X <= 37 and Y == 3 then
  491. fs.delete(fileRUN4)
  492. r("LabyOS/Programme/Documents")
  493. end
  494. -- ############################ Slot 5 ############################# --
  495. if X >= 41 and X <= 45 and Y == 3 or X >= 41 and X <= 45 and Y == 4 or X >= 41 and X <= 45 and Y == 5 or X >= 41 and X <= 45 and Y == 6 then
  496. if fs.exists(fileRUN5) then
  497. resetScreenDoc()
  498. shell.run("clear")
  499. sbc(32768)
  500. r(fileRUN5)
  501. else
  502. namewindow()
  503. fileadd5 = read()
  504. if fileadd5 == "" then
  505. r("LabyOS/Programme/Documents")
  506. elseif fs.exists(fileadd5) then
  507. sbc(1)
  508. scp(1,17)
  509. fs.copy(fileadd5, fileRUN5)
  510. sbc(256)
  511. scp(17,7)
  512. stc(16384)
  513. w("File added! ")
  514. sleep(1)
  515. r("LabyOS/Programme/Documents")
  516. elseif not fs.exists(fileadd5) then
  517. scp(17,7)
  518. stc(16384)
  519. w("File not found!")
  520. sleep(2)
  521. r("LabyOS/Programme/Documents")
  522. end
  523. break
  524. end
  525. elseif X >= 46 and X <= 46 and Y == 3 then
  526. fs.delete(fileRUN5)
  527. r("LabyOS/Programme/Documents")
  528. end
  529. -- ############################ Slot 6 ############################# --
  530. if X >= 5 and X <= 9 and Y == 10 or X >= 5 and X <= 9 and Y == 11 or X >= 5 and X <= 9 and Y == 12 or X >= 5 and X <= 9 and Y == 13 then
  531. if fs.exists(fileRUN6) then
  532. resetScreenDoc()
  533. shell.run("clear")
  534. sbc(32768)
  535. r(fileRUN6)
  536. else
  537. namewindow()
  538. fileadd6 = read()
  539. if fileadd6 == "" then
  540. r("LabyOS/Programme/Documents")
  541. elseif fs.exists(fileadd6) then
  542. sbc(1)
  543. scp(1,17)
  544. fs.copy(fileadd6, fileRUN6)
  545. sbc(256)
  546. scp(17,7)
  547. stc(16384)
  548. w("File added! ")
  549. sleep(1)
  550. r("LabyOS/Programme/Documents")
  551. elseif not fs.exists(fileadd6) then
  552. scp(17,7)
  553. stc(16384)
  554. w("File not found!")
  555. sleep(2)
  556. r("LabyOS/Programme/Documents")
  557. end
  558. break
  559. end
  560. elseif X >= 10 and X <= 10 and Y == 10 then
  561. fs.delete(fileRUN6)
  562. r("LabyOS/Programme/Documents")
  563. end
  564. -- ############################ Slot 7 ############################# --
  565. if X >= 14 and X <= 18 and Y == 10 or X >= 14 and X <= 18 and Y == 11 or X >= 14 and X <= 18 and Y == 12 or X >= 14 and X <= 18 and Y == 13 then
  566. if fs.exists(fileRUN7) then
  567. resetScreenDoc()
  568. shell.run("clear")
  569. sbc(32768)
  570. r(fileRUN7)
  571. else
  572. namewindow()
  573. fileadd7 = read()
  574. if fileadd7 == "" then
  575. r("LabyOS/Programme/Documents")
  576. elseif fs.exists(fileadd7) then
  577. sbc(1)
  578. scp(1,17)
  579. fs.copy(fileadd7, fileRUN7)
  580. sbc(256)
  581. scp(17,7)
  582. stc(16384)
  583. w("File added! ")
  584. sleep(1)
  585. r("LabyOS/Programme/Documents")
  586. elseif not fs.exists(fileadd7) then
  587. scp(17,7)
  588. stc(16384)
  589. w("File not found!")
  590. sleep(2)
  591. r("LabyOS/Programme/Documents")
  592. end
  593. break
  594. end
  595. elseif X >= 19 and X <= 19 and Y == 10 then
  596. fs.delete(fileRUN7)
  597. r("LabyOS/Programme/Documents")
  598. end
  599. -- ############################ Slot 8 ############################# --
  600. if X >= 23 and X <= 27 and Y == 10 or X >= 23 and X <= 27 and Y == 11 or X >= 23 and X <= 27 and Y == 12 or X >= 23 and X <= 27 and Y == 13 then
  601. if fs.exists(fileRUN8) then
  602. resetScreenDoc()
  603. shell.run("clear")
  604. sbc(32768)
  605. r(fileRUN8)
  606. else
  607. namewindow()
  608. fileadd8 = read()
  609. if fileadd8 == "" then
  610. r("LabyOS/Programme/Documents")
  611. elseif fs.exists(fileadd8) then
  612. sbc(1)
  613. scp(1,17)
  614. fs.copy(fileadd8, fileRUN8)
  615. sbc(256)
  616. scp(17,7)
  617. stc(16384)
  618. w("File added! ")
  619. sleep(1)
  620. r("LabyOS/Programme/Documents")
  621. elseif not fs.exists(fileadd8) then
  622. scp(17,7)
  623. stc(16384)
  624. w("File not found!")
  625. sleep(2)
  626. r("LabyOS/Programme/Documents")
  627. end
  628. break
  629. end
  630. elseif X >= 28 and X <= 28 and Y == 10 then
  631. fs.delete(fileRUN8)
  632. r("LabyOS/Programme/Documents")
  633. end
  634. -- ############################ Slot 9 ############################# --
  635. if X >= 32 and X <= 36 and Y == 10 or X >= 32 and X <= 36 and Y == 11 or X >= 32 and X <= 36 and Y == 12 or X >= 32 and X <= 36 and Y == 13 then
  636. if fs.exists(fileRUN9) then
  637. resetScreenDoc()
  638. shell.run("clear")
  639. sbc(32768)
  640. r(fileRUN9)
  641. else
  642. namewindow()
  643. fileadd9 = read()
  644. if fileadd9 == "" then
  645. r("LabyOS/Programme/Documents")
  646. elseif fs.exists(fileadd9) then
  647. sbc(1)
  648. scp(1,17)
  649. fs.copy(fileadd9, fileRUN9)
  650. sbc(256)
  651. scp(17,7)
  652. stc(16384)
  653. w("File added! ")
  654. sleep(1)
  655. r("LabyOS/Programme/Documents")
  656. elseif not fs.exists(fileadd9) then
  657. scp(17,7)
  658. stc(16384)
  659. w("File not found!")
  660. sleep(2)
  661. r("LabyOS/Programme/Documents")
  662. end
  663. break
  664. end
  665. elseif X >= 37 and X <= 37 and Y == 10 then
  666. fs.delete(fileRUN9)
  667. r("LabyOS/Programme/Documents")
  668. end
  669. -- ############################ Slot 10 ############################# --
  670. if X >= 41 and X <= 45 and Y == 10 or X >= 41 and X <= 45 and Y == 11 or X >= 41 and X <= 45 and Y == 12 or X >= 41 and X <= 45 and Y == 13 then
  671. if fs.exists(fileRUN10) then
  672. resetScreenDoc()
  673. shell.run("clear")
  674. sbc(32768)
  675. r(fileRUN10)
  676. else
  677. namewindow()
  678. fileadd10 = read()
  679. if fileadd10 == "" then
  680. r("LabyOS/Programme/Documents")
  681. elseif fs.exists(fileadd10) then
  682. sbc(1)
  683. scp(1,17)
  684. fs.copy(fileadd10, fileRUN10)
  685. sbc(256)
  686. scp(17,7)
  687. stc(16384)
  688. w("File added! ")
  689. sleep(1)
  690. r("LabyOS/Programme/Documents")
  691. elseif not fs.exists(fileadd10) then
  692. scp(17,7)
  693. stc(16384)
  694. w("File not found!")
  695. sleep(2)
  696. r("LabyOS/Programme/Documents")
  697. end
  698. break
  699. end
  700. elseif X >= 46 and X <= 46 and Y == 10 then
  701. fs.delete(fileRUN10)
  702. r("LabyOS/Programme/Documents")
  703. end
  704.  
  705.  
  706.  
  707.  
  708. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement