Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[Auto Downloader v1.0 by Spiker985]]--
- --[[Edit]]--
- local mon = peripheral.wrap("right")
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.black)
- mon.setTextScale(1)
- local program1Names = {"ModularManager", "MM", "TaskManager", "TM"}
- local program1Reference = "Modular_Manager"
- local program1Code = "SibWgs68"
- local program2Names = {"ModularTerminal", "MT", "TerminalGlasses"}
- local program2Reference = "Modular_Terminal"
- local program2Code = "F5Q5mFxb"
- --[[Edit]]--
- --[[Don't edit anything below this]]--
- tArgs = {...}
- mon.clear()
- mon.setCursorPos(1,1)
- function pastebinDownloader(apiName, apiPastebin)
- shell.run("pastebin","get",apiPastebin,apiName)
- end
- if #tArgs <= 0 or #tArgs > 1 then
- mon.clear()
- mon.setCursorPos(2,2)
- mon.write("ERROR, invalid number of arguments")
- mon.setCursorPos(2,3)
- mon.write("Number of arguments: 1")
- end
- if #tArgs == 1 then
- mon.clear()
- for i = 1, #program1Names + #program2Names do
- if tArgs[1] == program1Names[i] then
- if fs.exists(program1Reference) then
- mon.clear()
- mon.setCursorPos(2,2)
- mon.write("ERROR - File exists")
- sleep(2)
- elseif fs.exists(program1Reference) == false then
- mon.clear()
- mon.setCursorPos(2,2)
- mon.write("Status - Downloading")
- pastebinDownloader(program1Reference, program1Code)
- sleep(1)
- mon.setCursorPos(2,3)
- mon.write("Download complete!")
- sleep(1)
- mon.setCursorPos(2,4)
- mon.write("Saved as "..program1Reference)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- return
- end
- end
- if tArgs[1] == program2Names[i] then
- if fs.exists(program2Reference) then
- mon.clear()
- mon.setCursorPos(2,2)
- mon.write("ERROR - File exists")
- sleep(2)
- elseif fs.exists(program2Reference) == false then
- mon.clear()
- mon.setCursorPos(2,2)
- mon.write("Status - Downloading")
- pastebinDownloader(program2Reference, program2Code)
- sleep(1)
- mon.setCursorPos(2,3)
- mon.write("Download complete!")
- sleep(1)
- mon.setCursorPos(2,4)
- mon.write("Saved as "..program2Reference)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- return
- end
- end
- end
- end
- for i = 1, #program1Names + #program2Names do
- if tArgs[1] == program1Names[i] or tArgs[1] == program2Names[i] then
- return
- else
- mon.clear()
- mon.setCursorPos(2,2)
- mon.write(tArgs[1].." is not a valid command")
- end
- end
- term.clear()
- term.setCursorPos(1,1)
Add Comment
Please, Sign In to add comment