Posted 30 October 2012 - 04:08 PM
Hi guys I'm wondering how / if you can make other computers run commands over rednet.
while true do
event = os.pullEvent("rednet_message")
if event then
id, msg, dist = rednet.recieve()
if fs.exists(msg) then
shell.run(msg)
else
return nil, "File does not exist!"
end
end
end
Thanks !while true do event = os.pullEvent("rednet_message") if event then id, msg, dist = rednet.recieve() if fs.exists(msg) then shell.run(msg) else return nil, "File does not exist!" end
id, msg, dist = rednet.recieve()
local t_param,ndx = {},1
for v in params:gmatch("%w+") do tprm[ndx] = v ndx = ndx+1 end
if fs.exists(t_param[1]) then
shell.run(unpack(t_param))
return t_param[1].." executed"
else --whatever you want to say
end
Ok thanks for the help!You'll want to strip off (and repackage) any command line parameters too. So:id, msg, dist = rednet.recieve() local t_param,ndx = {},1 for v in params:gmatch("%w+") do tprm[ndx] = v ndx = ndx+1 end if fs.exists(t_param[1]) then shell.run(unpack(t_param)) return t_param[1].." executed" else --whatever you want to say end