36 posts
Posted 02 October 2013 - 09:36 PM
Hi I'm trying to make a insulation program so that if someone want to download my os they can by downloading 1 program. Ok like if you have a insulation and you run it the program will go to pastebin and get programs.
EX.
(You have make a program and you are in the text editor)
pastebin get Pizza HAKIkdj
(So that would be in the code. So wen you run the program, it goes to pastebin and gets the program)
I was just wandering wat i put in the code editor aka the program script to make wats above possible
I hope that made sense. If this didn't then send a comment and ill try to explain it.
Thanks For reading
8543 posts
Posted 02 October 2013 - 10:27 PM
You use a simple shell.run command if all you want to do is run the pastebin program. You've got your arguments in the wrong order (paste ID goes before filename), so you'd use this lua code:
shell.run("pastebin get HAKIkdj Pizza")
375 posts
Location
USA
Posted 02 October 2013 - 11:28 PM
You use a simple shell.run command if all you want to do is run the pastebin program. You've got your arguments in the wrong order (paste ID goes before filename), so you'd use this lua code:
shell.run("pastebin get HAKIkdj Pizza")
You don't give it the shell line string, you give it the program path, followed by separate args for each actual program arg.
162 posts
Posted 02 October 2013 - 11:47 PM
-posted as new topic-
331 posts
Posted 03 October 2013 - 12:16 AM
You use a simple shell.run command if all you want to do is run the pastebin program. You've got your arguments in the wrong order (paste ID goes before filename), so you'd use this lua code:
shell.run("pastebin get HAKIkdj Pizza")
this would work perfectly fine same,as
shell.run("pastebin","get",code,name)
'pastebin get HAKIkdj Pizza' is essentially what you would type into normal terminal, passing it this string which is then used like shell.run(your input)
8543 posts
Posted 03 October 2013 - 10:28 AM
You use a simple shell.run command if all you want to do is run the pastebin program. You've got your arguments in the wrong order (paste ID goes before filename), so you'd use this lua code:
shell.run("pastebin get HAKIkdj Pizza")
You don't give it the shell line string, you give it the program path, followed by separate args for each actual program arg.
That's no longer true. Either way, or any combination of the two will work in all the recent versions. It used to be that you had to separate out the arguments, but you can now pass the whole string.
375 posts
Location
USA
Posted 03 October 2013 - 04:11 PM
That's no longer true. Either way, or any combination of the two will work in all the recent versions. It used to be that you had to separate out the arguments, but you can now pass the whole string.
Ah, okay. I was going off of what the wiki says
here.
331 posts
Posted 03 October 2013 - 07:02 PM
it would logically make sense that shell.run() takes 1 string since in the shell you don't type out
'pastebin'
'get'
'mycodehere'
'pathtosaveto'
you pass it as 1 string 'pastebin get mycodehere pathtosaveto'
36 posts
Posted 05 October 2013 - 04:21 PM
Ok thanks to all of the people that responded. This helped a lot that is why i use this.
131 posts
Posted 05 October 2013 - 07:05 PM
A little late, but I just released a Pastebin API:
http://www.computercraft.info/forums2/index.php?/topic/15498-pastebin-api/It currently doesn't have a helper function for saving a file, but you could do this:
os.loadAPI("pastebin")
local rc4 = pastebin.get("Rxe673BJ")
assert(not string.find(rc4, "Bad"), "Pastebin error: " .. rc4)
local file = io.open("rc4", "w")
file:write(rc4)
file:close()