Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- load function for LEOS (LEOS is made by mikesch96 and evoliprofi and EuroCreeper)
- function downloadmenue(option,x,y)
- term.clear()
- term.setCursorPos(x,y)
- ret = nil
- if option == 1 then
- print ("->rootreader")
- ret = nil
- else
- print (" rootreader")
- end
- term.setCursorPos(x,y+1)
- if option == 2 then
- print ("->LEOS installer")
- ret = nil
- else
- print (" LEOS installer")
- end
- term.setCursorPos(x,y+2)
- if option == 3 then
- print ("->RC_Drone")
- ret = "http://dl.dropboxusercontent.com/u/25121005/RC_Drone.txt"
- else
- print (" RC_Drone")
- end
- term.setCursorPos(x,y+3)
- if option == 4 then
- print ("->RC_Computer")
- ret = "http://dl.dropboxusercontent.com/u/25121005/RC_Computer.txt"
- else
- print (" RC_Computer")
- end
- return ret
- end
- function rundownloadmenue()
- term.clear()
- print("make your selection and then hit return/enter")
- running = true
- option = 1
- while running do
- ret = downloadmenue(option,20,6)
- e,key = os.pullEvent( "key" )
- if key == 208 then
- if option > 3 then
- option = 1
- else
- option = option + 1
- end
- elseif key == 200 then
- if option < 2 then
- option = 4
- else
- option = option - 1
- end
- elseif key == 28 then
- running = false
- end
- end
- print("selection will be used")
- return ret
- end
- -- run the downloader
- print("type filename:")
- local filename = read()
- if filename == "+" then
- print ("type filename again:")
- local filename = read()
- print ("wich data you want to download?")
- local path = rundownloadmenue()
- if path == nil then
- print ("no path given for this programm yet")
- else
- local url = http.get(path)
- f = fs.open(filename, "w")
- f.write(url.readAll())
- f.close()
- print("Downloaded")
- end
- else -- when a normal filename was typed run this
- print("type url here:")
- local url = http.get(read())
- f = fs.open(filename, "w")
- f.write(url.readAll())
- f.close()
- print("Downloaded")
- end
Add Comment
Please, Sign In to add comment