rs = http.get("http://www.google.com/) --This line downloads the file
This is not a good thing to do especially since you did not make it a local. It will overwrite the rs api. So if you do:
rs.setBundledOutput("back", colors.white)
Or something a long those lines it would try to run:
http.get("http://www.google.com/).setBundledOutput("back", colors.white)
And error…
To the OP:
Its real simple. You can either use a function or use shell.run() to run the pastebin program and download the code. Here is an example with a function:
function Pastebin( sCode, sPath )
local response = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode( sCode ))
if response then
local sResponse = response.readAll()
response.close()
local file = fs.open( sPath, "w" )
file.write( sResponse )
file.close()
end
end
if not fs.exists("filename") then
Pastebin("pasteBinCode","filename")
end
Even easier use shell.run() although personally I prefer the function:
if not fs.exists("filname") then
shell.run("pastebin","get","pasteBinCode","filename")
end
You can add a menu to it, uninstall options, update options, etc…