←  APIs and Utilities

ComputerCraft | Programmable Computers for Minecraft

»

CC-copy -- Your solution to servers withou...

Orwell's Photo Orwell 09 Oct 2012

Hi all!

After having some positive responses on my program in this thread and receiving some PM's about it, I decided to enhance it a bit and give it it's own thread on the forums.
The program reads text files (typically lua programs) and 'types' it over to the Minecraft window. You should have the Minecraft window open and have a ComputerCraft terminal open in there.
This is written in C++ and is windows only, I'm not planning on porting it to linux or mac. Both source code and binary are available as an attachment to this thread.

CC-copy is a command line program. If you don't know how to use it (for example, if you just double click it and it closes right away), ask here for help. I don't have the energy for explaining that anymore though. :P/> Someone else might. Usage is as follows:
CC-copy [-w <window>] [-t <interval>] [-s <startup>] [--old] file1 file2 ...

  <window> is the title of the Minecraft window. (Typically 'Minecraft' or 'Tekkit')
  <interval> is the time between key presses in milliseconds.
  <startup> is the time that the program waits after switching to the Minecraft window (in milliseconds).
  use  the parameter '--old' if you use ComputerCraft version 1.33 or lower! If you don't, text will be screwed.

If you find some bugs or have some suggestions, let me know in this thread. :)/>

UPDATE: CC-copy keeps indentation intact now!

PS: I didn't do the fancy titles and pictures, it's just a simple utility. Use it if you need it. ;)/>

Attached Files

Quote

TehSomeLuigi's Photo TehSomeLuigi 09 Oct 2012

I need something like this but *no linux* sadface. I'll probably write a simple program for this though.
Quote

Orwell's Photo Orwell 10 Oct 2012

 TehSomeLuigi, on 09 October 2012 - 06:36 PM, said:

I need something like this but *no linux* sadface. I'll probably write a simple program for this though.

I'm working on a Linux version after all. I'm trying to do this without making the code messy. : )
I also updated the program to keep the formatting of the code (mostly indentation, both tabs and spaces). This works for both CC 1.32 as CC 1.43.
Quote

gknova61's Photo gknova61 16 Oct 2012

Would it be possible for you to add a terminate key we can press when in CMD?
Quote

CoolisTheName007's Photo CoolisTheName007 16 Oct 2012

Hello Orwell, I just tested your second version and carriage returns aren't being written, making the behavior of erasing previous tabs on the new line erase part of the program.
EDIT: to clarify, when editing in Notepad++, pressing return ® conserves the indentation, eg. copies the tabs from the current line to the new line. Your script seems to be skipping the new line + copying tabs process, and jumps directly to the clean the previous line tabs, and write the new line tabs.

Your original script does get files with (no tabs in the file) correctly typed, except in case of a slightly less than ideal connection, in which it misses or 'jams' characters, typing them in no particular order.
In that case, only increasing the delay between keystrokes solves the issue, and that's only possible with your second version.

To put it simply, none of the versions will work for me.
I've attached a sample file I copied, test, and the copies made by your scripts, test_copied_version1 using your first script and test_copied_version2 using the newer one.

I also verified that these 2 characters are ignored : ´ç
But that's a minor issue compared with the previous one.

PS: I also made a very basic computercraft program to check whether or not two files match, that prints the locations of the mismatches, typechecker.txt , which I attached. Usage is typechecker fileA fileB

Attached Files

Quote

Orwell's Photo Orwell 20 Oct 2012

Thank you CoolisTheName007 for the extensive testing. What version of ComputerCraft are you using? For all versions from 1.41 up to now, everything seems to work just fine. Except for the '^' (it needs a space afterwards, easily fixed). ç actually works too. only ´ doesn't work cause it's not supported by CC (it's not in the 7-bit ASCII set) :)/> are you using version 1.31?
Quote

Orwell's Photo Orwell 20 Oct 2012

I'm quite certain you use CC 1.33 or lower (Tekkit?). I've identified the bugs in that version, they can't be handled in a way that still works for the newer versions of CC. So I've added the command line parameter '--old' for the people using version 1.33 or lower. The OP has been updated with the new version. I wanna thank you again for posting the elaborate bug report and tests, it really helps me out. Please post any more feedback or bug reports if you have some. : )
Quote

Cruor's Photo Cruor 24 Oct 2012

This looks more like a utility to me, would you like for it to be moved over to that section? Quote this post or send me a pm if you do ^_^/>

Edit: oh, didnt see that it was you who reported that, either way, the option is still yours.
Quote

Orwell's Photo Orwell 24 Oct 2012

 Cruor, on 24 October 2012 - 06:07 PM, said:

This looks more like a utility to me, would you like for it to be moved over to that section? Quote this post or send me a pm if you do ^_^/>

Edit: oh, didnt see that it was you who reported that, either way, the option is still yours.

Yes, if you agree that it's place is in the utility section, then I'd like this thread to be moved there. : )
Quote

Naab007's Photo Naab007 08 Nov 2012

Nice app, Now i just have to find a C++ compiler.. what would you recommend?
Quote

CoolisTheName007's Photo CoolisTheName007 12 Nov 2012

 Naab007, on 08 November 2012 - 09:18 PM, said:

Nice app, Now i just have to find a C++ compiler.. what would you recommend?
Are you going to change the program? Cause you don't need a compiler to run it.
Quote

Orwell's Photo Orwell 14 Nov 2012

You can just download the cc-copy_bin.zip package and run the cc-copy.exe file in it from command line. If you still want to compile it for some reason, I used Dev-C++ and the MinGW32 compiler to compile the sources.
Quote

MemoryLeak21's Photo MemoryLeak21 08 Dec 2012

I hate to do this, but... How do I run the program from command line? I've tried researching it and have gotten... Well, zilch.
Quote

Dlcruz129's Photo Dlcruz129 11 Dec 2012

 MemoryLeak21, on 08 December 2012 - 12:54 PM, said:

I hate to do this, but... How do I run the program from command line? I've tried researching it and have gotten... Well, zilch.
What operating system do you use?
Quote

da404lewzer's Photo da404lewzer 11 Dec 2012

Hey, nice app :D

I would love you long time if you added direct support for the turtlescript market api :rolleyes:

I'd even throw a link somewhere to let people know it's another way to get their scripts downloaded!
Quote

MemoryLeak21's Photo MemoryLeak21 12 Dec 2012

I currently use Windows 7.
Quote

Dlcruz129's Photo Dlcruz129 12 Dec 2012

 MemoryLeak21, on 12 December 2012 - 04:29 AM, said:

I currently use Windows 7.

K. Easy.
Press Start-R and type cmd.
Drag the program into the window (as if you were moving it into a folder)
It should display C:/Users/Name/...
Add the arguments to the end
Press enter.
Quote

Kingston's Photo Kingston 17 Dec 2012

Good evening, comrades.

I'm going nuts trying to copy a code with 104 lines on Tekkit, but whenever I use CC-copy it says SYSTEM COULDN'T FIND THE SPECIFIED FILE in which I've written the code.

How should I add that parameter?

I'm using

C:\Users\ads>C:\Users\ads\Desktop\cc-copy_bin\CC-copy.exe [-w <Tekkit>] [-t <0.3>] [-s <4000>] chat.lua
Quote

dissy's Photo dissy 17 Dec 2012

 Kingston, on 17 December 2012 - 02:54 AM, said:

Good evening, comrades.

I'm going nuts trying to copy a code with 104 lines on Tekkit, but whenever I use CC-copy it says SYSTEM COULDN'T FIND THE SPECIFIED FILE in which I've written the code.

How should I add that parameter?

I'm using

C:\Users\ads>C:\Users\ads\Desktop\cc-copy_bin\CC-copy.exe [-w <Tekkit>] [-t <0.3>] [-s <4000>] chat.lua

Square brackets ][ mean something is optional and can be left out.
Angle breakets >< mean something is required and must be typed.
The actual brackets should not be included, only the value it represents.

For example, [-w <window-name>] means everything between square brackets is optional, but if you DO include the -w option, the window name is now required

You want:
C:\Users\ads\Desktop\cc-copy_bin\CC-copy.exe -w Tekkit -t 0.3 -s 4000 chat.lua
Quote

Kingston's Photo Kingston 17 Dec 2012

It still can't find the specified file. Are you sure it must be a .lua?
Quote