Atom888

XynSoft 1.0 - App Board

Dec 27th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. colr = Color()
  2. function Username()
  3.    local f = xs.ReadAll("/XynSoft/Data/User/Username")
  4.    return f
  5. end
  6. xs.Block(2,1,11,19,true,colr)
  7. page = 1
  8. function WrtPg(pg)
  9.    Write("<   "..pg.."   >",2,11,colr,colors.lightGray)
  10. end
  11. WrtPg(page)
  12. usr = Username()
  13. app_list = fs.list("/Users/"..usr.."/Applecations")
  14. function initapps()
  15. apps = table.len(app_list)
  16. appevnt = {}
  17. y = 1
  18. a = 0
  19. for app = 1,apps do
  20.    a = a + 1
  21.    flist = xs.ReadAll("/Users/"..usr.."/Applecations/"..app)
  22.    name = flist["name"]
  23.    run = flist["run"]
  24.    table.insert(y,run,appevnt)
  25.    if a > 17 then
  26.       a = 0
  27.       p = p + 1
  28.    end
  29.    if page == p then
  30.       xs.CP(2,y)
  31.       xs.BC(colr)
  32.       xs.TC(colors.white)
  33.       term.write(name)
  34.       if string.len(name) > 9 then
  35.          xs.BC(colors.white)
  36.          CP(12,y)
  37.          for i = 12,12 + (string.len(name) - 9) do
  38.             term.write(" ")
  39.          end
  40.          CP(10,y)
  41.          term.write("...")
  42.       end
  43.    end
  44. end
  45. end
  46. t1 = true
  47. while t1 do
  48.    if ShellEventAdv("mouse_click",2,2,19,19)
  49.       if page == 1 then
  50.          page = 1
  51.       else
  52.          page = page - 1
  53.          initapps()
  54.          WrtPg(page)
  55.       end
  56.    elseif ShellEventAdv("mouse_click",11,11,19,19)
  57.       page = page + 1
  58.       initapps()
  59.       WrtPg(page)
  60.    end
  61.    button,x,y = xs.ShellEvent("mouse_click")
  62.    if (x < 2) or (x > 11) then
  63.       t1 = true
  64.    elseif (x >= 2) and (x <= 11) then
  65.       shell.run(appevnt[y])
  66.       t1 = false
  67.    end
  68. end
Advertisement
Add Comment
Please, Sign In to add comment