Jump to content




CC-copy -- Your solution to servers without HTTP API



40 replies to this topic

#1 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 09 October 2012 - 02:00 PM

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



#2 TehSomeLuigi

  • Members
  • 70 posts

Posted 09 October 2012 - 06:36 PM

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

#3 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 10 October 2012 - 12:04 AM

 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.

#4 gknova61

  • Members
  • 74 posts

Posted 16 October 2012 - 07:51 AM

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

#5 CoolisTheName007

  • Members
  • 304 posts

Posted 16 October 2012 - 08:55 AM

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



#6 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 20 October 2012 - 08:53 PM

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?

#7 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 20 October 2012 - 09:59 PM

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. : )

#8 Cruor

  • Members
  • 413 posts
  • LocationNorway

Posted 24 October 2012 - 06:07 PM

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.

#9 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 24 October 2012 - 08:44 PM

 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. : )

#10 Naab007

  • Members
  • 6 posts

Posted 08 November 2012 - 09:18 PM

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

#11 CoolisTheName007

  • Members
  • 304 posts

Posted 12 November 2012 - 09:45 AM

 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.

#12 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 14 November 2012 - 11:28 AM

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.

#13 MemoryLeak21

  • Members
  • 30 posts

Posted 08 December 2012 - 12:54 PM

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.

#14 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 11 December 2012 - 07:03 PM

 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?

#15 da404lewzer

  • New Members
  • 31 posts

Posted 11 December 2012 - 10:05 PM

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!

#16 MemoryLeak21

  • Members
  • 30 posts

Posted 12 December 2012 - 04:29 AM

I currently use Windows 7.

#17 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 12 December 2012 - 06:45 PM

 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.

#18 Kingston

  • New Members
  • 4 posts

Posted 17 December 2012 - 02:54 AM

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

#19 dissy

  • Members
  • 181 posts

Posted 17 December 2012 - 03:24 AM

 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

#20 Kingston

  • New Members
  • 4 posts

Posted 17 December 2012 - 03:39 AM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users