Jump to content




Minecopy V2 [Linux][Windows]



30 replies to this topic

#1 kazagistar

  • Members
  • 365 posts

Posted 03 June 2012 - 11:10 PM

Kazagistar's Computercraft Minecopy V2

Download Here

Ever get annoyed that you can't transfer your programs to a server that has HTTP disabled? Do you get annoyed when you have to type the same stuff into multiple computers? Want to code with a REAL text editor, and play SMP too? The solution is here!

Just open your minecraft and log in to a computercraft shell, then run the script with a list of files as parameters. Sit back and relax as it reads in the files, compresses them automagically, and rapidly types them into your minecraft window, saving them.

Notes: This program is buggy as hell. Make sure you call it from the same directory as the .lua files you want to transfer, because it will try to preserve relative file locations. If the text comes out with mistakes, slow down the keystrokes. If you want to be able to debug your code, disable compression. THE PROGRAM WILL RAPIDLY VOMIT KEYSTROKES INTO WHATEVER APPLICATION HAS FOCUS! IF YOU HAVE ANYTHING OTHER THEN MINECRAFT FOCUSED, IT WILL GET HAMMERED WITH LUA COMMANDS! YOU HAVE BEEN WARNED!

Enjoy, and please send me any questions you have, or patches you make to the code!


Linux requirements:
- Python 2.7
- libxdo
- lua [OPTIONAL: needed for lua file compression]

No links, this shit is trivial to install with a package manager on any distro. Once you have all the prerequesites, you should be able to just run the script.


Windows requirements:
- Python 2.7
http://www.python.org/download/
- pywin32 [OPTIONAL: needed for automatic window switching]
http://sourceforge.n.../pywin32/files/
- lua [OPTIONAL: needed for lua file compression]
http://code.google.c.../luaforwindows/

Windows is a little stupid when it comes to command line stuff like python. Go to My Computer>Properties>Advanced>Environment Variables, edit the PATH variable, and add to the end of it ";C:\Python27". Then you should be able to run the script doing something like: "> python scriptfolder/minecopy/minecopy.py luafolder/script1.lua luafolder/script2.lua"

#2 kazagistar

  • Members
  • 365 posts

Posted 03 June 2012 - 11:31 PM

Oh, and on I side note, here are some features I have been considering adding:

1) Configuration options outside of the script (to configure it currently, you have to edit the first couple lines of minecopy.py, bleh)
2) Support for Macs (so I can goof off at work in my lab)
3) Command line options and flags, for example, to disable lua compression on specific files, like data files.

#3 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 04 June 2012 - 11:59 AM

Nice and clean. : ) and handy for sure.

I was inspired by the concept, but I don't really like external dependencies on Windows (python, pywin32 :)/> ), so I quickly coded the same in c++ using only the windows api. It's Windows only (porting to Linux would practically mean rewriting the program ^^) and it doesn't support Lua compression. The code's much shorter though. : )
I don't think I'm posting it though, no need to interfere with your magnificent work. ;)/>

I also want to encourage you to expand it further, I don't plan on adding any more features to mine.
It would be especially handy to have some sort of 'config file'/package thingy that copies a set of files with directory structure, api's, startup files and everything to CC in one command. :D/>

#4 kazagistar

  • Members
  • 365 posts

Posted 04 June 2012 - 04:26 PM

Oh no, I realized during the project that python was the wrong choice of language, since most of what I was doing is making calls to the native API. Also I made it for linux originally, and yes "porting" it to windows required a full rewrite of most of it. I would be very interested in seeing your native version, and if you let me, might work off of it in the future, as I dislike dependancies as much as the next bloke, and lowering them might encourage more people to actually use it :)/>

#5 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 04 June 2012 - 09:19 PM

All right then, my program and source file are in the attachment. Anyone can change it however they like and distribute it in any way. On condition of course, that I'm credited under the name Orwell in source code (if distributed) and readme/description.

Kazagistar, you seem motivated to expand your and mine project further on, so I would definitely like you to work off of it in the future. :D/> c++ really is the wise choice here. :)/>

If you have any questions about my (uncommented) source code, PM me. Or better, ask your questions here so everyone can benefit from it. ;)/>

[EDIT]
Source code is also in this spoiler for quick access:
Spoiler


#6 Leo Verto

  • Members
  • 620 posts
  • LocationOver there

Posted 09 June 2012 - 12:32 PM

Just noticed you don't use window_name at all and just use 'Minecraft' as the window name.
So although I have set window_name to 'Tekkit', it would try to type into Minecraft.

I replaced shell.AppActivate('Minecraft') with shell.AppActivate(window_name) so it should work.
I hope Python uses variables like this...

#7 kazagistar

  • Members
  • 365 posts

Posted 10 June 2012 - 01:50 AM

View PostLeo Verto, on 09 June 2012 - 12:32 PM, said:

Just noticed you don't use window_name at all and just use 'Minecraft' as the window name.
So although I have set window_name to 'Tekkit', it would try to type into Minecraft.

I replaced shell.AppActivate('Minecraft') with shell.AppActivate(window_name) so it should work.
I hope Python uses variables like this...
Heh good catch, sorry about that. Yeah, python is similar to lua in a lot of ways and they are both pretty easy to learn,python is just, um, better usually. But Lua is far far easier to embed, hence the choice of language.

#8 Hexicube

  • New Members
  • 30 posts
  • LocationThe moon

Posted 10 June 2012 - 10:07 AM

I think I made something similar in java not too long ago, except it's purpose was to near silently hack a word game my friend made...fun times we have! :)/>
I would suggest actually using java to do it, as people using it are guaranteed to hava java...

#9 kazagistar

  • Members
  • 365 posts

Posted 10 June 2012 - 05:56 PM

Yeah, I totally missed the existence of java.awt.Robot somehow, thanks for pointing that out, better get cracking! Unfortunately, I can't figure out how to automatically switch window focus, and/or send commands to a specific window in java... delay method only.

#10 ryan7136

  • New Members
  • 1 posts

Posted 09 July 2012 - 07:06 AM

when i run, i get the following error:

ryanf@Fahy-ThinkCentre-A52:~/Downloads/minecopy$ python minecopy.py startup
Select minecraft window manually and make sure a computercraft terminal is open!
You have 10 seconds or bad things will happen!!!
Traceback (most recent call last):
File "minecopy.py", line 96, in <module>
copyfile(filename)
File "minecopy.py", line 83, in copyfile
typeout("rm "+filename+"nedit "+filename+"n")
File "minecopy.py", line 33, in typeout
xdo.xdo_type(xdo_context, 0, string, key_press_delay*1000000) # microseconds
ctypes.ArgumentError: argument 4: <type 'exceptions.TypeError'>: Don't know how to convert parameter 4
ryanf@Fahy-ThinkCentre-A52:~/Downloads/minecopy$



Any Help? Im on ubuntu


edit :
nvm, fixed by adding line

from ctypes import *
now CC forums, im not so clueless

Edited by ryan7136, 09 July 2012 - 11:31 PM.


#11 Tristan

  • New Members
  • 10 posts

Posted 11 July 2012 - 12:48 AM

I don't understand how to use this, tutorial?

#12 Snowz

  • New Members
  • 4 posts

Posted 17 August 2012 - 07:54 AM

What if i use tekkit? It will work on minecraft, but not tekkit.

#13 mad-murdock

  • Members
  • 29 posts

Posted 18 August 2012 - 03:31 PM

tip: if possible, prefer ssh+vim or sftp
just saying...

#14 FuzzyPurp

    Part-Time Ninja

  • Members
  • 510 posts
  • LocationHarlem, NY

Posted 03 September 2012 - 08:46 PM

Moved to API's & Utilities.

#15 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 17 September 2012 - 02:34 PM

Do either of these work for Tekkit? I'm on a Tekkit server with HTTP disabled. I would love to make sure either works before downloading.

#16 etopsirhc

  • Members
  • 122 posts

Posted 17 September 2012 - 09:37 PM

its set up to try and switch to any window named minecraft , but if it cant find any ( cause your using tekkit ) you can manualy focus that window cause theirs a 10 sec delay before it will start spewing text

#17 tdlab

  • Members
  • 17 posts

Posted 25 September 2012 - 11:13 AM

View PostOrwell, on 04 June 2012 - 09:19 PM, said:

All right then, my program and source file are in the attachment. Anyone can change it however they like and distribute it in any way. On condition of course, that I'm credited under the name Orwell in source code (if distributed) and readme/description.

Kazagistar, you seem motivated to expand your and mine project further on, so I would definitely like you to work off of it in the future. ;)/> c++ really is the wise choice here. :P/>

If you have any questions about my (uncommented) source code, PM me. Or better, ask your questions here so everyone can benefit from it. :D/>

[EDIT]
Source code is also in this spoiler for quick access:
Spoiler
Hey orwell, I really wanted to use this program. I downloaded it and tried to open it, but when i do it closes. I opened the .exe and then it closes - It was a cmd type prompt? Please reply.

#18 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 26 September 2012 - 10:35 AM

View Posttdlab, on 25 September 2012 - 11:13 AM, said:

View PostOrwell, on 04 June 2012 - 09:19 PM, said:

All right then, my program and source file are in the attachment. Anyone can change it however they like and distribute it in any way. On condition of course, that I'm credited under the name Orwell in source code (if distributed) and readme/description.

Kazagistar, you seem motivated to expand your and mine project further on, so I would definitely like you to work off of it in the future. :D/> c++ really is the wise choice here. :P/>

If you have any questions about my (uncommented) source code, PM me. Or better, ask your questions here so everyone can benefit from it. :)/>

[EDIT]
Source code is also in this spoiler for quick access:
Spoiler
Hey orwell, I really wanted to use this program. I downloaded it and tried to open it, but when i do it closes. I opened the .exe and then it closes - It was a cmd type prompt? Please reply.

Indeed, you need to run it from command prompt. Make sure you're in the directory where my program is stored and then run 'cc-typer filename'.
I put a version up for Tekkit as an attachment.

#19 tdlab

  • Members
  • 17 posts

Posted 27 September 2012 - 12:15 AM

I tried it today, it wasnt working. I dont really know what u mean by runing 'cctyper filename'?
Could you make a video/ tutorial on how it works? I made a folder in my downloads called "Cc auto typer" In there i have the cc-typer.exe and a test.txt, When i open the exe, it automatically closes. I dont know why? Please reply, ~Tdlab.
Thanks again!

#20 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 27 September 2012 - 12:55 PM

You can't just run the program by double clicking. It's a command line program. Read the steps I pm'ed you carefully once again. You need to start by pressing 'the Windows key + R'. The run window will open, there you need to type 'cmd' and press enter. Now you're in the command prompt. From there, do 'cd C:blabla'. And finally do 'cc-typer test.txt'. It's just like the promp in CC...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users