Jump to content




CC Autotyper [v3.0.1 WinFix] [HTTP Workaround][GUI]

java utility computer

25 replies to this topic

#1 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 25 December 2014 - 08:07 AM


CC Autotyper v3.0.1

M&P Final w/ Windows Fix


A Replacement to Mudkip Autotyper

Now with Pausing and Terminating Keybindings, AutoComplete, Minification and a GUI!


With the introduction of minification, I must thank Mathias Bynens for his wonderful luamin utility.

This Application Requires Java 8 or above. Windows versions are distributed with the Java SE 8 update 40 Runtime Environment. This is to allow for a cleaner, native-ish GUI and to allow access to the Nashorn Scripting Engine allowing leverage of JavaScript scripts.

The niche Autotyper program, completely re-written under a new brand. This program is currently entirely written in Java and JavaScript and operates around your Minecraft instance. Simply execute the program as desired and move to the Minecraft window, from there it will start type out the file it was given into the game!

It's quite simple to run anyway. Eventually I will throw in a batch script and shell script just for fun. When there is a GUI, the program will be available as an executable (for Windows and Unix) and will launch directly into a more friendly GUI. As of v2.0a this is via JavaFX providing a much more consistent and friendly user experience, although a Swing version is provided should JavaFX not be available.

Currently this is meant to produce functional programs, not readable programs. Therefore, comments and whitespace are mostly stripped out. Indenting I will look into adding back in. It's fast and has worked on the 3 programs I have tried so far:
  • Adavanced Calculator by Cranium
  • Milkshake GUI Proof Of Concept by lednerg
  • Bubbles! by KingofGamesYami
Download: GitHub Releases
Source : CCAutotyper GitHub
Changes : GitHub Changelog
Issues : GitHub Issues

Executable Shell Script (Unix) and Windows Executables Available. Follow the proceeding instructions for commandline execution.

How To:
java -jar ccautotyper.jar [file|url|paste|gui] <location> [-wait] [-inDelay]
// Usage available through:
java -jar ccautotyper.jar

// Example (20 ms Input Delay, 5 second Wait):
java -jar ccautotyper.jar paste JCR8YTww -inDelay 20 -wait 5
// or
java -jar ccautotyper.jar gui

As of v0.2a pressing alt + P will toggle pausing and alt +S will terminate the autotyper see release for details.

It is recommended you let the program go to completion, the Robot will continue to type once you leave the Window. I will see if I can do anything about that but it's difficult to listen for arbitrary keypresses outside of a Java GUI in Java. Looking for changes in Window Focus is unlikely but possible... But not without a GUI.



Parameter Descriptions:


The Required Parameters (In Specific Order):
[file|url|paste|gui] <location>

[flag|url|paste|gui] - Simply choose one of the 3 selections. File indicates a file will be given on the local file system. 'url' indicates a VALID URL will be given. 'paste' indicates a Pastebin Code will be given. Putting 'gui' does not require a location and should be the only argument.


<location> - This is dependent on the flag selection. For 'file' a Path is given (relative or absolute), for 'url' a valid URL is supplied (e.g. http://www.computercraft.info), for 'paste' a valid Pastebin code is given (i.e. JCR8YTww [Which is the 'Bubbles!' Program]).


The Optional Parameters (No Specific Order):

[-wait] - A flag to indicate how long the Autotyper should wait before parsing the file and typing.

Example: '-wait 5' will wait 5 seconds. [Default: 10]


[-inDelay] - A flag to indicate how long the Autotyper should wait between keypresses. In milliseconds. You might say "1 millisecond of couse!" but this does not always work if Minecraft is expriencing severe FPS and input lag. Minecraft is pretty good... I can run at 10 milliseconds but the default is 40 milliseconds. Which can be a while. [Default: 40]




Copyright 2014 Matthew Crocco under the GPL v3
What does this mean, you ask? Here is a TL;DR Legal Summary
But seriously, feel free to create derivatives of this work as long as you keep it Open Source and Free.




Technical Details will be found on GitHub for those interested when I get to it. It's unfortunate my super-fast Copy and Paste solution failed...

Any and All Issues or Requests should be posted on GitHub... but I will check here of course. :)

Most Recent Changes

Edited by MatthewC529, 19 July 2015 - 09:49 PM.


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 26 December 2014 - 11:35 PM

This is the correct location for this topic.

#3 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 27 December 2014 - 12:13 AM

View PostLyqyd, on 26 December 2014 - 11:35 PM, said:

This is the correct location for this topic.

Wasn't sure in which area it would be more useful.
This sub-forum may be overly specific to program developers while the intended audience is any user who needs a workaround. I only posted it here because the idea is a re-write/re-work of Mudkip's Autotyper in this same forum.

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 27 December 2014 - 12:52 AM

Yeah, this is the best area for external tools to be used to make working with CC programs easier. This is where emulator programs have historically been posted, for example. The Programs section itself should only have ComputerCraft programs posted in it.

#5 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 27 December 2014 - 04:53 AM

View PostLyqyd, on 27 December 2014 - 12:52 AM, said:

Yeah, this is the best area for external tools to be used to make working with CC programs easier. This is where emulator programs have historically been posted, for example. The Programs section itself should only have ComputerCraft programs posted in it.

Understood. Much appreciated. :)

#6 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 28 December 2014 - 12:45 AM

Just made a few important changes for v1.0a.
  • Brand New GUI (Will be refined further) that is available by using the Shell Script or Executable provided. Alternatively using the 'gui' flag.
  • Further retouching of the Autotyping speed and responsiveness to Keybindings.
  • Icons! Albeit temporary.
  • Executables, thanks to Bash and Launch4j
  • Lots of GUI Refinement.... Lots and lots of testing and simplification. Though "Location Memory" still needs to be implemented
Following through with the new Executables, there are now 2 files available per release (as of 1.0a):
  • CCAutotyper-{VERSION}-win32.exe (A Self-Extracting Archive with the Windows Executable)
  • CCAutotyper-{VERSION}.zip (Standard ZIP Archive including the Executable Bash Script. Does not include the Windows Executable.)
May split the Zip into Windows and Non-Windows Versions but that seems redundant.

#7 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 29 December 2014 - 01:26 AM

Nice! I didn't think anyone actually saw my Autotyper, let alone try to improve it! :ph34r:

#8 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 29 December 2014 - 02:49 AM

View PostMudkipTheEpic, on 29 December 2014 - 01:26 AM, said:

Nice! I didn't think anyone actually saw my Autotyper, let alone try to improve it! :ph34r:

It's a useful little thing! If you want even a super long program like Milkshake GUI you can even if HTTP Mode is off! Albeit with more time than pastebin get. I had offered a long time ago on your post to fix up some code and to add a GUI but then I got involved in other Java work. I have time due to the Holidays and decided to just re-write it since it's been a while (Hope that doesn't offend you!).

Currently I am looking at ways of using JNI to auto-focus the Minecraft Window and possibly detect when the window is not focused. But that is going to require a bit of time if I don't find a Cross-platform Native Library to do it for me. Though this program currently isn't just isolated to CC Programs. So I might end up figuring that it is self-limiting. We will see.

I was never very good at designing or implementing GUI's, much better at the functionality of the parts, but I think this is pretty good until I improve it. JNativeHooks was a life-saver to capture Global Key Press events.

Feel free to take a look at the source.

#9 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 02 January 2015 - 08:31 PM

Sizeable Update

v1.0a -> v1.2b (v1.2b was competing with other versions in-dev)

Summary:

This update finally implements many features that were on my To-Do List. Location History w/ AutoCompletion is now implemened, A Confirmation Dialog (which is optional) is included that is toggleable. Upon submitting a valid request a dialog will appear that will display the text in the File with the option to Approve or Reject and to switch between Syntax for non-CC files. Lua is selected by default. Generally Text Input Fields are improved with better Undo/Redo thanks to RSyntaxTextArea/RTextArea. The "i" button now leads to the GitHub Readme.


Change Log (Found on Github) :

Primary:
  • AutoComplete on Location using Ctrl + Space with a history size of 50 locations. Should be plenty.
  • Code Confirmation as an optional setting. Brings up a display with syntax highlighting to approve or reject.
  • Improved Undo/Redo Ability
  • Improved Text Components thanks to RSytanxTextArea and RTextArea as well as AutoComplete
Notable:
  • Information Button now leads to Github Readme Page via Default Browser
  • Pre-loads 3 Locations used in testing.
    • Bubbles! by KingofGamesYami
    • Milkshake GUI Proof of Concept by lednerg
    • Advanced Calculator by Cranium
Minor/Internal:
  • Inclusion of RSyntaxTextArea Library by Fifesoft
  • Inclusion of AutoComplete Library by Fifesoft
  • Improvements to MemoryUnit.java, adding conversions to and from SI Units and Non-SI Units as well as conversions between SI and Non-SI.
  • LocationHandler.URL now does the same HTTP Response check that LocationHandler.PASTE does.
  • System.out is now overridden to ignore any messages that just contain "Yo" which was prompted by RSyntaxTextArea not removing a Test Line. This should not impact Console calls.
  • Foundations for a JavaFX GUI Implementation

Edited by MatthewC529, 02 January 2015 - 08:32 PM.


#10 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 10 January 2015 - 05:07 AM

Update to v2.0a

Now uses JavaFX with even further refined autotyping.
See Changelog for details. See Github Commits for detailed list of line-by-line changes.

!!Resolves Issues #1 and #2 and #3 on GitHub, Fixes Fatal NullPointerException Crash when using GUI!!

Edited by MatthewC529, 10 January 2015 - 06:55 PM.


#11 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 30 March 2015 - 06:04 AM

It's been a while, and I don't know how useful this is but some things bother me and I need to polish them (lest I feel like I left a half-baked app), so unless this was rendered useless by something else. Here is the next update:

v2.0a w/ Patch -> v2.1.0

Primary
  • New Versioning: MAJOR.MINOR.REVISION
  • Cleaner way of handling the transition from GUI Event Handling to the Autotyping Task, no longer is there an obvious unresponsive window during autotyping
  • New Identification Scheme for Locations in the Location History list. (Local File:, Web URL:, and Pastebin:)
  • Auto-Completion no longer displays annoying empty pop-up lists
  • Application is Now Java 1.8 (Windows Users have a 1.8 JRE bundled with their executable)
Notable:
  • Autotyper Window is now hidden during autotyping
  • Foundations for notifying the user of the countdown to autotyping.

Please see the Github Repository for a full change log as well as source code and a full commit history.

#12 Possseidon

  • Members
  • 28 posts
  • LocationGermany

Posted 31 March 2015 - 06:31 PM

I just got an amazing idea to make this work pretty much instantly!

Instead of typing every single letter, which obviously needs a lot of time, why not just convert every "\n", that can't get pasted by ComputerCraft, into some placeholder, copy the \n-less encoded text with ctrl-C as one line and let a computercraft program decode it again just using the paste event you get from ctrl-V

Should be possible in my opinion, as long as you find a character, that you can use for the placeholder thingy.
That would probably be the fastest method I can think of ^^

If you see any reason why this wouldn't work, please tell me :)

Edit:

Thought about it a bit more, any if that doesn't work, you could do something that mixes both ideas a bit.
Make your program not type the charachters individually. Make it copy a whole line into the system-clipboard, and then don't simulate every single letter, but simulate a ctrl-V into ComputerCraft.
Then simulate a "return key" to get into the next line and do all that for every line. Should be, if done correctly, way faster than typing.

From my own expirience:
I'm programming in Delphi (you probably don't know that langauage... don't worry :P ) and once made a chat-spambot that had at first the same principle like your program.
Like typing every single letter, pressing return, typing all letters again, pressing return and so on, to spam whatever chat you want.
After some time, since it was kinda slow, I got that idea of copying the text into the clipboard as well and suddenly my spambot became like incredibly fast and 500% more anyoing xD

Edited by Possseidon, 31 March 2015 - 06:43 PM.


#13 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 31 March 2015 - 09:06 PM

View PostPossseidon, on 31 March 2015 - 06:31 PM, said:

-snip-

From memory the text is limited at 255 characters per paste event. Using paste events is faster than lots of chars so part of what you have said is still implementable.

#14 Possseidon

  • Members
  • 28 posts
  • LocationGermany

Posted 01 April 2015 - 10:18 AM

View PostSquidDev, on 31 March 2015 - 09:06 PM, said:

View PostPossseidon, on 31 March 2015 - 06:31 PM, said:

-snip-

From memory the text is limited at 255 characters per paste event. Using paste events is faster than lots of chars so part of what you have said is still implementable.

Wow your right... tested it and the limit isn't even 255/256 but 128 o_O
Well... there is still my second idea of pasting line by line. And if (for some weird reason) a line is longer than 128 it has to get split.

#15 Wojbie

  • Members
  • 631 posts
  • LocationKinda lost

Posted 01 April 2015 - 10:27 AM

Line longer than 128 characters? More common than you think.

#16 Possseidon

  • Members
  • 28 posts
  • LocationGermany

Posted 01 April 2015 - 11:25 AM

View Postwojbie, on 01 April 2015 - 10:27 AM, said:

Line longer than 128 characters? More common than you think.
Wow! You're right! xD
Even though I program with 2 space-indent and have pretty good formating there are 4 lines in my current project (noptepad), that are longer than 128 chars.

#17 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 03 April 2015 - 12:08 AM

More cleanup in preparation for a larger re-write, next update should include some experiment with speeding up the typing process without making the auto-typed content useless.

v2.1.0 to v2.1.1 (too few visible changes to warrant a minor update)


[Noticeable]
  • General improvements to AutoCompletion (All those things stated in last update now actually work)
  • Alt, Alt-P and Alt-S were broken at some stage in my last cleanup, now they work as expected
  • Updating to New Versions now cause all Preferences to be overwritten to avoid incompatible KV Pairs
    • This means that the new version will not remember your previous settings at all
  • AutoCompletion no longer does a prefix lookup, now it searches for any occurrence at any point in the result.
    • i.e. Typing 'ste' will return all 'Pastebin' results since 'ste' appears in the middle of Pastebin

[Codebase]
  • Continued Cleanup and Conversion to clean Java 8 Functional Idioms
  • The 'caused' flag no longer does anything in AutoCompleteTextField, that was replaced with a Key EventHandler and Mouse EventHandler attached to the ListView
  • AutoCompleteTextField is just generally nicer to read since more procedures have been moved to their own methods
  • SwingKeyboard and FXKeyboard now implement a Queue to allow interaction with the JNativeHooks Dispatch Thread
  • More To-Do's as clean-up continues. Might repalce AutoCompletion with ControlsFX. Why re-invent the wheel?
  • AutoCompletion requires a re-structuring or removal, it is not very plug-and-play. (too few interfaces)
  • Continued attempts to remove Static Variables and the horrible Singleton Pattern...
  • Removed useless @InDev annotation, Renamed InformedOutcome to Outcome, Other Renamings (see commit)
  • Moved all popup.show() calls to AutoCompleteTextField.showPopup(), same for popup.hide() and hidePopup()
  • All calls in FXAutotyperWindow from AutoCompeleteTextField.addData are filtered through saveToHistory now
    • Prevents Duplicate Entries in AutoCompleteTextField
  • Checking if a location already is saved is now done through Google Commons' Hashing Functions
  • Continued Documentation Effort



#18 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 03 April 2015 - 12:16 AM

View PostPossseidon, on 01 April 2015 - 11:25 AM, said:

View Postwojbie, on 01 April 2015 - 10:27 AM, said:

Line longer than 128 characters? More common than you think.
Wow! You're right! xD
Even though I program with 2 space-indent and have pretty good formating there are 4 lines in my current project (noptepad), that are longer than 128 chars.

This is the primary problem, I had played around with using the clipboard but it proved easier and faster to make a solution that made use of AWT's Robot and the Glass UI Robot to emulate the keyboard and commit a variety of keystrokes. It is absolutely 10x faster to copy and paste from the clipboard but the primary problem is the character limit and that you have to be careful to not break the lua interpeter when you split lines up. Not that it is at all impossible.

I plan on exploring other options now that I have more time but my FXKeyboard and SwingKeyboard implementations have been working fine as is and Minecraft has (in my tests) handled the 1 ms keystrokes. Though ccemuredux does not (I imagine there is some discrepancy between how Minecraft handles inputs and how LibGDX/LWJGL does and although I use both very frequently I would not be able to say definitively why since the ccemuredux source i unavailable).

Feel free to recommend more things or, if you have the knowledge and the will, feel free to contribute to the repository via pull requests. The codebase is currently being re-written (since I actually have free time now) to be more easily maintainable and usable. It was written as a quick tool and was great for that, but now that I want to extend it... the lack of interfaces and a concrete API is somewhat of a hell. Moving to Java 8 has helped and so has diligent refactoring but I have a lot to change. Hell, I plan to replace my basic AutoCompletion implementation with ControlsFX's implementation...

Re-inventing the wheel is never a good idea... Documentation is and I did not do enough of that.

Edited by MatthewC529, 03 April 2015 - 12:34 AM.


#19 Possseidon

  • Members
  • 28 posts
  • LocationGermany

Posted 03 April 2015 - 08:51 AM

View PostMatthewC529, on 03 April 2015 - 12:16 AM, said:

It is absolutely 10x faster to copy and paste from the clipboard but the primary problem is the character limit and that you have to be careful to not break the lua interpeter when you split lines up.
Wut? Splitting lines up is a problem in your opinion? Just don't press return between two spilts? xD Or am I misunderstanding/forgetting something?

Edited by Possseidon, 03 April 2015 - 10:50 AM.


#20 MatthewC529

  • Members
  • 36 posts
  • LocationNew York, USA

Posted 03 April 2015 - 03:19 PM

View PostPossseidon, on 03 April 2015 - 08:51 AM, said:

View PostMatthewC529, on 03 April 2015 - 12:16 AM, said:

-snip-
Wut? Splitting lines up is a problem in your opinion? Just don't press return between two spilts? xD Or am I misunderstanding/forgetting something?

I was referencing that I never actually tried splitting if then, for do, function, etc. statements onto multiple lines. After doing a quick test when I woke up to see your reply this morning, the Lua interpeter is a lot better than I thought... though to be fair I think splitting your statements onto multiple lines (except for if then else variable initialization) is just insanely bad practice so I never did that. Nice to know it works though, again I will be playing with this and a few other ideas this week.

Truly I was happy to find this worked:
function
hello
(text)
print(text)
end

if
true
then
hello("hi")
else
hello("Confused")
end






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users