znepb

cctool.lua

Jun 12th, 2021
766
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.     ------------------------- READ ME -------------------------
  3.  
  4.     WARNING: THIS IS INTENDED TO BE USED AS A TOOL TO RUN LOTS
  5.     OF COMMANDS ON A COMPUTER QUICKLY WITH EASE. DO NOT PUT
  6.     THIS ON ANOTHER PERSON'S COMPUTER WITHOUT THEIR PERMISSION.
  7.     IF YOU GET BANNED OR SCREW UP SOMETHING REALLY BAD,
  8.     I AM NOT RESPONSIBLE. I WARNED YOU.
  9.  
  10.     Warning out of the way, this is meant to be a tool. You
  11.     can also use this as a virus if you wish, but this was
  12.     made to be a tool. Basicly, use it however you'd like.
  13.     Just don't get yourself into trouble.
  14.  
  15.     AGAIN: PLEASE DO NOT RUN THIS ON ANOTHER PERSONS COMPUTER
  16.     WITHOUT THEIR PERMISSION! THIS WILL MOST LIKELY GET YOU
  17.     BANNED ON THE SERVER YOU'RE PLAYING ON!
  18.  
  19.     ------------------------- READ ME -------------------------
  20. ]]
  21.  
  22. local lines = {
  23.   "edit file.txt",
  24.   "This an example of what this program code can do.",
  25.   "Please read the read me at the top of the file.",
  26.   "Seriously.",
  27.   "^s"
  28. }
  29.  
  30. local keyWaitTime = 0.1
  31.  
  32. parallel.waitForAll(function()
  33.   shell.run("shell")
  34. end, function()
  35.   for i, v in pairs(lines) do
  36.     local ignoreNext = false
  37.  
  38.     for i = 1, #v do
  39.       local c = v:sub(i, i)
  40.  
  41.       if ignoreNext == false then
  42.         if c == "^" then
  43.           os.queueEvent("key", 341, false)
  44.           sleep(keyWaitTime)
  45.           os.queueEvent("key_up", 341)
  46.  
  47.           os.queueEvent("char", v:sub(i + 1, i + 1))
  48.  
  49.           ignoreNext = true
  50.         else
  51.           os.queueEvent("char", c)
  52.         end
  53.       end
  54.  
  55.       ignoreNext = false
  56.  
  57.       sleep(keyWaitTime)
  58.     end
  59.     os.queueEvent("key", keys.enter)
  60.   end
  61. end)
RAW Paste Data