9 posts
Posted 22 November 2015 - 07:25 AM
I am making an program so I can chat wireless which is going fine, but i don't know how to use pastebin in code. So if i run the installer it will download some stuff from pastebin.
(Everything is enabled on the server, because i am the owner),
Here's my code
if fs.exists("System/Initialate") == true then
print("Booting")
shell.run("monitor","top","Initialate")
else
if fs.exists("InstallWizard") == true then
else
print("FILES CORRUPTED. DOWNLOADING INSTALLWIZARD")
-- Insert pastebin code here --
end
end
2679 posts
Location
You will never find me, muhahahahahaha
Posted 22 November 2015 - 08:02 AM
You basically access pastebin through the shell. If you want to download a flie, simply call shell.run with the arguments you'd pass to the shell when you wan to t download a file:
shell.run("pastebin get <code> <path>")
shell.run("pastebin run <code>")
7083 posts
Location
Tasmania (AU)
Posted 22 November 2015 - 08:09 AM
You also have the option of using the
http API to get the data within your own code - review the
pastebin script's source for an example.
However, I myself usually use the pastebin script via shell.run() when I want something downloaded. The main difference in doing it yourself is that you can skip the "Connecting to pastebin.com… " messages.
Edited on 22 November 2015 - 07:09 AM
9 posts
Posted 22 November 2015 - 11:33 AM
You basically access pastebin through the shell. If you want to download a flie, simply call shell.run with the arguments you'd pass to the shell when you wan to t download a file:
shell.run("pastebin get <code> <path>")
shell.run("pastebin run <code>")
You also have the option of using the
http API to get the data within your own code - review the
pastebin script's source for an example.
However, I myself usually use the pastebin script via shell.run() when I want something downloaded. The main difference in doing it yourself is that you can skip the "Connecting to pastebin.com… " messages.
Thanks everyone! I'll upload my program and paste a link here when it is finishd :)/>
1852 posts
Location
Sweden
Posted 22 November 2015 - 01:02 PM
If you want to use it I've made a pastebin API based on the original code, you can find it here
http://pastebin.com/hbHHH9UXExample usages
os.loadAPI( "Pastebin" )
Pastebin.get( "path/to/file", "somecode" ) --# Download a file
Pastebin.put( "path/to/file", "Upload test" ) --# Upload a file with the title "Upload test"