Jump to content




External file copier for linux


  • You cannot reply to this topic
5 replies to this topic

#1 kazagistar

  • Members
  • 365 posts

Posted 30 April 2012 - 09:33 PM

I didn't want to copy all my programs onto the turtles in the tekkit server by hand, and there is no way to transfer them to my server other then copying them in. So I made a simple python utility that copies them in place. You just have to run it with the list of files to transfer as a parameters, then select your minecraft game already opened to a computercraft terminal, and it will start typing (after a 5 second delay) and write them all in. Just dont select anything else while it is running (I will have it target a specific window once I can figure out how to do this). It requires libxdo to be installed, just apt-get install libxdo.
#!/usr/bin/python
import time,sys
from ctypes import *
key_press_delay = 5000
editor_wait_delay = 0.2
xdo=cdll.LoadLibrary("libxdo.so.2")
xdo_context=xdo.xdo_new(None)
def typeout(string):
	xdo.xdo_type(xdo_context, 0, string, key_press_delay)
def typekeys(keysyms):
	for key in keysyms:
xdo.xdo_keysequence(xdo_context, 0, key, key_press_delay)
time.sleep(editor_wait_delay)
def copyfile(filename):
	f = open(filename)
	data = f.read()
	typeout("rm "+filename+"\nedit "+filename+"\n")
	time.sleep(editor_wait_delay)
	typeout(data)
	typekeys(["ctrl","Return","ctrl","Left","Return"])
if __name__ == "__main__":
	print "Select minecraft window now!"
	time.sleep(5)
	for filename in sys.argv[1:]:
		copyfile(filename)


#2 Onionnion

    Lua Teacher

  • Members
  • 27 posts

Posted 30 April 2012 - 10:01 PM

Nice util!

#3 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 01 May 2012 - 03:02 AM

Since this is python with some slight modifications you could run this on a windows box as well. Very handy.

#4 kazagistar

  • Members
  • 365 posts

Posted 01 May 2012 - 07:46 AM

No, sorry, this would not run on windows at all. The command (xdo=cdll.LoadLibrary("libxdo.so.2")) loads a local C library into python called libxdo, which is specific to the X11 windowing system and is not cross-platform, and repacing it with something in windows would require replacing almost the whole program. I just don't want people to get confused, sorry.

#5 DrEckenbecker

  • New Members
  • 7 posts

Posted 04 May 2012 - 03:36 AM

Excellent program!

#6 atomhell

  • New Members
  • 6 posts

Posted 25 August 2012 - 03:09 PM

Yeah, I never realized how lucky I was to have filesystem access to the Tekkit server for file transfer.

Now I am playing on another server with no file access, and I have no idea how to push updates to the /rom/ folder without nagging the server owner...

I hope to find a web-based solution.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users