Advertisement
OldDragon2A

Upload ComputerCraft Program

Dec 15th, 2012
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. #!/usr/bin/python
  2. import time,sys
  3. from ctypes import *
  4. from os import basename
  5. key_press_delay = 5000
  6. editor_wait_delay = 0.2
  7. xdo=cdll.LoadLibrary("libxdo.so.2")
  8. xdo_context=xdo.xdo_new(None)
  9. def typeout(string):
  10.   xdo.xdo_type(xdo_context, 0, string, key_press_delay)
  11. def typekeys(keysyms):
  12.   for key in keysyms:
  13.     xdo.xdo_keysequence(xdo_context, 0, key, key_press_delay)
  14.     time.sleep(editor_wait_delay)
  15. def copyfile(filename):
  16.   f = open(filename)
  17.   filename = basename(filename)
  18.   data = f.read()
  19.   typeout("rm "+filename+"\nedit "+filename+"\n")
  20.   time.sleep(editor_wait_delay)
  21.   typeout(data)
  22.   typekeys(["ctrl","Return","ctrl","Left","Return"])
  23. if __name__ == "__main__":
  24.   print "Select minecraft window now!"
  25.   time.sleep(5)
  26.   for filename in sys.argv[1:]:
  27.     copyfile(filename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement