Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArg = {...}
- local FilePath = tArg[1]
- local ShortcutType = "n"
- local ShortcutName = "n"
- local ShortcutImage = "n"
- local ShortcutPath = "n"
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function GetFile()
- local List = fs.list("os/System/Saved/Shortcuts")
- for i = 1, #List do
- local file = fs.open(fs.combine("os/System/Saved/Shortcuts",List[i]),"r")
- local A = file.readLine()
- local Content = file.readLine()
- local B = file.readLine()
- local C = file.readLine()
- file.close()
- if Content == FilePath then
- ShortcutType = C
- ShortcutName = A
- ShortcutImage = B
- ShortcutPath = List[i]
- end
- end
- end
- function EditItem(item)
- local Pos
- local y = 1
- if item == "Type" then
- Pos = {"n","Popup","Desktop","Taskbar"}
- y = 3
- elseif item == "Name" then
- Pos = {}
- y = 4
- elseif item == "Image" then
- Pos = fs.list("os/System/Saved/Images")
- y = 5
- end
- term.setCursorPos(1,y)
- term.clearLine()
- local completion = require "cc.completion"
- local input
- while true do
- local event = {os.pullEvent("key")}
- if event[2] == keys.enter then break end
- input = read(nil, nil, function(text) return completion.choice(text, Pos) end)
- end
- if item == "Type" then
- ShortcutType = input
- elseif item == "Name" then
- ShortcutName = input
- elseif item == "Image" then
- ShortcutImage = fs.combine("os/System/Saved/Images",input)
- end
- local file = fs.open(fs.combine("os/System/Saved/Shortcuts",ShortcutPath),"w")
- file.writeLine(ShortcutName)
- file.writeLine(FilePath)
- file.writeLine(ShortcutImage)
- file.writeLine(ShortcutType)
- file.close()
- end
- function Panel()
- GetFile()
- term.setBackgroundColor(colors.lightBlue)
- Clear()
- print("[x] file properties")
- print("[",FilePath,"]")
- term.setCursorPos(1,3)
- print("Shortcut : ",ShortcutType)
- term.setCursorPos(1,4)
- print("Name : ",ShortcutName)
- term.setCursorPos(1,5)
- print("Image : ",ShortcutName)
- term.setCursorPos(1,6)
- print("===Other===")
- end
- function Inter()
- while true do
- local a, b, c, d = os.pullEvent("mouse_click")
- if c < 4 and d == 1 then break end
- if d == 3 then EditItem("Type") end
- if d == 4 then EditItem("Name") end
- if d == 5 then EditItem("Image") end
- Panel()
- end
- end
- Panel()
- Inter()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement